Using grafana with influxdb, I am trying to show the per-second rate of some value that is a counter. If I use the non_negative_derivative(1s)
function, the value
The problem here is that the $__interval
width changes depending on the time frame you are viewing in Grafana.
The way then to get consistent results is to take a sample from each interval (mean()
, median()
, or max()
all work equally well) and then transform by derivative($__interval)
. That way your derivative changes to match your interval length as you zoom in/out.
So, your query might look like:
SELECT derivative(mean("mem.gc.count"), $__interval) FROM "influxdb"
WHERE $timeFilter GROUP BY time($__interval) fill(null)