How to Fill Missing Values with Zero in Monitoring Query Language (MQL) for Google Cloud Monitoring?

271 Views Asked by At

I am using Monitoring Query Language (MQL) in Google Cloud Monitoring to fetch and analyze a single metric. The data is grouped into 30-minute intervals. However, I've noticed that sometimes there are intervals with no data, and MQL does not return those intervals in the results.

What I want to achieve is to include those missing intervals in the results, and to fill the missing values with 0.

Here's my MQL query:

fetch dataflow_job
| metric 'custom.googleapis.com/SLOs/AgencyCoverage'
| group_by 30m, [value_AgencyCoverage_mean: mean(value.AgencyCoverage)]
| every 30m
| group_by [resource.job_name],
    [value_AgencyCoverage_mean_mean: mean(value_AgencyCoverage_mean)]

Is there a way in MQL to fill those missing intervals with a value of 0? If not, what's the best way to process the result in client code to achieve this? Any help would be appreciated.

0

There are 0 best solutions below