Show increase in Gauge label values over time

Viewed 375

I have a gauge in Prometheus which has a single label "zipcode", in order to track access to the application from various zipcodes. I use the following query to track the total number of series for this metric:

count(count by (zipcode) (users_active_zipcode))

This works fine but I would like to also track the number of zipcodes "active" in the current range. In other words, zipcodes that were at least 1 in the range. Tried some variations of the following without success:

count(count_over_time(users_active_zipcode[$__range]) > 0)

Any suggestions?

1 Answers

Try the following query:

count(max_over_time(users_active_zipcode[$__range]) != 0)
Related