【问题标题】:EventSourceException while processing event "LogVerbose"处理事件“LogVerbose”时的 EventSourceException
【发布时间】:2019-01-24 11:20:00
【问题描述】:

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

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

详情:

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

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

sdkVersion: dotnet:2.8.1-22898

【问题讨论】:

标签: azure azure-functions azure-application-insights


【解决方案1】:

https://github.com/Microsoft/ApplicationInsights-dotnet/issues/973

推荐的解决方法是使用 2.7.2 的 Application Insights 依赖项。

目前,选项是:

  1. 使用与 Functions 使用的相同版本的 AppInsihgts(或更低版本)
  2. 过滤掉内部 SDK 消息。您可以通过创建和配置遥测处理器来做到这一点。您可以有一个过滤器来检查遥测是否为 TraceTelemetry 和 traceTelemetry.Context.Operation.SyntheticSource 是否为 SDKTelemetry
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.7.2" />

否则,除了等待并希望 2.9 版包含此问题的错误修复外,几乎什么都没有。

【讨论】:

    【解决方案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 supported features

    总结:

    根据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/stable 版本的 V2。

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

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

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

    【讨论】:

    • 有趣的是,它不仅是一种解决方法,而且是唯一受支持的版本。如果您认为我的回答有帮助,我将不胜感激被接受和/或获得赏金。否则赏金将丢失,除非我的回答被接受或获得更多支持。
    猜你喜欢
    • 2017-12-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多