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:

  • parameters per field (e.g. { granularity: "weekly" } for time dimensions, { quantile: 0.5 } for duration quantiles)
  • A field property holding the base field name, distinct from key which 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.

Screenshots

Query Result
display: areaChart
mode: analytics
query: type = Pipeline and group = "halcyon-software" and finished > -30d
dimensions: ref
metrics: durationQuantile(0.5) as "Median", durationQuantile(0.95) as "p95"
sort: Median desc

image

display: lineChart
mode: analytics
query: type = Pipeline and group = "halcyon-software" and finished > -30d
dimensions: finished(weekly) as "Finished"
metrics: totalCount, successRate
sort: finished desc

Google_Chrome_Beta_2026-07-28_15.22.08

How to set up and validate locally

  1. Set up Clickhouse in your GDK

  2. Set up Siphon in your GDK

  3. Enable Clickhouse-based analytics: echo 'Gitlab::CurrentSettings.current_application_settings.update(use_clickhouse_for_analytics: true)' | rails c

  4. Seed Pipeline Analytics: FILTER=pipeline_metrics SEED_PIPELINE_METRICS=1 bundle exec rake db:seed_fu

  5. 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)".

  6. 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.

References

Edited by Robert Hunt

Merge request reports

Loading
Loading