首页 > 解决方案 > AppInsights - 监控挂起的进程

问题描述

我们正在考虑为我们的非 Web 应用程序实施 AppInsights。我们要监视的一件事是可能“挂起”超过 N 秒或分钟的进程。我一直无法找到内置的东西来做到这一点。我见过或想到的最接近的事情是为进程的开始和结束记录 2 个自定义事件,然后对自定义日志发出警报,该日志在 N 分钟后查询没有匹配的“结束”事件的事件。

是否有另一种方法可以使用我没有看到的 AppInsights 监控挂起的进程?谢谢你的帮助。

标签: azureazure-application-insights

解决方案


如果您选择使用应用洞察,这里的建议仅供您参考(但如果您有其他更好的解决方案,您可以忽略此):

根据这篇文章,您可以利用心跳功能,详细信息如下:

    if this application runs more than several seconds, you can leverage heartbeat 
feature - it sends metric every N minutes/seconds (configurable) and the absence of such
 metric will indicate that application is no longer actively running. However, if 
Application Insights thread survives, then heartbeat will still be reported.    

    You can rely on presense/absense of the telemetry from this app in general as well as 
couple custom events as you outlined above - Azure Monitor allows to set an alert on 
analytics query, so you'll be able to craft a query that returns nothing in case of 
application issues and set an alert on 0 count returned by such a query.

推荐阅读