如何使用Asp.Net-Core HealthChecks设置应用程序见解

时间:2019-01-17 16:24:46

标签: azure-application-insights asp.net-core-2.2

Asp.Net Core发布了2.2版,并附带了HealthChecks功能。 (Read more)。它具有的功能之一是将运行状况检查结果推送到Azure Application Insights。但是我还没有找到如何在Azure门户中看到这些结果的方法。要发送结果,我正在使用以下扩展名:

requests

是否可以在Application Insights中查看那些运行状况检查报告?

编辑1:我以官方github docs为例。

编辑2:如果我转到Azure门户查询分析,则会看到以下结果:

查询customEvents

enter image description here

查询GET /health

enter image description here

此处:requests是我的healthCheck端点。通过查询AddApplicationInsightsPublisher()日志,我可以查看运行状况检查是否失败,但是我想查看有关每个运行状况检查的更多详细信息,而且我认为我不需要任何扩展名,因此我不了解什么dev_id in dev_exist实际上可以。

2 个答案:

答案 0 :(得分:1)

使用TravkEvent api将运行状况事件作为自定义事件发送到Application Insights。您可以在Google Analytics(分析)或门户的“搜索”中看到它们。

答案 1 :(得分:1)

发布者(HealthCheckPublisherHostedService)的注册目前存在问题,该问题将在aspnet core 3中得到解决。 当前,解决方法是手动正确注册该类:

for attr in measurement_attributes:
    self.label_qLineEdits[attr] = QtWidgets.QLineEdit()
    self.label_qLineEdits[attr].editingFinished.connect(lambda: self.callback_lineEdit_attribute())

请参阅:https://github.com/aspnet/Extensions/issues/639