如果X%的请求失败,则Azure Web App Service会触发警报

编程入门 行业动态 更新时间:2024-10-22 13:29:39
本文介绍了如果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会触发警报

本文发布于:2023-11-27 03:51:29,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1636463.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:警报   Web   Azure   Service   App

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!