Add GLQL presenters for merge request and Duo usage analytics
What does this MR do and why?
Frontend half of enabling the two new GLQL analytics sources (MergeRequest and AiUsageEvent, added to the compiler in 0.33.0). Bumps @gitlab/query-language-rust to 0.33.0 and registers presenters for the new fields:
throughputCount,featuresCount,returningUsersCount,previousPeriodUsersCountrender as numberstimeToMergeQuantilegets a new millisecond-aware duration presenter. The merge request engine emits milliseconds (merge_duration_ms), unlike pipeline analytics wheredurationQuantileis seconds, so reusing the existing presenter would render values 1000x too largeuseron Duo usage dimensions renders as a user avatarstateon merge request analytics dimensions now maps to the merge request badge shapes, with a translatedLockedlabel and a neutral-badge fallback for unmapped states (previously an empty badge)
The compiler bump also refreshes parser spec snapshots (compile output gained field and _internal keys since 0.31.0).
The backend half (gem bump and request specs) is in Add merge request and Duo usage GLQL analytics ... (!248034 - merged). Neither source is documented until both are merged; docs are tracked in #592280 (closed) and #592272 (closed).
Author note (non-blocking): this will conflict trivially with !241834 (merged) (package version line and parser snapshots). I'm holding the merge order myself.
Screenshots
AiUsageEvent
| GLQL query | Display Type | Screenshot |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MergeRequest (analytics)
| GLQL query | Display Type | Screenshot |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
How to set up and validate locally
-
Set up Clickhouse in your GDK
-
Set up Siphon in your GDK so merge requests replicate into ClickHouse
-
Enable Clickhouse-based analytics:
echo 'Gitlab::CurrentSettings.current_application_settings.update(use_clickhouse_for_analytics: true)' | rails c -
Seed AI usage events:
FILTER=ai_usage_stats bundle exec rake db:seed_fu(seeds the first project; usePROJECT_ID=<id>to target another) -
Seed MR Analytics:
FILTER=productivity_analytics SEED_PRODUCTIVITY_ANALYTICS=1bundle exec rake db:seed_fu(seeds the first project; usePROJECT_ID=<id>to target another) -
Add a GLQL block to any issue or wiki page for merge request analytics:
```glql display: table mode: analytics query: type = MergeRequest and group = "gitlab-org" and merged > -30d dimensions: merged(weekly), state metrics: totalCount, throughputCount, timeToMergeQuantile(0.5) ```The table should render state values as merge request badges (including merged), and time to merge as a formatted duration (for example
1d 2h), not a raw millisecond count. -
And one for AI usage events:
```glql display: table mode: analytics query: type = AiUsageEvent and group = "gitlab-org" and timestamp > -30d dimensions: feature, user, timestamp metrics: totalCount, usersCount, featuresCount ```The user column should render avatars, and the metric columns plain numbers. No console errors in either case.
Related to #592279 (closed) and #592271 (closed).















