PromQL filter based on current date

41 views
Skip to first unread message

Dipesh J

unread,
Feb 9, 2024, 9:29:39 AM2/9/24
to Prometheus Users
Hi, 

Is there way to get metrics only for current date instead of using time like [24h] which would probably give metrics for day before too.

last 24 hours
my_metric{node="ABC"} [24h]

Something like below to give metrics for current date only.
my_metric{node="ABC"} [TODAYS_DATE]


Thanks

Brian Candler

unread,
Feb 12, 2024, 8:22:49 AM2/12/24
to Prometheus Users
The only ways I know are to use the Prometheus API and set the evaluation time, or to use the @ timestamp PromQL modifier. But in either case you have to work out the timestamp of the end of the 24 hours of interest, and insert it yourself.
Reply all
Reply to author
Forward
0 new messages