Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

prometheus filter range vector by day_of_week

I use sub-queries to get hourly aggregated values for the last week for example: The number of http requests per hour over the whole last week, which will return 168 values in a range vector.

delta(http_server_requests_seconds_count[1h])[1w:1h]

Now I want to filter the value to return only the ones which are for a specific week day, lets say return only the 24 value from Monday. I found some hints about day_of_week, timestamp, bool expr, but I cannot combine them to get it working or maybe it is not possible? Something like:

delta(http_server_requests_seconds_count[1h])[1w:1h] bool day_of_week() == 1
like image 920
radio Avatar asked Oct 15 '25 13:10

radio


1 Answers

It'd be more effficient to adjust your start/end time to only over the day, but you could do:

(increase(http_server_requests_seconds_count[1h]) and on () day_of_week() == 1)[1w:1h]
like image 72
brian-brazil Avatar answered Oct 18 '25 07:10

brian-brazil



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!