Data Aggregation in GLQL
## Overview
Enable aggregation capabilities in GLQL to support advanced analytics and dashboard visualizations. This epic tracks the work to establish a common pattern for aggregation with first use cases in GLQL.
**DRI:** @pshutsin
**Teams:** ~"group::optimize" ~backend & ~"group::platform insights" ~GLQL
**Parent planning epic:** [&20693 - Dashboard Foundations FY27Q1 goals](https://gitlab.com/groups/gitlab-org/-/work_items/20693)
---
## Key Deliverables
### Aggregation Engine Framework
- Create an aggregation engine and integrate with GraphQL API
- Restructure GraphQL schema to separate filters from ordering/pagination
- Support `count` on aggregated results ✅
- Support filtering on aggregated metrics
- Support individual record queries alongside aggregated metrics
- Enforce strict GraphQL types for parameterized arguments
### New Aggregation Engines (Data Sources)
- Target: At least one data source added to GLQL with aggregation support
- Code Suggestions Aggregation Engine (ClickHouse)
- Generic AI Usage Events Aggregation Engine (ClickHouse)
- Deployments Aggregation Engine (ClickHouse)
- Merge Requests Aggregation Engine (PostgreSQL)
- Contributions Aggregation Engine (ClickHouse)
### GLQL Integration & Research
- Identify common data and API patterns for migration to GLQL and aggregation engines
- Identify new visualisation requirements for GLQL
- Document/streamline the process of adding a new engine
### Change Management
- Change management and documentation strategy for analytics aggregations
---
## Impact
Aggregation capabilities unlock:
- Summary statistics across projects/groups
- Trend analysis and comparisons
- Performance metrics at scale
- Foundation for Engineering Intelligence dashboards
---
## Aggregations implementation
Vertical slice approach: Validate pattern with CodeSuggestions, then replicate across remaining data types
```mermaid
graph LR
subgraph P1["Priority 1: CodeSuggestion"]
direction LR
CS1[Engine] --> CS2[GraphQL] --> CS3[Parser] --> CS4[UI/Docs/Agent]
end
subgraph P2["Priority 2: AgentPlatformSession"]
direction LR
AP1[Engine] --> AP2[GraphQL] --> AP3[Parser] --> AP4[UI/Docs/Agent]
end
subgraph P3["Priority 3: AiUsageEvents"]
direction LR
AI1[Engine] --> AI2[GraphQL] --> AI3[Parser] --> AI4[UI/Docs/Agent]
end
subgraph P4["Priority 4-7: Other Types"]
direction LR
OT1[Engines] --> OT2[GraphQL] --> OT3[Parser] --> OT4[UI/Docs/Agent]
end
P1 -.Pattern<br/>Validated.-> P2
P2 -.Pattern<br/>Replicated.-> P3
P3 -.Pattern<br/>Scaled.-> P4
```
## Related Links
- [Dashboard Foundations FY27Q1 goals](https://gitlab.com/groups/gitlab-org/-/work_items/20693)
- [Analytics & Data Exploration Platform - Master Planning Epic](https://gitlab.com/groups/gitlab-org/-/work_items/20515)
- [Research: Common data and API patterns](https://gitlab.com/gitlab-org/gitlab/-/issues/588589)
epic