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) becomes duration { quantile(quantile: X) }
  • timeToMergeQuantile(quantile: X) becomes timeToMerge { quantile(quantile: X) }
  • sorting by these metrics uses the duration.quantile / timeToMerge.quantile identifiers

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 timeToMergeQuantile from the milliseconds to the seconds duration unit/presenter in app/assets/javascripts/glql/utils/value_format.js and app/assets/javascripts/glql/components/presenters/presenter_registry.js — without this, time to merge renders 1000× too small;
  • updates the flat timeToMergeQuantile response stub in ee/spec/requests/api/glql_spec.rb to the nested timeToMerge { … } shape;
  • adds "in seconds" to the timeToMergeQuantile row in doc/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

  1. Run the test suite in the glql repo:

    cargo test
  2. 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 = MergeRequest and metrics: totalCount, timeToMergeQuantile(0.5). Verify the compiled GraphQL selects duration { quantile(quantile: 0.95) } / timeToMerge { quantile(quantile: 0.5) }, and that the result rows still expose the durationQuantile / timeToMergeQuantile keys, with time-to-merge now in seconds.

Related to gitlab#628240

🤖 Generated with Claude Code

Edited by Pavel Shutsin

Merge request reports

Loading
Loading