Application Insights 是否依赖于 Azure SDK?

Does Application Insights depend on the Azure SDK?

自从添加 IntelliTrace 后,我注意到在 Azure IaaS VM 上运行时寻找 Microsoft.WindowsAzure.ServiceRunTime.dll 的许多应用程序洞察异常。

//旁注

值得注意的是,这些异常似乎并未在应用程序洞察门户中报告,除了有时我注意到某些图表中有大量异常但无法找到异常详细信息(直到使用 IntelliTrace)......但那可能是一条红鲱鱼,因为它们可能正在被 TopShelf 吞噬。

//结束旁注

经过研究,我了解到这个 dll 实际上在 Azure SDK 中,而不是 nuget 包。

不想为我的服务添加额外的先决条件,我倾向于添加扩展程序集引用并复制到本地。

版本不同,寻找 2.5.0.0 所以还添加了绑定重定向到 2.7.0.0

但是这样做,现在会导致

  • Exception Exception thrown: 'System.IO.FileNotFoundException' in Microsoft.WindowsAzure.ServiceRuntime.dll ("Could not load file or
    assembly 'msshrtmi, Version=2.7.0.0, Culture=neutral,
    PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The
    system cannot find the file
    specified.") System.IO.FileNotFoundException

我担心每次我修复某些东西时,我都需要修复其他东西,然后再修复其他东西......

这让我回到了最初的问题......
实际问题... :-)

我没有发现任何表明 Application Insights 甚至需要安装 Azure SDK 的东西。这让我想知道这些异常是否实际上是 Application Insights 只是询问是否安装了 Azure SDK 的第一次机会异常?

供参考,应用洞察设置:

我的 Application Insights nuget 包是:

1
2
3
4
5
6
  <package id="Microsoft.ApplicationInsights" version="2.5.0" targetFramework="net462" />
  <package id="Microsoft.ApplicationInsights.Agent.Intercept" version="2.4.0" targetFramework="net462" />
  <package id="Microsoft.ApplicationInsights.DependencyCollector" version="2.5.0" targetFramework="net462" />
  <package id="Microsoft.ApplicationInsights.PerfCounterCollector" version="2.5.0" targetFramework="net462" />
  <package id="Microsoft.ApplicationInsights.WindowsServer" version="2.5.0" targetFramework="net462" />
  <package id="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel" version="2.5.0" targetFramework="net462" />

我的配置包括这些 TelemetryInitializers:

1
2
3
4
5
6
<TelemetryInitializers>
    <Add Type="Microsoft.ApplicationInsights.DependencyCollector.HttpDependenciesParsingTelemetryInitializer, Microsoft.AI.DependencyCollector"/>
    <Add Type="Microsoft.ApplicationInsights.WindowsServer.AzureRoleEnvironmentTelemetryInitializer, Microsoft.AI.WindowsServer"/>
    <Add Type="Microsoft.ApplicationInsights.WindowsServer.AzureWebAppRoleEnvironmentTelemetryInitializer, Microsoft.AI.WindowsServer"/>
    <Add Type="Microsoft.ApplicationInsights.WindowsServer.BuildInfoConfigComponentVersionTelemetryInitializer, Microsoft.AI.WindowsServer"/>
</TelemetryInitializers>

还有这些遥测模块:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<TelemetryModules>
<Add Type="Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector">
        <ExcludeComponentCorrelationHttpHeadersOnDomains>

            <Add>core.windows.net</Add>
            <Add>core.chinacloudapi.cn</Add>
            <Add>core.cloudapi.de</Add>
            <Add>core.usgovcloudapi.net</Add>
            <Add>localhost</Add>
            <Add>127.0.0.1</Add>
        </ExcludeComponentCorrelationHttpHeadersOnDomains>
        <IncludeDiagnosticSourceActivities>
            <Add>Microsoft.Azure.EventHubs</Add>
            <Add>Microsoft.Azure.ServiceBus</Add>
        </IncludeDiagnosticSourceActivities>
    </Add>
    <Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.PerformanceCollectorModule, Microsoft.AI.PerfCounterCollector">
    </Add>
    <Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.QuickPulse.QuickPulseTelemetryModule, Microsoft.AI.PerfCounterCollector"/>
    <Add Type="Microsoft.ApplicationInsights.WindowsServer.DeveloperModeWithDebuggerAttachedTelemetryModule, Microsoft.AI.WindowsServer"/>
    <Add Type="Microsoft.ApplicationInsights.WindowsServer.UnhandledExceptionTelemetryModule, Microsoft.AI.WindowsServer"/>
    <Add Type="Microsoft.ApplicationInsights.WindowsServer.UnobservedExceptionTelemetryModule, Microsoft.AI.WindowsServer">

    </Add>
</TelemetryModules>

应用程序洞察是由其他人设置的,我想知道其中一个扩展是否造成了问题,它是针对 Windows 服务的。


Application Insights 本身托管在 Azure 中,但 Application Insights SDK 本身不依赖于任何 Azure SDK。 (您无需在 Azure 中运行应用即可将数据发送到 Application Insights)

您可能正在使用的其他东西可能有 Azure 依赖项,但没有 AI。

如果您正在查看有关 .net 异常的网站或虚拟机指标,则该指标适用于整个框架中引发的异常。如果您在 AI 门户中没有看到异常,则表示它们从未被 AI 处理或被 AI 跟踪。