如果X%的请求失败,则Azure Web App Service会触发警报 [英] Azure Web App Service trigger alert if X% of the requests fail

查看:64
本文介绍了如果X%的请求失败,则Azure Web App Service会触发警报的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图设置Azure中托管的.NET Core App Service的警报,以在过去24小时内X%的请求失败时触发事件.我还尝试使用以下指标从服务的AppInsights资源中设置警报:异常率,服务器异常或请求失败.

I have been trying to set up alerts of a .NET Core App Service hosted in Azure to fire an event if X% of the requests are failing in the past 24 hours. I have also tried setting up an alert from the Service's AppInsights resource using the following metrics: Exception rate, Server exceptions, or Failed request.

但是,它们都不具有捕获% (failure rate)的能力,它们都使用count作为度量标准.

However, none of these have the ability to capture a % (failure rate), all of them are using count as a metric.

有人知道解决方法吗?

Does anyone know a workaround for this?

推荐答案

请尝试基于查询的警报:

Please try the query-based alert:

1.转到应用程序见解分析,在查询编辑器中,输入以下脚本:

1.Go to application insights analytics, in the query editor, input below scripts:

exceptions
| where timestamp >ago(24h)
| summarize exceptionsCount = sum(itemCount) | extend t = ""| join
(requests 
| where timestamp >ago(24h)
| summarize requestsCount = sum(itemCount) | extend t = "") on t
| project isFail = 1.0 * exceptionsCount / requestsCount > 0.5 // if fail rate is greater than 50%, fail
| project rr = iff(isFail, "Fail", "Pass")
| where rr == "Fail"

2.然后单击右上角的新警报规则":

2.Then click the "New alert rule" on the upper right corner:

3.在创建规则"页面中,设置如下:

3.In the Create rule page, set as following:

这篇关于如果X%的请求失败,则Azure Web App Service会触发警报的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆