I am attempting to write a query to find instances where the value has been the same for a set amount of time. This type of query is for the most part just useful for "metadata" metrics which report a value of 0 or 1.
In my instance I am interested if a metric has had the value 1 for a period of 20 minutes. My approach was to get the min value over time, as if the time series had a single 0 value within the 20 minute window it would report as a 0.
min_over_time(meta_metric[20m]) > 0
This works well for the most parts with the exception of instances where a new time series is created. In those cases if the time series starts with the value 1 it would result as if the time series has had the value 1 for the full 20 minutes as all other values in the window is null.
Is there any method of defaulting null values to 0 or ignoring windows where values are missing?