Skip to content

grafana-migrate: multi-label legend {{verb}} {{resource_kind}} collapses to a single breakdown — series visually merged #189

Description

@miguel-sanchez-elastic

Summary

When migrating a Grafana time-series panel whose legend references two or more labels (e.g. {{verb}} {{resource_kind}}), the migrated Kibana panel ends up with only the first label in the Breakdown. The chart then collapses all series that share the first label, so it looks visibly wrong versus the source. Adding the second field to the Breakdown manually in Kibana fixes it.

Source

  • Dashboard: ArgoCD (official argo-cd-mixin), Grafana Labs #14584
  • Panel: "K8s API Activity"
  • Query: sum(increase(argocd_app_k8s_request_total{namespace=~"$namespace",server=~"$cluster"}[$interval])) by (verb, resource_kind)
  • Legend: {{verb}} {{resource_kind}}

Expected

The migrated panel should break the series down by both verb and resource_kind (Grafana shows one line per verb×resource_kind combination). The engine already has logic for this — for 2+ legend labels it is supposed to synthesize a composite EVAL legend = CONCAT(...) column and set breakdown.field = "legend".

Actual

Only verb lands in the Kibana Breakdown. The chart shows one series per verb (verb_1, verb_2, verb_3) instead of per verb×resource_kind, so series that differ only by resource_kind are merged and the shape no longer matches the source. Manually adding resource_kind to the Breakdown in the Kibana panel editor restores the correct chart — confirming the field is present and queryable; it just wasn't wired into the breakdown.

Likely area

The composite-legend path (_apply_composite_legend_to_xy_panel, observability_migration/adapters/source/grafana/panels.py) appears to have bailed out for this panel and fallen back to the single-field breakdown selected in select_xy_dimension_fields (observability_migration/targets/kibana/emit/esql_utils.py), which only ever takes the second by column. The "extra grouping dimension(s) … visually merged" warning likely fired. Needs investigation into why the composite legend didn't apply when both labels are valid output columns.

Acceptance criteria

  • Migrating the ArgoCD "K8s API Activity" panel produces a Kibana chart broken down by both verb and resource_kind (composite legend), matching the source.
  • Multi-label legends where all labels resolve to real output columns no longer silently collapse to a single breakdown field.
  • Regression test covering a {{a}} {{b}} legend over a by (a, b) query.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

asset:dashboardsDashboard migration assetsbugSomething isn't workingprogram:grafana-engineGrafana translator and engine correctnesssource:grafanaGrafana source migrationworkstream:translatorQuery, panel, and semantic translation capability

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions