Migrate durationQuantile and timeToMergeQuantile metrics to measurement fields
What does this MR do and why?
The GLQL analytics metrics durationQuantile (pipelines) and timeToMergeQuantile (merge requests) now compile to the aggregation engines' measurement-based GraphQL fields instead of the deprecated standalone quantile fields:
durationQuantile(quantile: X)becomesduration { quantile(quantile: X) }timeToMergeQuantile(quantile: X)becomestimeToMerge { quantile(quantile: X) }- sorting by these metrics uses the
duration.quantile/timeToMerge.quantileidentifiers
The engines are phasing out the old fields in favour of measurement groups (quantile alongside min, max, mean, sum), so GLQL has to move off them before they are removed. GLQL query syntax is unchanged and result rows keep the same keys as before (durationQuantile, timeToMergeQuantile, or the user alias).
Behaviour change: timeToMergeQuantile now reports seconds; the deprecated field reported milliseconds. durationQuantile was already in seconds and is unaffected.
Coordinated monorepo work
This must ship together with a gitlab-org/gitlab MR that bumps the GLQL package and:
- switches
timeToMergeQuantilefrom the milliseconds to the seconds duration unit/presenter inapp/assets/javascripts/glql/utils/value_format.jsandapp/assets/javascripts/glql/components/presenters/presenter_registry.js— without this, time to merge renders 1000× too small; - updates the flat
timeToMergeQuantileresponse stub inee/spec/requests/api/glql_spec.rbto the nestedtimeToMerge { … }shape; - adds "in seconds" to the
timeToMergeQuantilerow indoc/user/glql/data_sources/merge_request_analytics.md.
Raw timeToMergeQuantile values returned by /api/v4/glql change from milliseconds to seconds for API consumers. No dashboard definition in the monorepo references these fields through GLQL, and durationQuantile consumers are unaffected.
How to set up and validate locally
-
Run the test suite in the glql repo:
cargo test -
Optional, against a GDK with the aggregation engines available: run a pipelines analytics GLQL block, for example
mode: analytics dimensions: ref metrics: totalCount, durationQuantile(0.95) --- type = pipeline and project = "gitlab-org/gitlab"and a merge requests equivalent with
type = MergeRequestandmetrics: totalCount, timeToMergeQuantile(0.5). Verify the compiled GraphQL selectsduration { quantile(quantile: 0.95) }/timeToMerge { quantile(quantile: 0.5) }, and that the result rows still expose thedurationQuantile/timeToMergeQuantilekeys, with time-to-merge now in seconds.
Related issues
Related to gitlab#628240