fix(grafana): label composite/multi-target y-axis instead of leaking column name (#351) - #361
Conversation
…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.
|
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.
Summary
Fixes #351.
Panels that fuse multiple Grafana targets (via curated-pack
query_overridesor the general ES|QL translator's multi-target composition) into a single syntheticvalue/computed_valuemetric 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_metricto cover bothvalueandcomputed_valueplaceholder 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_cfgnow 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 (rightandy2) are correctly excluded from left-axis title inference.observability_migration/targets/kibana/compile.py:_sync_esql_panel_fieldsnow preserves avalue/computed_valuelabel 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_labelnow treatscomputed_valueas a placeholder (likevalue) 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 skippedmake lint-- cleanmake typecheck-- cleantests/targets/kibana/test_dashboards_api.py,tests/targets/kibana/test_shared_compile.py,tests/test_curated_packs.py,tests/test_migrate.pycovering: 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.y2) scope gap; all were fixed and re-verified with fresh failing-then-passing regression tests.