Count the number of outage intervals, without counting empty data gaps

Hello everyone,

I’m having some trouble to calculate the number intervals where probe_success == 0.
I tried (count_over_time(probe_success[$__range]) - sum_over_time(probe_success[$__range])) but it just gives the number points that are equal to 0.
I also tried using resets it doesn’t count the first occurence when the value starts at 0 and also when there is a data gap it interpretes it as 0.

Can someone help me with this please ?