Give the edges' query latency series buckets up to 60 s (T-625) - #449
Merged
Merged
Conversation
added 2 commits
October 2, 2026 22:46
The HTTP edges share one set of latency bounds, tuned for insert acks: 5 ms to 10 s, with only 2.5 s and 10 s above 1 s. A query runs up to max_query_duration_ms (30 s), so histogram_quantile read any query tail past 2.5 s as about 9.7 s and nothing past 10 s at all. On the sandbox the VictoriaMetrics edge's p99 sat at 8.4-9.8 s whether the tail was at 3 s or near 10 s. The query series now take their own bounds: route=query on the API, and kind=query on the ClickHouse and VictoriaMetrics edges. They are 50, 100, 250, 500 and 750 ms, 1, 1.5, 2, 3, 5, 7.5, 10, 15, 20 and 30 s. Every other route and kind keeps the insert bounds. timed/4 takes the bounds from its caller, which picks them by route or kind. A test drives a 3.4 s request through each query series and checks that it lands at 5 s and above, that no query series emits the old 2.5 s bound, and that insert and write keep theirs. docs/deployment.md has the upgrade note (seven more le values per query series; old and new bounds mix in a sum while a roll is in progress).
Fable review of PR 449. - 30 s is only the VictoriaMetrics edge's max_query_duration_ms. An API query runs to its timeoutMs, 60 s by default, so one that took 30-60 s read as 30 s. The query bounds gain 60 s; the comment and the upgrade note name each edge's cap, and say a ClickHouse query past 60 s counts only in +Inf. - The upgrade note said old and new bounds mix only during a roll. A sum by (le) across routes or kinds now mixes them for good; the note says to filter or group by route or kind first. - The test's title said the bounds start at 1 s; they start at 50 ms.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR: Query latency now has buckets from 50 ms to 60 s. A query p99 no longer reads a flat ~9.7 s whenever the tail passes 2.5 s.
Tracker: T-625.
Why
max_query_duration_ms(30 s). An API query runs totimeoutMs(60 s by default).histogram_quantile(0.99, ...)read any query tail past 2.5 s as about 9.7 s.What changed
@query_latency_buckets: 50, 100, 250, 500, 750 ms, 1, 1.5, 2, 3, 5, 7.5, 10, 15, 20, 30, 60 s.smolquery_api_request_microseconds_bucket{route="query"}smolquery_clickhouse_request_microseconds_bucket{kind="query"}smolquery_victoriametrics_request_microseconds_bucket{kind="query"}timed/4takes the bounds from its caller. The caller picks them by route or kind (latency_buckets/1).docs/clickhouse.mdand adocs/deployment.mdupgrade note describe the change.Tests
le="2500000".Review
A Fable review found nothing serious. It confirmed that the selection is a closed set, that rendering handles two bound sets in one family, and that no test, dashboard or doc in the repo hardcodes the old query bounds. Fixed in
Review of T-625: ...:sum by (le)across routes or kinds mixes bound sets for good, not only during a roll.Checks
mix precommit: 3,079 tests passmix cimix dialyzerWatch out
levalues instead of 8 (+8 series per query label value).lesets. Asum by (le)over both is rough until the old pods are gone and one rate window has passed.sum by (le)across routes or kinds now mixes two bound sets for good. Filter or group byrouteorkindfirst.SELECT 1all land inle="50000". The goal here is the tail, so this is intended.+Inf, so a quantile reads it as 60 s.The real tail (query-tier CPU) is a separate fix.
🤖 Generated with Claude Code