Re: [prometheus-developers] Delta usage issues?

19 views
Skip to first unread message

Bjoern Rabenstein

unread,
Oct 14, 2020, 10:29:35 AM10/14/20
to linux...@gmail.com, Prometheus Developers
On 13.10.20 01:22, linux...@gmail.com wrote:
> I want to get the difference between the current time and the past 5 minutes,
> but I tried two methods and couldn’t get it
>
> 1. delta(isphone{name="qq",exname!~"test|test1"}[5m])
>
> 2. sum_over_time(isphone{name="qq",exname!~"test|test1"}[5m]) - sum_over_time
> (isphone{name="qq",exname!~"test|test1"}[5m])offset 5m )
>
> If I execute sum_over_time(isphone{name="qq",exname!~"test|test1"}[5m])
> directly, the data can be displayed normally, but I can’t get the difference
> between now and five minutes ago. Can anyone have a way? ?

I'd say the `offset` has to modify the selector directly:

sum_over_time(isphone{name="qq",exname!~"test|test1"}[5m])
-
sum_over_time(isphone{name="qq",exname!~"test|test1"}[5m] offset 5m)

In different news, this question is more a fit for the
prometheus-users mailing list:
https://groups.google.com/forum/#!forum/prometheus-users

--
Björn Rabenstein
[PGP-ID] 0x851C3DA17D748D03
[email] bjo...@rabenste.in
Reply all
Reply to author
Forward
0 new messages