Skip to content

fix(grafana): label composite/multi-target y-axis instead of leaking column name (#351) - #361

Merged
shmsr merged 2 commits into
elastic:mainfrom
giorgi-imerlishvili-elastic:fix/composite-series-yaxis-label
Aug 19, 2026
Merged

fix(grafana): label composite/multi-target y-axis instead of leaking column name (#351)#361
shmsr merged 2 commits into
elastic:mainfrom
giorgi-imerlishvili-elastic:fix/composite-series-yaxis-label

Conversation

@giorgi-imerlishvili-elastic

Copy link
Copy Markdown
Collaborator

Summary

Fixes #351.

Panels that fuse multiple Grafana targets (via curated-pack query_overrides or the general ES|QL translator's multi-target composition) into a single synthetic value/computed_value metric column with a breakdown previously rendered that raw column name as the Kibana Lens y-axis title (e.g. "value" instead of "Disk Space Used Basic"). Single-target native-PROMQL panels already had a title fallback (static legend, else panel title); this generalizes and wires that same fallback into the paths that were missing it, and fixes two places where the label was silently dropped or overridden downstream.

  • observability_migration/adapters/source/grafana/panels.py: generalized _label_native_promql_value_metric_label_placeholder_value_metric to cover both value and computed_value placeholder fields, and wired it into the curated-override and general multi-target fusion translation paths. Curated overrides now prefer an unambiguous static legend across visible targets, falling back to the panel title (mirroring the single-target convention) rather than always using the title.
  • observability_migration/targets/kibana/dashboards_api.py: _xy_axis_from_cfg now shows a caller-derived placeholder label as the y-axis title -- taking precedence over a generic unit-inferred title (e.g. "%") -- while still yielding to an explicit Grafana axis-label override, and still hiding the title for multi-metric axes and non-placeholder single metrics. Both right-axis spellings (right and y2) are correctly excluded from left-axis title inference.
  • observability_migration/targets/kibana/compile.py: _sync_esql_panel_fields now preserves a value/computed_value label across the long-form XY metric-list rebuild that a post-validation query swap triggers, without leaking an unrelated multi-metric label onto the rebuilt placeholder column.
  • observability_migration/targets/kibana/emit/display.py: humanize_metric_label now treats computed_value as a placeholder (like value) instead of humanizing it into a misleading "Computed Value" label.
  • docs/sources/grafana.md: documents the new y-axis labeling behavior for composite/multi-target series.

Test plan

  • make test -- 5746 passed, 3 skipped
  • make lint -- clean
  • make typecheck -- clean
  • New/updated unit tests in tests/targets/kibana/test_dashboards_api.py, tests/targets/kibana/test_shared_compile.py, tests/test_curated_packs.py, tests/test_migrate.py covering: placeholder-label precedence over inferred unit titles, precedence under an explicit Grafana axis-label override, multi-metric and non-placeholder-metric isolation, both right-axis spellings (right/y2), curated static-legend vs. panel-title fallback (including ambiguous mixed-legend targets), and label preservation (without leakage) across compile-time query-swap rebuilds.
  • Live browser verification: migrated the real pinned "Node Exporter Full" (gnetId 1860, revision 37) dashboard, uploaded it to a local Kibana, seeded synthetic telemetry, and confirmed in the rendered dashboard that "Disk Space Used Basic" and "Network Traffic Basic" now show their panel title as the y-axis title, while "CPU Basic" (explicit/unit-derived "%"), "Memory Basic" and "CPU" (multi-metric, "Bytes"/"percentage") are unchanged.
  • Independent code review pass (separate model) identified three edge cases (unit-title precedence, curated static-legend fallback, and compile-time label leakage across unrelated metrics) plus a right-axis (y2) scope gap; all were fixed and re-verified with fresh failing-then-passing regression tests.

…column name (elastic#351)

Panels that collapse a fused Grafana target set (curated-pack overrides or
the general ES|QL translator) into a single synthetic `value`/`computed_value`
column with a breakdown previously showed that raw column name as the Lens
y-axis title instead of a meaningful label. Give the placeholder metric the
same panel-title/static-legend fallback the single-target path already uses,
preserve that label across post-validation query-swap rebuilds, and surface
it as the axis title -- while keeping the existing behavior for multi-metric
axes, non-placeholder single metrics, right-axis (`right`/`y2`) series, and
an operator's explicit Grafana axis-label override.
@shmsr

shmsr commented Aug 18, 2026

Copy link
Copy Markdown
Member

For all the PRs, @giorgi-imerlishvili-elastic do let me know if you tested with UI. Since past few weeks for all the changes I am doing UI verification automated+manually. So do let me know.

Other just the code changes are prone to create rendering issues etc if not validated on the UI.

@giorgi-imerlishvili-elastic

giorgi-imerlishvili-elastic commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator Author

For all the PRs, @giorgi-imerlishvili-elastic do let me know if you tested with UI. Since past few weeks for all the changes I am doing UI verification automated+manually. So do let me know.

Other just the code changes are prone to create rendering issues etc if not validated on the UI.

Yes I did, recent PRs which I opened are based on issues which I found during testing of "Node Exporter Full" and "node-exporter disk graphs". One issue I found was already fixed so I just closed that one.

@shmsr

shmsr commented Aug 18, 2026

Copy link
Copy Markdown
Member

For all the PRs, @giorgi-imerlishvili-elastic do let me know if you tested with UI. Since past few weeks for all the changes I am doing UI verification automated+manually. So do let me know.
Other just the code changes are prone to create rendering issues etc if not validated on the UI.

Yes I did, recent PRs which I opened are based on issues which I found during testing of "Node Exporter Full" and "node-exporter disk graphs". One issue I found was already fixed so I just closed that one.

I meant these changes do they address the bug in the UI? Did you check if panels are now better and do not have that bug?

@giorgi-imerlishvili-elastic

Copy link
Copy Markdown
Collaborator Author

For all the PRs, @giorgi-imerlishvili-elastic do let me know if you tested with UI. Since past few weeks for all the changes I am doing UI verification automated+manually. So do let me know.
Other just the code changes are prone to create rendering issues etc if not validated on the UI.

Yes I did, recent PRs which I opened are based on issues which I found during testing of "Node Exporter Full" and "node-exporter disk graphs". One issue I found was already fixed so I just closed that one.

I meant these changes do they address the bug in the UI? Did you check if panels are now better and do not have that bug?

Yes I checked visually manually + AI + automated. Issues which were reported those PRs should fix.

Placeholder labels still replace leaked value/computed_value names, but a
uniform unit title such as % is a better axis name than duplicating the
panel chrome. Align mixed-legend fallback with curated packs and read
layer metrics when inferring the left axis.
@shmsr
shmsr merged commit b8669bd into elastic:main Aug 19, 2026
10 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Composite-series panels omit the y-axis label, so Lens shows the internal column name value

2 participants