Limit stage metrics to 15 stages per GraphQL request

What does this MR do and why?

  • Limit the value stream stage metrics field to 15 resolutions per GraphQL request, the maximum number of stages in one value stream.
  • Query complexity can't bound this: stages is a plain list, so the field's complexity counts once no matter how many stages resolve it. This uses the existing FieldCallCount extension instead, which counts real resolutions per query.
  • Behind the vsa_stage_metrics_validate_timeframe feature flag, the same gitlab_com_derisk flag as the timeframe check, scoped to the stage's root namespace. Follows the MlCandidateFieldCallCount pattern.
  • The VSA page asks for one value stream at a time (valueStreams(id:)), so at most 15 stages, and is unaffected.
  • The new limit makes some queries that pass today fail, which is a GraphQL breaking change once the flag is fully enabled. It is covered by the performance exemption, documented in the rollout issue: https://gitlab.com/gitlab-org/gitlab/-/work_items/638756#breaking-change-exemption

References

Screenshots or screen recordings

How to set up and validate locally

  1. Enable the flag: Feature.enable(:vsa_stage_metrics_validate_timeframe)
  2. In GraphiQL, request metrics for the default value stream three times with aliases (6 stages each, 18 in total):
    query {
      project(fullPath: "<project>") {
        a: valueStreams { nodes { stages { metrics(timeframe: { start: "2026-09-01", end: "2026-10-01" }) { count { value } } } } }
        b: valueStreams { nodes { stages { metrics(timeframe: { start: "2026-09-01", end: "2026-10-01" }) { count { value } } } } }
        c: valueStreams { nodes { stages { metrics(timeframe: { start: "2026-09-01", end: "2026-10-01" }) { count { value } } } } }
      }
    }
    It returns "metrics" field can be requested only for 15 ValueStreamStage(s) at a time.
  3. Remove two of the aliases. The metrics return as before.
  4. Open the project and group VSA pages. The stage durations chart loads.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Ezekiel Kigbo

Merge request reports

Loading
Loading