Gauge Panel seems to show random values

Hi all,

I’m using Grafana Cloud. The Grafana version is “Grafana v11.0.0-67977 (0e7c0d25fe)”

I have created a dashboard that shows values from some IoT sensors (from an InfluxDB database). It has gauges for the momentary (most recent) values and graphs to see the long time trend of the measurements.
Everything is fine with the graphs, but I noticed that the gauges are not always showing the last measured value (the most right measurement point in the graphs).
When I manually refresh the dashboard
grafik
the shown value in the gauge changes with each refresh. For some reasons one of the measured values in the past is shown but not the most recent one (what I would have expected).
In the calculation settings of the gauges
grafik
I tried:

  • “Last*”
  • “Last”
  • nothing
    The result was always the same.
    I see the same behavior in the public version of the panel. When I refresh the browser tab different values are show in the gauges after each refresh.

I assume I have a general misconception about the shown values in gauges, but can not find where it is.

Hello,

Can you show the query you are doing for your gauge panel?
With Influxdb V1 or V2?

Regards

1 Like

I guess it’s even InfluxDB V3. I’m using “InfluxDB Cloud Serverless”.

I’m not sure about your query question: Are you asking about a query in InfluxDB :thinking:?
In my mind Grafana accesses the complete InfluxDB database and the actual querying is done in Grafana?
There it is for example:
SELECT "temp_SOIL" FROM iox.ttn_vhs WHERE time >= $__timeFrom AND time <= $__timeTo

Now as you are asking it came to mind, that I needed to use “Code” to build the query, since for some values (actually the ones I have gauges for) the “Builder” didn’t work, since I need quotes around the column names. That’s not the case for other values in the same measurement. Not sure if that is relevant for my issue.

Hey,

I was asking for your query because if you want the latest value from your field you should just “ask” for it :sunglasses:!

SELECT last("temp_SOIL") FROM iox.ttn_vhs WHERE time >= $__timeFrom AND time <= $__timeTo

I can only recommend you to use the query mode instead of the editor mode, but I’m using influxdb V1 so command line is cool, I know that it’s quite the same with influxdb V2. But no, since you got data, I don’t think the quotes are the problem here.

Regards

1 Like

Thank you for your answer! Sounds logical to ask for the last value, but when I do it I receive an error message :thinking:.

Did I misunderstand something in your advice?

That was exactly my idea, but I’m not used to influxdb V3.
I checked the doc:

Try to put your last() function in uppercase, if it don’t works you should open a topic on influxdb community:

1 Like

OK, maybe I see the issue.
I selected SQL as query language (I think that is something new in InfluxDB v3), I assume that does not have the last()-function.
I looked it up, found the selector_last-function and though I do not fully understand the syntax it seems to work!

SELECT 
  selector_last("temp_SOIL", time)['time'] AS time,
  selector_last("temp_SOIL", time)['value'] AS temp
FROM iox.ttn_vhs WHERE time >= $__timeFrom AND time <= $__timeTo

One question remains:
If I keep the query

SELECT "temp_SOIL" FROM iox.ttn_vhs WHERE time >= $__timeFrom AND time <= $__timeTo 

and use in the gauge settings the “Calculation” Last* (or Last) - shouldn’t that do the trick, too?

Hey,

To be honest I don’t really understand the last * option with the gauge panel. If I turn it on nothing change on my value for my different dashboards.
gauge doc

Maybe a bug?


Anyway, I’m using this option on my time series panels for the legends, which returns indeed the last value.

I’ve never really used this option to display the data itself. Since my bases are quite big, I prefer to optimize the queries and then play with the panels options.

Regards