Grafana Open Source Version
I have some gauges that display information from Prometheus. Very simple, the name of an development environment and a 1, 2 or 3 to denote criticality. Some value mappings in place convert the following:
1= OK
2=Warning
3=Critical
I’m effectively using this a bit like a status panel. This all works fine.
I have a promql query that utilises [$__range] so that the time_range selector displays the relevant information for the time selected. For the query options, I’m using Type=Instant.
This all works fine. However, what I want to be able to do is set the time ensure the only items displayed are the ones from that time, and what I’m currently getting is the old entries (good), but also the current/now entries (bad).
Effectively, if environment “deva” was in a state of Warning 2 days ago but now it’s Critical, if I set the time adjust to go back “Last 2 days”, I don’t want it to display the current Critical state as well as the Warning state from the past, I just want it to display how it looked 2 days ago (Warning). However, what I’m getting is all the data, both historic and current.
I’ve tried utilising time() and last_over_time() but I can’t seem to only get it to show me the data for that time. I know I can get this to work with an absolute time range, but as this is for other people to use, I just want the date time_range selector to be absolute.
Is there a promql query I can use to facilitate this type of function?
What I have with “5 mins”
What I have with “2 days”
I only want “deva” to show “Warning” as that’s what it was 2 days ago. I don’t want it to show historic and current.
I hope I’ve explained that well. Does anyone have any ideas?
Thanks