关于自定义指标应用见解

发布于 2025-01-12 09:54:03 字数 216 浏览 0 评论 0原文

我有一个场景,我通过应用程序获取自定义指标。我想根据阈值和一周中的几天创建警报。有什么方法可以将元数据集成到某些存储中并基于此比较指标?例如,我的应用程序中有消息计数指标,如果周一消息计数少于 100 条或超过 200 条,我应该收到警报。它随星期几而变化。我必须监控近 250 个自定义指标。

我尝试在日志分析中实现自定义日志,但我遇到了一个挑战,如果我想更改阈值,那么我需要删除自定义表并重新创建它。

I have a scenario where I'm getting custom metrics thru an application. I want to create alerts based on thresholds and days of the week. Is there any way I can integrate the metadata in some storage and compare the metrics based on that? For example, I have message count metrics in the application, and if on Monday the message count is less than 100 or more than 200 I should get an alert. It varies on the day of the week. I have to monitor almost 250 custom metrics.

I tried implementing custom logs in Log analytics but I have a challenge in case if I want to change the thresholds then I need to drop the custom table and recreate it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

つ低調成傷 2025-01-19 09:54:03

谢谢 AnuragSingh-MSFT |微软文档。将您的建议作为答案发布以帮助其他社区成员。

结合使用两者dayofweek ()case() 函数,结果查询本身可以包含基于星期几的阈值。因此,将来如果阈值发生变化,您只需编辑 case 语句,并且此解决方案也不需要额外的存储/自定义表。

let day = dayofweek(now());
let threshold = case(day == 1d, 5m,  //threshold for Monday is 5 minutes
day == 2d, 2m, //threshold for Tuesday is 2 minutes
day == 3d, 5s, //threshold for Wednesday is 5 seconds
10m); //threshold for any other day is 10 minutes.

Heartbeat
| summarize LastHeartbeat=max(TimeGenerated) by Computer
| where LastHeartbeat < ago(threshold)  

参考:关于自定义指标应用程序见解 - Microsoft 问答

Thank you AnuragSingh-MSFT | Microsoft Docs. Posting your suggestion as an answer to help other community members.

Using a combination of both dayofweek() and case() functions, the resultant query itself can contain the threshold based on the day-of-week. Therefore, in future if the threshold changes, you will only have to edit the case statement and this solution also does not require additional storage/custom table.

let day = dayofweek(now());
let threshold = case(day == 1d, 5m,  //threshold for Monday is 5 minutes
day == 2d, 2m, //threshold for Tuesday is 2 minutes
day == 3d, 5s, //threshold for Wednesday is 5 seconds
10m); //threshold for any other day is 10 minutes.

Heartbeat
| summarize LastHeartbeat=max(TimeGenerated) by Computer
| where LastHeartbeat < ago(threshold)  

Reference: Regarding custom metrics application insights - Microsoft Q&A

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文