How to sum a metric that has 0 value over a month

I have a metric which has 0 or 1 value. How can i count how many returned 0 vs non zero over a month?
sum_over_time({metric{job=“a”}[30d]=0) doesn’t work. what is the correct syntax?


You don’t need the =0 bit.

If you do a sum it will tell you the number of times it was 1, and if you do a count it will give you the total (so you can subtract to get the number of 0s).

1 Like