inconsistency in prometheus rate/increase/deriv/delta calculation

51 views
Skip to first unread message

Puneet Singh

unread,
Apr 6, 2024, 10:22:53 AM4/6/24
to Prometheus Users
Hi ,
While reviewing Prometheus-related content online, I've come to understand that the rate is calculated as (v2 - v1) / (t2 - t1), and the increase is simply (v2 - v1). Now, considering i have 12 data points (of Gauge type) with a scrape interval of 1 minute, if i apply the rate(metric[2m]) / increase(metric[2m]) or deriv/delta functions, i notice some discrepancies in the results. Example - 
p1=10 @2024-04-06 13:33:48.666000
p2=10 @2024-04-06 13:34:48.666000
p3=10 @2024-04-06 13:35:48.666000
p4=10 @2024-04-06 13:36:48.666000
p5=20 @2024-04-06 13:37:48.666000
p6=20 @2024-04-06 13:38:48.666000
p7=20 @2024-04-06 13:39:48.666000
p8=20 @2024-04-06 13:40:48.666000
p9=30 @2024-04-06 13:41:48.666000
p10=30 @2024-04-06 13:42:48.666000
p11=30 @2024-04-06 13:43:48.666000
p12=30 @2024-04-06 13:44:48.666000
....

in that case if i use rate(metric[2m]), and increase(metric[2m]) here:
p1: rate = NA,     increase=NA  ( not enough data points)    13:33:48.666000
p2: rate=  0    (10-10)/120    , increase = 0 (10-10)    13:34:48.666000   -   13:32:48.666000
p3:  rate=  0 (10-10)/120    , increase = 0 (10-10)   13:35:48.666000  -  13:33:48.666000 
p4:  rate=  0   (10-10)/120    , increase = 0 (10-10)   13:36:48.666000  -  13:34:48.666000
p5: rate=0.0833 (20-10)/120 , increase=0 (20-10)  13:37:48.666000  -  13:35:48.666000 
p6:  rate=0.0833 (20-10)/120 , increase=0 (20-20)  13:38:48.666000 -  13:36:48.666000
p7:  rate=0 (20-20)/120 , increase=0 (20-20)  13:39:48.666000 - 13:37:48.666000
p8:  rate=0 (20-20)/120 , increase=0 (20-20)  13:40:48.666000 - 13:38:48.666000
p9:  rate=0.0833 (30-20)/120 , increase=10 (30-20)  13:41:48.666000 - 13:39:48.666000
p10:  rate=0.0833 (30-20)/120 , increase=10 (30-20)  13:42:48.666000 - 13:40:48.666000
p11:  rate=0 (30-30)/120 , increase=0 (30-30)  12:43:48.666000  -  12:41:48.666000
p12:  rate=0 (30-30)/120 , increase=0 (30-30)  12:44:48.666000  -  12:42:48.666000

But when i tried visualizing the data through the prometheus ,
increase.png
For instance, for point p5, i expected a rate of 0.0833 and an increase of 10, but Prometheus displayed 0.16 and 20 respectively. Could you please share some insights onto this observation?

Regards,
P

Puneet Singh

unread,
Apr 6, 2024, 10:24:31 AM4/6/24
to Prometheus Users
reattaching the image herewith.
increase.png
Reply all
Reply to author
Forward
Message has been deleted
0 new messages