Paweł Adamski
Paweł Adamski

Reputation: 3415

Grafana and InfluxDB Show latest value on null

I'm learning how to use Graphana with InfluxDB. I've prepared a simple example that displays a graph with the number of letter occurrences across time. I use simple InfluxDB measurement with one tag letter and one field count. To display data I use the query:

SELECT mean("count") 
FROM "lettersCount" 
WHERE ("letter" =~ /^$letter$/) AND $timeFilter 
GROUP BY time($interval), "letter"

E.g. example graph But as you might see in my example some of the series are a bit shorter (letter 'p' on my example) because there was no occurrence of that letter at that moment. I'm looking for a way to display previous value if there was no measurement.

Upvotes: 1

Views: 2758

Answers (1)

Jan Garaj
Jan Garaj

Reputation: 28626

You can use InfluxDB fill() option:

SELECT mean("count") 
FROM "lettersCount" 
WHERE ("letter" =~ /^$letter$/) AND $timeFilter 
GROUP BY time($interval), "letter" fill(previous)

Upvotes: 5

Related Questions