简体   繁体   English

如何确保基于堆栈驱动程序日志的指标获得 0 值而不是没有数据?

[英]how to make sure stackdriver log based metrics gets 0 value instead of no data?

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.事情是,在事件创建后,它永远不会解决,因为当没有错误时,指标图显示“无数据”而不仅仅是 0。

how can i update the alerts policy to show 0 instead of no data?如何更新警报策略以显示 0 而不是没有数据?

the same happens for metrics of containers.容器的指标也是如此。 when container dies the alerts does not resolved automatically (only after 7 days)当容器死亡时,警报不会自动解决(仅在 7 天后)

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 10倍

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"我已经通过更新警报策略以在聚合和条件上使用 sum(而不是计数器)来解决这个问题,“最近值”不是“一分钟后”

this causes the alerts to fire when there is a new error but also to resolve after a minute or so.这会导致在出现新错误时触发警报,但也会在一分钟左右后解决。

10x 10倍

There is no difference between “no data” and the value “0” . “无数据”和值“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.我已经检查了GCP ContainerKubernetes 指标的官方文档,但我找不到对这种情况有用的东西。

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.我发现本教程可以帮助您使用 Stackdriver 创建丢失监控数据的警报。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用Stackdriver进行重复通知 - How to make repeat notification with stackdriver 如何将其他信息获取到GCP Stackdriver警报消息中 - How to get additional information into GCP Stackdriver alert messages 我怎样才能确保字符串是否干净以插入javascript警报('错误消息') - How can I make sure a string is clean for insertion into javascript Alert('error message') 根据每20分钟写入一次的日志条目中的值进行警报 - Alerting based on value in log entry written every 20 minutes 从setInterval回调调用时,如何确保在弹出“警告”之前呈现HTML内容? - How do I make sure the HTML content is rendered before `alert` pops up when calling from a setInterval callback? 如何确定文本框中的字符仅是1,而二进制是0? - How can I make sure that whaveter is in the text box is only 1's and 0's for binary? 如何比较日期以确保Google Apps脚本每天仅发送一次警报? - How to compare dates to make sure Google Apps Script is only sending an alert once a day? 如何根据失败百分比在日志字段中创建警报? - How to create an alert the log fields based on the percentage of failures? 在 SwiftUI 中推送一个空查询后,如何使警报而不是永恒的 ProgressView 出现? - How to make alert instead of eternal ProgressView appear after pushing an empty query in SwiftUI? 如何使用 Prometheus 警报规则检测新指标 - How to detect a new metrics with Prometheus alerting rule
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM