Add GLQL parser support for AiUsageEvent analytics mode
Summary
Add parser support for AiUsageEvent with mode: analytics syntax in GLQL. This enables users to write analytics queries for GitLab Duo usage patterns, feature adoption, and AI interaction metrics.
Example Query
mode: analytics
query: type = AiUsageEvent and group = "gitlab-org" and feature = "chat" and timestamp >= -30d
dimensions: feature, timestamp(weekly)
metrics: totalCount, usersCount
sort: totalCount desc
limit: 20Implementation Details
Updated to match the engine that shipped: the engine is mounted as analytics.duoUsageEvents. Dimensions are feature, event, user, timestamp(granularity: daily|weekly|monthly). Metrics are totalCount, usersCount, featuresCount, returningUsersCount, previousPeriodUsersCount. The original example's userRole and averageSentiment don't exist in the engine, and count/uniqueUsers are totalCount/usersCount. Parser/codegen/transformer are already generic over analytics sources, so the change is a new source analyzer plus type wiring. The glql_ai_usage_event_analytics_aggregation feature flag was never created; the source ships unflagged like the other analytics sources.
Dependencies
- Blocked by: Add Generic AI Usage Events Aggregation Engine (gitlab#589610 - closed) • Pavel Shutsin • 18.11
- Blocked by: Create AiUsageEvents GraphQL aggregation field (gitlab#592278 - closed) • Unassigned • 19.2
Acceptance Criteria
- Parser recognizes
type: AiUsageEventwithmode: analytics - Dimensions and metrics are parsed correctly
- Generated GraphQL query matches aggregation schema
- Response transformer handles aggregated data format
- Error messages are helpful for invalid syntax
Related
- Epic: &21216 (closed)
- Engine: gitlab#589610 (closed)