Skip to content

Allow support for aggregations in GLQL

What does this MR do and why?

Allow support for aggregations in GLQL

Allow aggregating metrics like count and totalTimeToMerge (for MRs) over a period of time in GLQL

References

Build a PoC to demonstrate feasibility of addin... (#560284 - closed)

Screenshots or screen recordings

Issues MRs
Query
```glql
display: table
title: Issues created in the last 1 year
query: created >= -1y and created <= today()
aggregate:
  dimensions: timeSegment(1m) on createdAt as "Date created"
  metrics: count as "Total issues"
```
```glql
display: table
title: MRs merged in the last 1 year
query: type = MergeRequest and merged >= -1y and merged <= today()
aggregate:
  dimensions: timeSegment(1m) on merged as "Merge date"
  metrics: count as "Total MRs", totalTimeToMerge as "Time to merge"
```
Screenshot

CleanShot 2025-08-08 at 17.33.05.png

CleanShot 2025-08-08 at 17.33.29.png

How to set up and validate locally

  1. Enable feature flag :glql_aggregation
  2. In a project, enter both queries mentioned in the Screenshots section in an issue description.
  3. These queries should produce aggregated results.

Note: totalTimeToMerge returns null on GDK because of lack of data. This should work fine on production.

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 Himanshu Kapoor

Merge request reports

Loading