You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Prometheus Users
Hi ,
I have metrics for http request count . I want to display the number of success counts by each day .
http_request{probe="success"} 3500
I want to find the http_request sum grouped by day . eg.
Oct 27 : 300
Oct 26 : 350
Oct 25 : 325
Oct 24 : 375 .. etc
Is it possible to group this way on day basis using promql .
Thanks ,
Bjoern Rabenstein
unread,
Nov 3, 2020, 5:21:05 PM11/3/20
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sunils...@gmail.com, Prometheus Users
The PromQL query for "how many HTTP requests over the last day" would
look like this:
increase(http_request{probe="success"}[1d])
However, that's not for the last calendar day, but just for the last
24 hours back from the evaluation time.
The Prometheus UI (or similar things in Grafana etc.) allow you to set
the evaluation time to midnight of a specific day. Then you get your
result for the calendar day preceding that timestamp.
From within PromQL, you cannot (yet) set a fixed evaluation time. But
you could craft a call to the Prometheus HTTP API and use it with
`curl`. The `query_range` endpoint will allow you to get those
values. See
https://prometheus.io/docs/prometheus/latest/querying/api/#range-queries in the docs.
In your case, you'll probably end up with something like: