Reputation: 431
How can I calculate the per-second instant rate of increase of the time series in Prometheus or Grafana without using rate() or irate()?
This drive function is not helping to achieve the same result as irate
irate(node_cpu_seconds_total[5m])
deriv(node_cpu_seconds_total_gauge[5m])
Actually I need to calculate the per-second instant rate of increase of the time series of Gauge metric data which is a modified counter metric type data.
Upvotes: 3
Views: 11987
Reputation: 17800
Prometheus doesn't provide irate()
equivalent for gauge time series :(
If you still need it, then try ideriv function from VictoriaMetrics. It returns the derivative based on two last samples for the time series:
ideriv(metric_name[5m])
Note that both irate()
and ideriv()
functions don't capture spikes, since they perform calculations based on a subset of raw samples, while ignoring the rest of samples. See this article for details. If you need capturing spikes, then take a look at rollup_deriv function. It reliably captures min
, max
and avg
derivative based on all the raw samples, which hit the given lookbehind window in square brackets.
Upvotes: 1