Rounding of time range in InfluxDB query

I have a process that stores the current value in InfluxDB with 1-minute intervals (not full-minute aligned). This means I need to time-shift 1 minute when I want a gauge with current value (otherwise it will on average not find any data half of the time).
I defined the data source in Grafana as 1m min time interval, and expected the time range in the query to be rounded as well. But it seems the query is doing ms resolution based on the time the panel is refreshed. When that computed now-1m is somewhere in the middle of a minute, InfluxDB will return yet another row with likely no data. I’ve used the “last (not null)” to deal with missing data, but that means that when the system is down I still see the last known value (which is misleading). Suggestions?

1 Like