Count over period of time

530 views
Skip to first unread message

sunils...@gmail.com

unread,
Apr 15, 2021, 9:01:47 AM4/15/21
to Prometheus Users
Hi Folks , 

I got stuck into issue related to count over period of time . 

Currently I am getting count of metrics with below promql . I want to know the count increased over 1 day period

promql : count(metrics)

How I can find increase in last 24 hours 

Thanks 

Julien Pivotto

unread,
Apr 18, 2021, 8:04:48 PM4/18/21
to sunils...@gmail.com, Prometheus Users
What do you mean by increase?

increase(metrics[24h]) should do the trick.

>
> Thanks
>
> --
> 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 prometheus-use...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/41d77f8d-cfcd-4106-8cc2-de7413dd3a2bn%40googlegroups.com.


--
Julien Pivotto
@roidelapluie

Aliaksandr Valialkin

unread,
Apr 19, 2021, 6:18:05 AM4/19/21
to sunils...@gmail.com, Prometheus Users
Try the following query:

count(metrics) - count(metrics offset 24h)

It should return the delta in the number of time series with the name `metrics` between now and 24 hours ago.

It would be great if you could share mode details on the use case for this query, since the requirements look slightly non-standard.

--
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 prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/41d77f8d-cfcd-4106-8cc2-de7413dd3a2bn%40googlegroups.com.


--
Best Regards,

Aliaksandr Valialkin, CTO VictoriaMetrics

Sagar

unread,
Apr 19, 2021, 12:05:38 PM4/19/21
to Aliaksandr Valialkin, Prometheus Users
Thank you all, for some reason it was not working , and was showing 0 . but now it is working . Thanks .
Reply all
Reply to author
Forward
0 new messages