Best to use an example; this is only an example, I'm not looking for workarounds for this particular query!
I am recording the (accumulated) user CPU time (utime, field 14 in /proc/$PID/stat on Linux machines) in a metric I call iproc_utime, which has several dimensions. I can thus plot the total CPU utilization for all processes named "foo" with the query:
sum(rate(iproc_utime{cmd="foo"} [5m])))
So far so good. This works fine in the built-in Prometheus grapher, and in Grafana.
Now, I'm observing that the cpu utilization is sometimes climbing, and sometimes falling, so I want to compute its derivative. If I try
deriv(sum(rate(iproc_utime{cmd="foo"} [5m]))))
I get: Error executing query: parse error at char 52: expected type range vector in call to function "deriv", got instant vector
How do I compute the derivative? Why can't the derivative of an instant vector be computed?
Thanks,
/ji