Add a dynamic description to the GLQL bar list and table

What does this MR do and why?

GLQL's stat display already supports a description under displayConfig, filled in from %{metricName} placeholders in the query result. This adds the same to barList and table.

A placeholder takes its value from the first result row and is formatted by that metric's unit, so counts get thousands separators and durations read like 1h 1m 1s. A missing value shows an em dash. Same behavior the stat already has.

For bar lists and tables: a dimensionless bar list draws one bar per queried metric, so a metric that's only there to be quoted in the description has to be listed in displayConfig.hiddenMetrics to keep it out of the bars. The metric is still queried and can still be quoted, it's just not drawn, and a table leaves out the matching column the same way. Matching works against a metric's alias or its base key, same as trendMetric. An unknown metric name, a hiddenMetrics value that isn't a list, or a bar list that would hide every metric are block errors. Placeholders can't be combined with dimensions, since a placeholder only reads the first row.

data.vue wasn't passing displayConfig through to the table at all, so that's wired up now.

A placeholder naming a metric the query didn't select is a validation error. That check used to live only in the stat presenter, it's shared now so all three displays report the same error.

No dashboard YAML here. The panels that use this are in !256887 (merged), stacked on this branch. Docs are a separate follow-up.

One thing worth flagging: an earlier revision totalled each placeholder across all returned rows. That's dropped, because summing is meaningless for a rate or an average and nothing in the data model distinguishes those from a plain count. A cross-row total can be added later if a panel actually needs it.

References

Screenshots or screen recordings

Before After

How to set up and validate locally

  1. Paste this into any issue or MR description. Confirm the bar list draws only two bars (Median, p75), with throughputCount hidden via hiddenMetrics and showing up only in the description text. Then remove the hiddenMetrics line and confirm throughputCount comes back as a third bar.

    ```glql
    display: barList
    displayConfig:
      description: "%{throughputCount} merged merge requests"
      hiddenMetrics: [throughputCount]
    mode: analytics
    query: type = MergeRequest and merged >= -30d
    metrics: timeToMergeQuantile(0.5) as "Median", timeToMergeQuantile(0.75) as "p75", throughputCount
    ```
  2. Paste this and confirm the table renders with the description filled in, both placeholders resolved.

    ```glql
    display: table
    displayConfig:
      description: "%{usersCount} users ran %{totalCount} sessions"
    mode: analytics
    query: type = AgentPlatformSession and created >= -30d
    metrics: usersCount, totalCount
    ```
  3. Change a placeholder to name a metric that isn't in metrics: and confirm it errors instead of rendering.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist.

Edited by Brandon Labuschagne

Merge request reports

Loading
Loading