Use Float for Aggregation Engines sum metrics
What does this MR do and why?
In Aggregation Engines, the measurement macro generates min, max, mean, quantile and sum metrics from a single declaration. For integer measurements such as durations in seconds, the generated sum was exposed over GraphQL as an Int. Summing per-row values across many pipelines, deployments, merge requests, or agent sessions quickly exceeds the 32-bit Int range, causing errors or wrong totals.
This MR makes the generated sum metric always a Float, regardless of the measurement's base type. The min, max, mean, and quantile metrics are unchanged, and float measurements keep their existing Float sum. An earlier iteration used BigInt, but that serializes as a string in GraphQL responses. Float has enough range for these totals and stays a JSON number, so clients keep treating the field as numeric.
Affected GraphQL fields (type changes from Int to Float):
AgentPlatformSessionsAggregationResponseDurationMetrics.sumDeploymentsAggregationResponseDurationMetrics.sumMergeRequestsAggregationResponseTimeToMergeMetrics.sumPipelinesAggregationResponseDurationMetrics.sum
Client impact: integer sums are now returned as floats (for example 12345.0 instead of 12345). Clients that require an integer should cast the value.
References
- Aggregation Engines developer documentation
- No issue is linked to this MR.
Screenshots or screen recordings
Not applicable, backend and GraphQL schema change only.
How to set up and validate locally
-
Run the specs:
bin/rspec spec/lib/gitlab/database/aggregation/engine_spec.rb -
In GraphiQL at
http://gdk.test:3000/-/graphql-explorer, run an introspection query and confirmsumreportsFloat:{ __type(name: "PipelinesAggregationResponseDurationMetrics") { fields { name type { name } } } }
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.