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

@ -5552,7 +5552,8 @@ WITH agent_stats AS (
coalesce((PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY connection_median_latency_ms)), -1)::FLOAT AS workspace_connection_latency_50,
coalesce((PERCENTILE_CONT(0.95) WITHIN GROUP (ORDER BY connection_median_latency_ms)), -1)::FLOAT AS workspace_connection_latency_95
FROM workspace_agent_stats
WHERE workspace_agent_stats.created_at > $1
-- The greater than 0 is to support legacy agents that don't report connection_median_latency_ms.
WHERE workspace_agent_stats.created_at > $1 AND connection_median_latency_ms > 0
), latest_agent_stats AS (
SELECT
coalesce(SUM(session_count_vscode), 0)::bigint AS session_count_vscode,