Open fredma opened 4 years ago
+1
interesting -- I don't know flux well enough to help on the query...
The issue is that labels in influx are always strings, and the query structure you have returns them as a series. If you rewrite the query so that it is a table and the threshold values are numbers, they should graph like another series
Hi,
I am aware of how to add threshold in Grafana Dashboard in the viz options but I'm exploring a different way to visualize the threshold values using influxdb tags as part of the measurement. This was briefly mentionned in a session from InfluxDays 2020 that it is possible towards the end. Below is what I tried using grafana 7.1 beta with the out of the box influxdb datasource with Flux configured.
Im currently trying out sending threshold values as tags from telegraf to influxdb as below for cpu usage.
Then, in grafana, the influxql query would get the tags values for those threshold tags. Grafana is able to graph those threshold tags if I drop aggregate functions from the query.
Below a screenshot of how it is rendered.
Showing the same using table:
Now, I tried to do the same with Flux, but it does not graph them as expected. I dont think we can force Grafana to tell it to graph tags values as it could be any string but in this case we are passing digits in string format.
The query is able to get threshold tags value for sure as show below.
I saw a transform that convert labels to fields but that only seem to work for table format. Is it not possible to have this working for graph format if the tags values are numbers?
Finally, I was trying to use another transform "Add Field from calculation" to see if I could tell it to use tag values insteaf of field values, but the transform only expect field or hardcoded number as below. Is it possible to have it working with tags values?
Thanks.