How do I configure the terraform module "googleloggingmetric" to show missing data as…
- User
How do I configure the terraform module "google_logging_metric" to show missing data as zero? I have the following filter in it: "resource.type="k8s_container" resource.labels.project_id="project-id-prd" resource.labels.location="us-central1" resource.labels.namespace_name="namespace-x" labels.k8s-pod/app="svc" severity>=ERROR"
But when I use it for alerting, the alert never resolves because it doesn't see the threshold going to zero due to missing error logs.
- Assistant
To show missing data as zero in the google_logging_metric Terraform module, you'll want to add a default value in your Aggregation and Comparison methods. The aggregation yields no data if the sample_count of matching records is zero. So, configuring the aggregation method to include a default value when there is no data will help in such scenarios.
Here's an example:
code