azure - 如果 X% 的请求失败,Azure Web App Service 会触发警报
问题描述
如果 X% 的请求在过去 24 小时内失败,我一直在尝试设置托管在 Azure 中的 .NET Core App Service 的警报以触发事件。我还尝试使用以下指标从服务的 AppInsights 资源设置警报:异常率、服务器异常或失败请求。
但是,这些都没有能力捕获 a % (failure rate)
,它们都被count
用作度量。
有谁知道这个的解决方法?
解决方案
请尝试基于查询的警报:
1.转到应用程序洞察分析,在查询编辑器中,输入以下脚本:
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.然后点击右上角的“新建警报规则”:
3.在创建规则页面,设置如下:
推荐阅读
- java - 模型类在第二次使用时未将特定字符串传递给 ListViewAdapter
- javascript - 带有json数组的数据表
- sql - 一天中的持续时间 SQL
- sqlite - 哪个更适合添加视频?Firebase 或 Sqlite
- css - 从 wordpress 库中删除左边距
- python - 将时间增量列表添加到日期时间对象列表中?
- python - 使用 bs4 从 href 中提取部分文本
- karate - Karate Server feature file cannot access variables in karate-config.js file
- javascript - js函数与对象的比较
- c++ - std::out_of_range exception in string compare