Hello, my previous was not clear, sorry for that. I don't want count the number of sample (count_over_time) but I want to calculate the difference (delta) or the increase (increase) of the metric value during the range (15 minutes).
As the metric is a counter that only grows (it counts the number of request the service has handled), it should be the last value of the sample range minus the first one. here is a screenshot of the corresponding metric: [image: image.png] There must be some black magic around increase/delta that I do not understand that gets me unexpected results. Le jeu. 18 janv. 2024 à 19:14, Alexander Wilke <[email protected]> a écrit : > Maybe you are looking for > > count_over_time > > https://promlabs.com/promql-cheat-sheet/ > > Jérôme Loyet <[email protected]> schrieb am Do., 18. Jan. 2024, 18:56: > >> Hello, >> >> I have a counter and I want to counter the number of occurences on a >> duration (let's say 15m). I'm using delta() or increase but I'm not getting >> the result I'm expecting. >> >> value @t0: 30242494 >> value @t0+15m: 30609457 >> calculated diff: 366963 >> round(max_over_time(metric[15m])) - round(min_over_time(metric[15m])): >> 366963 >> round(delta(metric[15m])): 373183 >> round(increase(metric[15m])): 373183 >> >> increase and delta both return the same value but it appears to be wrong >> (+6220) while max_over_time - min_over_time return the expected value. >> >> I do not understand this behaviour. I must have miss something. >> >> Any help is appreciated, thx a lot. >> >> ++ Jerome >> >> -- >> 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/e9864120-b1c2-4af9-91ee-9c9cbe0fb24an%40googlegroups.com >> <https://groups.google.com/d/msgid/prometheus-users/e9864120-b1c2-4af9-91ee-9c9cbe0fb24an%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- 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/CAFK6my7cR0NFVVyq2Rubt6F4BRDwkzRTKUKCrGfxtknX40hzgQ%40mail.gmail.com.

