grafana/metrics-drilldown

bug: hardcoded legendFormat carried into Explore causes duplicate series names

Open

#1,248 创建于 2026年5月12日

在 GitHub 查看
 (0 评论) (0 反应) (0 负责人)TypeScript (12 fork)github user discovery
good first issue

仓库指标

Star
 (27 star)
PR 合并指标
 (PR 指标待抓取)

描述

What happens

Opening a metric panel in Explore from Drilldown carries over a hardcoded legend. The series end up looking wrong or confusing (e.g. multiple series sharing the same name after a query edit), and the legend setting is collapsed by default in Explore so he user has no clear way to understand why or fix it.

Where the legendFormat is set

  • src/shared/GmdVizPanel/types/timeseries/getTimeseriesQueryRunnerParams.ts
  • src/shared/GmdVizPanel/types/stat/getStatQueryRunnerParams.ts
  • src/shared/GmdVizPanel/types/percentiles/getPercentilesQueryRunnerParams.ts
  • src/shared/GmdVizPanel/types/statushistory/getStatushistoryQueryRunnerParams.ts

Where the link is built

src/MetricScene/PanelMenu/actions/ExploreAction.ts calls getExploreURL(panelData, ..., (query) => ...). The current transform callback only strips __ignore_usage__ from expr.

Proposed fix

Strip legendFormat in the ExploreAction transform callback so the Explore URL does not carry Drilldown's hardcoded legend, while leaving Drilldown's own panels untouched.

Repro

  1. Open a metric in Drilldown (no group-by).
  2. Panel menu → Explore.
  3. In Explore, edit the query to add by (some_label).
  4. Observe all series in the legend share the same name (e.g. avg).
  5. Expand Options → Legend and clear the field — series names now render correctly from labels.

贡献者指南