But there is a problem. If no alert is active (“firing”), prometheus returns no data. Not 0, indeed no data. This causes my single stat panel to show the most recent value, instead of 0. Can I somehow “map” no data to 0?
I mapped null -> 0 but this doesn’t work.
Yep my query returns no data points, but only in the case there are no alerts. I’m not a Prometheus expert, but alerts behave a little different than other time series. So I can use count() on alerts, but only if they currently exist.