在Stackdriver中的错误报告中创建警报策略

问题描述 投票:0回答:1

当有30个连接超时异常时,我需要创建一个警报策略。当Web服务调用期间出现连接超时时,我们当前正在抛出异常(使用宁静的web服务)所以我想在有30个连接超时时收到警报例外。有什么方法可以在Stakdriver中创建这样的策略。我们目前正在使用java8,spring boot,google kubernetes引擎,stackdriver日志记录。我创建了名为SAX-Exception的度量标准当我尝试为此度量标准创建stackdriver警报策略时,我没有看到任何选项来聚合一段时间内的异常数量。

                         This below image shows how the metrics is defined

enter image description here

下图显示了如何定义警报政策enter image description here enter image description here enter image description here enter image description here

google-cloud-platform stackdriver google-cloud-stackdriver google-cloud-error-reporting
1个回答
1
投票

对于这个答案,我将假设您的连接错误被记录到Stackdriver Logging,其中包含足够的详细信息,可以通过Stackdriver进行解析。

如果您想使用Stackdriver Alerting,那么抛出异常的软件需要使用Stackdriver Logging记录。几乎任何语言(包括Java)都可以轻松添加Stackdriver日志代码。

Stackdriver Logging Client Libraries (Java)

假设您有Stackdriver Logging日志,其中包含所需的事件详细信息:

  • 转到Stackdriver日志。
  • 根据日志条目中的内容,根据所需的错误创建指标。

文档:link

创建度量标准后,您可以根据此度量标准创建警报。您可以根据每个时间段的事件数进行汇总。在你的情况下,一分钟内30个事件(或任何你需要作为你的失败指标)。

文档:link

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.