[v10.3.x] Elasticsearch: Fix legend for alerting, expressions and previously frontend queries #84684
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport 494d169 from #84485
The detailed investigation and decision on why are we producing different names for regular queries and for alerting/expression queries can be found in https://docs.google.com/document/d/1tW0E2Ol5E90KwFvK-FMgfLNs6ChRlSouw-PwyjVNh60/edit
Summary:
We will have to use different naming for responses produced by regular queries vs produced by alerting and expression queries, which can be identified through headers -
FromAlert
andX-Grafana-From-Exp
.For regular queries, we are going to use the same naming as was in frontend, which 100% produces the same experience through frontend and new backend - using
frame.Name
and deleting labelsvalueField.Labels = nil
.For alerting and expression queries, we are going to use the same naming convention as was done initially
field.SetConfig(&data.FieldConfig{DisplayNameFromDS: fieldName})
.Testing:
gdev-elastic
and the preview should look like this - graph legend shouldn't have duplicated name and labels{hostname=hostname1}...
should be visiblees.mov
Also sanity check - that in our test dashboard, names are the same as frontend produced frames (this shouldn't change as we are not changing this logic)
Fixes: #84054
Fixes: #83968