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 configure the
google_logging_metricTerraform module to show missing data as zero, you can create a metric with anaggregation.alignmentPeriodandaggregation.perSeriesAlignerto calculate the error rate per time period. By settingaggregation.perSeriesAlignertoALIGN_DELTA, you can calculate the difference between consecutive error logs. If there are no error logs, the calculated difference will be zero.Here's an example of how to create such a metric:
hcl - User
How can I use the module google_monitoring_alert_policy to resolve alert when the value is zero or there is no data?
- Assistant
To configure the
google_monitoring_alert_policymodule to resolve the alert when the value is zero or there is no data, you can create a condition with a threshold that triggers the alert when the value is greater than zero. Additionally, you can use thesettingsconfiguration to setno_data_timeframeto mark the alert as resolved when there's no data for a specific period of time.Here's an example of how to set up the alert policy:
hcl