fix: only sum connection latencies when they are set (#6524)

This was producing a median that didn't make sense.
This commit is contained in:
Kyle Carberry
2023-03-08 21:53:09 -06:00
committed by GitHub
parent 1199a9330a
commit 1cc10f2ffb
3 changed files with 7 additions and 2 deletions

View File

@ -340,6 +340,9 @@ func (q *fakeQuerier) GetDeploymentWorkspaceAgentStats(_ context.Context, create
latencies := make([]float64, 0)
for _, agentStat := range agentStatsCreatedAfter {
if agentStat.ConnectionMedianLatencyMS <= 0 {
continue
}
stat.WorkspaceRxBytes += agentStat.RxBytes
stat.WorkspaceTxBytes += agentStat.TxBytes
latencies = append(latencies, agentStat.ConnectionMedianLatencyMS)