Skip to content

fix: correct connection_median_latency_ms in query #15086

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 17, 2024
Merged

Conversation

f0ssel
Copy link
Contributor

@f0ssel f0ssel commented Oct 15, 2024

Closes #14805

@@ -661,7 +661,7 @@ WITH
AND date_trunc('minute', was.created_at) = mb.minute_bucket
AND was.template_id = mb.template_id
AND was.user_id = mb.user_id
AND was.connection_median_latency_ms >= 0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the bug fix, in other queries that use connection_median_latency_ms we always filter our the 0 values to rule out any usage stats.

Comment on lines +339 to +340
-- 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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is another fix I found along the way where we weren't filtering out the stats with 0 or selecting only recent stats.

@f0ssel f0ssel requested review from Emyrk and ethanndickson October 16, 2024 16:56
@f0ssel f0ssel marked this pull request as ready for review October 16, 2024 16:56
Copy link
Member

@ethanndickson ethanndickson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catches!

@f0ssel f0ssel merged commit 5f640eb into main Oct 17, 2024
29 checks passed
@f0ssel f0ssel deleted the f0ssel/usage-query-0 branch October 17, 2024 16:22
@github-actions github-actions bot locked and limited conversation to collaborators Oct 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Some users reporting 0ms latency on template insights
2 participants