【问题标题】:Application Insights does not log successful requestsApplication Insights 不记录成功的请求
【发布时间】:2018-06-20 17:42:43
【问题描述】:

我已将 Azure Application Insights 添加到我的许多 .Net WebAPI 应用程序中。我注意到我没有收到来自这些应用程序的成功请求遥测。我确实收到了依赖遥测和失败的请求,但没有收到请求的实际遥测。通过伪造 URL 或请求并强制失败,我可以看到它被发送到 AI,所以我的问题绝对不在于检测密钥。

我按如下方式初始化检测密钥:

Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration.Active.InstrumentationKey =
                ConfigurationManager.AppSettings["ApplicationInsightsKey"];

我已尝试从应用程序中完全删除 AI,并使用“配置 Application Insights”选项再次添加它,但它仍然无法正常工作。我的另一个 Web 应用程序使用了不久前配置的 AI,它运行良好,我已经用工作应用程序的设置替换了损坏的应用程序的设置,并且还使包版本对齐,但我仍然只得到遥测失败的请求。下面从 Live Stream 捕获的内容显示了这一点,红色箭头指向为成功请求进行的依赖调用,但在请求速率图中没有显示任何内容。相反,在它之前有一个失败,并且被记录下来。

【问题讨论】:

    标签: azure azure-application-insights


    【解决方案1】:

    试试下面的一个,它对我有用:

    Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration configuration = Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration.CreateDefault();
    
    configuration.InstrumentationKey = System.Web.Configuration.WebConfigurationManager.AppSettings["InstrumentationKey"];
    

    【讨论】:

      【解决方案2】:

      我刚刚在 Application Insights Github 上的一个已解决问题中找到了答案。解决方案是打开 ApplicationInsights.config 并滚动到遥测模块 Microsoft.ApplicationInsights.Web.RequestTrackingTelemetryModule 注释掉 System.Web.Handlers.TransferRequestHandler 行

      此问题已得到修复,并将在 2.5 版本的软件包中消失。你可以在这里阅读问题https://github.com/Microsoft/ApplicationInsights-dotnet-server/issues/175

      【讨论】:

        猜你喜欢
        • 2021-02-06
        • 2017-12-26
        • 2016-05-18
        • 1970-01-01
        • 2018-08-09
        • 2017-10-01
        • 1970-01-01
        • 2015-09-15
        • 2021-04-05
        相关资源
        最近更新 更多