VolkovLabs / volkovlabs-dynamictext-panel

Business Text Panel for @grafana
https://docs.volkovlabs.io
Apache License 2.0
78 stars 14 forks source link

Broken Dynamic Text with Grafana 10 update #188

Closed centenico closed 11 months ago

centenico commented 1 year ago

Good evening! I'm having some issue with the DynamicText after upgrading to Grafana 10 and Dynamic Text version 4.0.0.

It seems like it can't display my query results anymore, I have been using like that since Grafana 8 and I don't understand if it's a bug or what.

Basically, here is my query, it should expose a variable "Total" displaying the value "6" the query is working and the result is present as you can see from the table view

image

Here you can see the Dynamic Text result instead, I'm trying to display the {{Total}} variable, but it shows nothing instead. I did not change the code of the content, and it always worked previously (before updating to Grafana 10).

image

Grafana version 10.0.1 (5A30620B85) Dynamic Text version: 4.0.0

Thanks in advance and sorry for troubling you!

Nicola.

mikhail-vl commented 1 year ago

@centenico Looking at the @root output your Total field is returned as Value.

Could you please try Value and let me know.

centenico commented 1 year ago

@centenico Looking at the @root output your Total field is returned as Value.

Could you please try Value and let me know.

Hi Mikhail, thanks for the incredibly fast answer. Yes {{value}} work perfectly fine, but I don't know why the variables created form the Legend of the query are not displayed anymore. To make myself more clear, here is a screenshot of the same Panel, in Grafana 9 with the Dynamic Text version 3.x

image

mikhail-vl commented 1 year ago

@centenico You are using Options -> Legend to update the field's name. I supposed something got change in the way how Data Sources return fields in Grafana 10.

Have you tested DT 3.1.0 with Grafana 10? Is it the same?

centenico commented 1 year ago

@centenico You are using Options -> Legend to update the field's name. I supposed something got change in the way how Data Sources return fields in Grafana 10.

Have you tested DT 3.1.0 with Grafana 10? Is it the same?

Yes, DT 3.1.0 has the same issue with Grafana 10.

So you say that it's Grafana that changed the way they handle fields, I'll have to make some tests. Thanks in advance, I'll let you know if I find something

mikhail-vl commented 1 year ago

@centenico It's something specific to the Prometheus data source, in the way how it's updating the field name.

I will have to dig deeper into the data returned from the data source to investigate further.

centenico commented 1 year ago

@mikhail-vl

Seems like switching the Format type on the Query options from "Time series" to "Table" fixed the issue

Not sure if that's the correct way to solve that issue, but I'll give it a try.

image

mikhail-vl commented 1 year ago

@centenico If table works, then processing of the Legend in Time Series and Table are done differently.

For Time Series it may be done using labels, and native panels understand that. Dynamic Text operates with field names returned from the data source.

Seems to me, it's a breaking change in Grafana 10.

mikhail-vl commented 11 months ago

@centenico I looked at the Prometheus data source. As you said, the Time Series format does not set the field name correctly as it's set in Options.

The table format works because it parses all labels and adds them as fields. It's a good solution from my point of view. I looked at the opened issues in the Grafana repository, but can't find the relevant issue. I am not sure if it's going to be fixed moving forward in Grafana 10.x.