处理事件“LogVerbose”时出现 EventSourceException

Rah*_*odi 5 azure azure-application-insights azure-functions

在使用 EventHubTrigger Azurefunction 时,在 ApplicationInsights 的遥测跟踪中收到了这样一个丑陋的异常(如下所示)。

AI(内部):[Microsoft-ApplicationInsights-Core] 处理事件“LogVerbose”时的 EventSourceException:System.NullReferenceException:未将对象引用设置为对象的实例。

细节 :

时间戳 [UTC] : 2019-01-24T04:10:02.5700507Z

消息:AI(内部):[Microsoft-ApplicationInsights-Core] 处理事件“LogVerbose”时的 EventSourceException:System.NullReferenceException:未将对象引用设置为对象的实例。

sdk 版本:dotnet:2.8.1-22898

Rah*_*odi 2

正如我在有关开放 GitHub 问题的评论中提到的链接:https://github.com/Microsoft/ApplicationInsights-dotnet/issues/1029

@Alex AIT 分享了一个链接,这是一个与同一问题相关的开放问题: https://github.com/Microsoft/ApplicationInsights-dotnet/issues/973

但是,我参考 Microsoft Docs 找到了具体答案Application Insights for Azure Functions 支持的功能

总之:

根据Microsoft Docs on Supported feature on azure function V2 with Application Insight 的参考,如果要使用 Application Insight,请设置 Application Insights 版本 2.7.2,而不是 2.8.0 和 2.8.1。某些问题是由 Application Insights 版本造成的:2.8.0 和 2.8.1。因此,我们应该使用 Application Insight 版本 2.7.2,直到新更新不是来自 Microsoft/V2 稳定版本。

Application Insights 2.8.1 面临的其他异常,例如

  • AI(内部):错误:EventSource Microsoft-ApplicationInsights-Core 的命令处理中出现异常:Guid 为 74af9f20-af6a-5582-9382-f21f674fb271 的 EventSource 实例已存在
  • AI(内部):处理事件“DiagnosticsEventThrotdlingHasBeenResetForTheEvent”时出现 EventSourceException:System.NullReferenceException:未将对象引用设置为对象的实例。

现在,通过将 Application Insights 版本降级为 2.7.2 来解决,该版本实际上支持 Azure function V2。