我们正在考虑为非Web应用程序实现AppInsights。我们要监视的事情之一可能是“挂起”了N秒或几分钟以上的进程。我一直无法找到内置的功能。我所看到或想到的最接近的事情是,记录2个自定义事件的开始和结束过程,然后有一个自定义日志的警报,该警报在N分钟后查询没有匹配的“结束”事件的事件。
有没有其他方法可以使用我没有看到的AppInsights来监视挂起的进程?感谢您的帮助。
答案 0 :(得分:2)
如果您选择使用应用程序见解,则以下建议仅供参考(但是,如果您有其他更好的解决方案,则可以忽略此建议):
根据此post,您可以利用心跳功能,详细信息如下:
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.