Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prometheus - get delta between two last consecutive values

Tags:

prometheus

I have a gauge metrics that, for instance, gives me a result like this when querying panels_meters[30s] gives me this result:

query result and a query like this delta(panels_meters[30s]) gives me the differenze between the last value and the value at 30 seconds ago.

BUT I want now the difference between the last two values, independently from the specified time. I just want something like panels_meters[0] - panels_meters[1] assuming panels_meters as an array of data sorted chronologically inverse.

like image 427
David Avatar asked Feb 08 '18 11:02

David


1 Answers

The idelta function is what you want.

like image 81
brian-brazil Avatar answered Oct 23 '22 04:10

brian-brazil