Skip to content

feat(traceql): return one series per quantile from quantile_over_time lists - #1089

Open
44YHC wants to merge 2 commits into
feat/traceql-literalsfrom
feat/traceql-quantiles
Open

44YHC wants to merge 2 commits into
feat/traceql-literalsfrom
feat/traceql-quantiles

Conversation

@44YHC

@44YHC 44YHC commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #1087; merge that first. quantile_over_time takes a list of quantiles, as in Tempo.

Summary

  • Grammar. quantile_over_time(field, q1, q2, …) takes one or more numbers, each checked against [0, 1] at parse time (quantile must be between 0 and 1: <q>).
  • SQL. One quantiles(q1, …)(col) per bucket and group, the same ClickHouse family as before. Values are not Tempo's approximate log2 buckets.
  • Series. Go fans the result out to one series per quantile, labelled by… then p=<q> as a float, always, including with by(), on both the range and instant endpoints.
  • Exemplars. Each goes to the nearest query-wide quantile value, as in Tempo. The query-wide row comes from GROUP BY GROUPING SETS ((ts, by…), ()) on the same statement, which survives HTTP, unlike WITH TOTALS.

Breaking changes

Queries that now fail

  • quantile_over_time requires at least one quantile, and quantile_over_time(duration) is a parse error instead of defaulting to 0.5. Values outside [0, 1] fail at parse time, and a quantile list on any other metrics function is a parse error.

Results that change

  • Every quantile_over_time series carries p, including with by() and on the instant endpoint.

Upgrade notes

  • Dashboards that call quantile_over_time(duration) need an explicit quantile, for example quantile_over_time(duration, 0.5).

Evidence

  • Parser tests pin lists, bounds and rejections. Plan tests pin the statement shape. Behaviour tests on ClickHouse check one series per quantile and exemplar assignment, range and instant, single node and two shards.
  • go test ./... passes. The full e2e suite and grid.traceql pass on the full stack tip, which includes this branch.

Merge Danger

Door: two-way.

Blast Radius: quantile_over_time only.

Pre-existing, unchanged: an instant query with no by() that matches no span returns NaN, which fails JSON encoding.

44YHC added 2 commits November 6, 2026 07:03
… lists

quantile_over_time takes a required list of levels in [0, 1], checked at
parse time; other functions reject a list. One quantiles() per bucket and
group fans out to a series per level, labelled by... then p, on the range
and instant endpoints.

Each exemplar goes to the series of its group whose quantile has the nearest
query-wide value. That value comes from a GROUPING SETS row on the series
statement, since a WITH TOTALS block doesn't reach a client over HTTP.

BREAKING: quantile_over_time(duration) is a parse error, and every series
carries p, including with by() and on the instant endpoint.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant