grafana / scenes

Build Grafana dashboards directly in your Grafana app plugins.
https://grafana.com/developers/scenes
Apache License 2.0
134 stars 20 forks source link

${__series.name} macro should probably return the same thing as ${__field.displayName} even for frames with more than 1 value field #772

Open torkelo opened 3 months ago

torkelo commented 3 months ago

When ${series.name} is used in a datalink we have a field in the dataContext, so feels wrong to use getFrameDisplayName in the macro, getFrameDisplayName does return the same thing as getFieldDisplayName for data frames that only have one value field.

But when testing this out now in time series panel the frame that the data links operate on seems to be the joined data frame, so even if the query returns multiple frames the ones the datalinks see is just 1 frame with many value fields, this turns getFrameDisplayName with a fieldIndex just return Series (<n>) instead of the propper field name.

Try it locally with a Prometheus query that, if it returns 1 series ${__series.name} works if it returns 2 it shows up as Series (<n>) , not sure if this is a regression in TimeSeriesPanel that datalinks operator on the joined data frame, this must surely have worked before?

@leeoniya @dprokop thoughts?

torkelo commented 3 months ago

Root cause of regression, https://github.com/grafana/grafana/pull/83654

but instead of reverting that I think changing ${__series.name} macro could be a good idea (so that it returns the same as ${__field.displayName} when there is a field in the dataContext