Use compile output parameter metadata for time dimension and alias support
What does this MR do and why?
Adds parameter metadata awareness and aliased field support to the GLQL frontend. The GLQL compiler now includes parameterised field support (glql#130 (closed)) and aliased duplicate fields (glql#153 (closed)). The compile output includes:
parametersper field (e.g.{ granularity: "weekly" }for time dimensions,{ quantile: 0.5 }for duration quantiles)- A
fieldproperty holding the base field name, distinct fromkeywhich holds the alias for aliased fields (e.g.key: "p50",field: "durationQuantile")
Time dimension detection
A field with a granularity parameter is a time dimension. timeDimensionsOf, granularityOf, and labelWithGranularity utilities detect this from compile output metadata and surface applied granularity defaults in table column headers and chart axis labels as parenthetical text (e.g. "Finished (weekly)").
Aliased field support
For aliased parameterised fields like durationQuantile(0.5) as "p50", the frontend needs to use key for data access (the response is keyed by alias) but the base field name for formatter/presenter lookup (the static maps are keyed by base names like durationQuantile).
baseFieldKeyOf(field) resolves field.field ?? field.key for all formatter and presenter lookup call sites. FieldPresenter gains a presenterKey prop to separate presenter dispatch from data access, so fieldKey reads data by alias while presenterKey looks up the correct presenter by base field name.
Related work
- REST API: Expose field, type, and parameters in GLQL REST... (!243518 - merged)
- Documentation: Document GLQL parameterized fields and duplicat... (!246245 - merged)
- AI gateway: feat: add parameterised field and alias syntax ... (gitlab-org/modelops/applied-ml/code-suggestions/ai-assist!6050 - merged)
Screenshots
| Query | Result |
|---|---|
|
|
|
How to set up and validate locally
-
Set up Clickhouse in your GDK
-
Set up Siphon in your GDK
-
Enable Clickhouse-based analytics:
echo 'Gitlab::CurrentSettings.current_application_settings.update(use_clickhouse_for_analytics: true)' | rails c -
Seed Pipeline Analytics:
FILTER=pipeline_metrics SEED_PIPELINE_METRICS=1 bundle exec rake db:seed_fu -
Test with an analytics query that uses parameterised dimensions:
```glql display: table mode: analytics query: type = Pipeline and project = "gitlab-org/gitlab" and finished > -30d dimensions: finished(weekly), status metrics: totalCount, successRate sort: finished desc ```The "Finished" column header should show "Finished (weekly)".
-
Test with aliased parameterised metrics:
```glql display: table mode: analytics query: type = Pipeline and project = "gitlab-org/gitlab" and finished > -30d dimensions: ref metrics: durationQuantile(0.5) as "Median", durationQuantile(0.95) as "p95" sort: Median desc ```Both "Median" and "p95" columns should render with the duration formatter (e.g. "1h 2m 3s"), not raw seconds.

