2
votes

i'm using log based metrics on few alert policies that triggers an alert when specific errors are shown on our logs.

the things is, after an incident created it never resolved as when there are no errors the metric graph shows "no data" and not just 0.

how can i update the alerts policy to show 0 instead of no data?

the same happens for metrics of containers. when container dies the alerts does not resolved automatically (only after 7 days)

fetch k8s_container
| metric 'logging.googleapis.com/user/errors'
| group_by 1m, [row_count: row_count()]
| every 1m
| group_by [], [row_count_aggregate: aggregate(row_count)]

10x

2

2 Answers

1
votes

i've solved this by updating the alert policy to use sum (instead of counter) on both aggregation and the condition with "most recent value" isntead of "after a minute"

this causes the alerts to fire when there is a new error but also to resolve after a minute or so.

10x

0
votes

There is no difference between “no data” and the value “0” . At the end they mean that there is nothing. Also, it seems that there is no way to change this default configuration.

I have checked the official documentation for GCP Container and Kubernetes metrics and I wasn’t able to find something useful for this case.

But you can create an alert to monitor this behavior.

I have found this tutorial that can help you to create alerts for missing monitoring data with Stackdriver.