Hi, yesterday I created this post in Grafana community but I actually this is also a problem from InfluxDB.
My end goal is described in that link.
But I will rephrase this to influxdb question.
I have this query
SELECT sum("column") FROM table WHERE $timeFilter AND <some condition> GROUP BY time(1h)
(Or replace $timeFIlter
with time > (now()-6h)
)
So the problem is that, the first data point does not return sum of full hour.
I completely understand why this is the case because of the relative time query.
But given how Grafana alerts percent_diff
works, documented here, the first data point needs to contain the sum of full hour such that I can actually calculate the percentage diff.
Imagine if I do now() - 1h
and it’s now 13:58. The query return 2 data points,
12:00 | <sum of 12:58-12:59>
13:00 | <sum of 13:00-13:58>
Compare the percent diff of them makes no sense.
What I expect is
12:00 | <sum of 12:00-12:59>
13:00 | <sum of 13:00-13:58>
So what can I do to achieve my use case? Can I fix my influxdb query or change the Grafana alert configuration?