(Blank image, indeed! )

I see. I have tried playing around with rate and increase some more. For a 
simple detection, I could make the app alert if the rate of Parcel is > 0, 
and I do get Grafana Alerts for that. Thank you very much.

But one more thing though, rate and increase give me the per-second 
increase and "units per x mins" which are decimal values < 1. Is it 
possible to make it so we know the exact changed value for each scraped 
point? For example, suppose I have data coming in like this every 5 seconds:

[ 10, 20, 10, 23, 12 ,5 , 1050, 1200, 1100, 1050, 1030, 20] . 

Is it possible to ask Prometheus to turn this above into this below exactly?

[ 0, 10, -10, 13, -11, -7, 1045, 150, -100, -50, -20, -1010 ]

This is so that I could do an alert if the incoming new scraped value is 
increased by x amount exactly. 
On Tuesday, October 27, 2020 at 10:39:53 PM UTC+7 [email protected] wrote:

> (You posted a blank image!)
>
> idelta(metric[period]) only gives the difference between the *last two 
> points* in a range.  Suppose the time period covered has the values (0, 
> 0, 1, 1).  The last two values are (1, 1) and idelta will give zero.
>
> You say you're scraping data at 5 second intervals, and you're doing 
> idelta(parcel[20s]).  That looks at the last two points in a 20 second range
>
> Whether or not you see any blip on your graph depends on the graph 
> resolution.  Say you zoom out in your graphing frontend, such that the X 
> axis only shows one point every 10 seconds.  It's quite possible you'll 
> skip over the increase. It might see:
>
> (0, 0, 0, 0)   at time 0
> (0, 0, 1, 1)   at time 10 seconds
> (1, 1, 1, 1)   at time 20 seconds
>
> and hence the idelta value for all three points will be zero.  You should 
> use delta not idelta, with a time window big enough to cover at least two 
> data points.
>
> Note: since this is a counter, you should be using "increase", "irate" or 
> "rate", not "(i)delta"
>
> - "rate" calculates the per-second increase, between the *first and last 
> data points* in the time window (but skipping ranges where the counter 
> resets, i.e. goes down).  This is the normal one to use.
> - "irate" gives the rate between the *last two data points* in the time 
> window.  It suffers from the same problem you saw with idelta.
> - "increase" is "rate" multiplied by the time window - instead of "units 
> per second" you get "units per 5 minutes" or whatever
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/cc0cccca-f001-42d5-acb7-7bd743288915n%40googlegroups.com.

Reply via email to