Application Insights' Application Map doesn't show dependency calls

回眸只為那壹抹淺笑 提交于 2021-01-29 03:51:32

问题


We have added Application Insights to an Asp.Net 4.5.1 application deployed to an Azure Web App Service. It calls the database both using Entity Framework and SqlCommands.

Application Insights is added both with javascript and in the backend. The javascript tracking is working, as can be seen both from calls tracked with Fiddler and the report data showing in the Azure portal.

Requests to the web server are also shown in the reports but the Application Map chart doesn't show any dependency calls from the web server to the database nor any other dependencies.

The ApplicationInsights.config is the standard one that you get from "Create new project" but with the InstrumentationKey element removed. The instrumentation key is set in global.asax as

Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration.Active.InstrumentationKey = applicationInsightsKey;

Additionally web config contains

<system.web>
    <httpHandlers>
      <add path="CombineScriptsHandler.axd" verb="*" type="AjaxControlToolkit.CombineScriptsHandler, AjaxControlToolkit" />
    </httpHandlers>
    <httpModules>
      <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />
    </httpModules>

...

  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
      <remove name="ApplicationInsightsWebTracking" />
      <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
    </modules>

How can I get database query data from the web server tracked in AI?

Update

I upgraded the Web project to .Net 4.6.1 and started seeing some dependencies but not the actual sql query text. To remedy that I installed the AI Status Monitor extension in the App Service through the Azure portal. After that I saw absolutely no dependency calls and ApplicationInsightsExtension.log contained:

9/29/2016 12:15:45 PM: [Verbose] Loading assembly from D:\home\SiteExtensions\Microsoft.ApplicationInsights.AzureWebSites\Microsoft.ApplicationInsights.WebSiteManager.dll
9/29/2016 12:15:45 PM: [Verbose] Starting Application Insights installation and configuration...
9/29/2016 12:15:46 PM: [Verbose] Loading assembly from D:\home\SiteExtensions\Microsoft.ApplicationInsights.AzureWebSites\Microsoft.ApplicationInsights.WebSiteManager.dll
9/29/2016 12:15:46 PM: [Verbose] Starting Application Insights Profiler configuration...
9/29/2016 12:15:46 PM: [Verbose] Current processor architecture: x86
9/29/2016 12:15:46 PM: [Verbose] Starting to download/install 'Microsoft.ApplicationInsights.Agent_x86' nuget package from D:\home\SiteExtensions\Microsoft.ApplicationInsights.AzureWebSites\appinsights...
9/29/2016 12:15:46 PM, [Verbose] Installing 'Microsoft.ApplicationInsights.Agent_x86', version '2.0.0' ...
9/29/2016 12:15:47 PM, [Verbose] Installed 'Microsoft.ApplicationInsights.Agent_x86', version '2.0.0'.
9/29/2016 12:15:47 PM: [Verbose] End of 'Microsoft.ApplicationInsights.Agent_x86' nuget package download/install.
9/29/2016 12:15:47 PM: [Verbose] Ready to copy files from D:\home\SiteExtensions\Microsoft.ApplicationInsights.AzureWebSites\Packages\Microsoft.ApplicationInsights.Agent_x86.2.0.0\content\RTIA\x86 to D:\home\SiteExtensions\Microsoft.ApplicationInsights.AzureWebSites\Agent
9/29/2016 12:15:47 PM: [Verbose] Microsoft.ApplicationInsights.Extensions.Base_x86.dll.Name was copied.
9/29/2016 12:15:47 PM: [Verbose] Microsoft.ApplicationInsights.ExtensionsHost_x86.dll.Name was copied.
9/29/2016 12:15:47 PM: [Verbose] Microsoft.Diagnostics.Instrumentation.Extensions.Base.dll.Name was copied.
9/29/2016 12:15:47 PM: [Verbose] Microsoft.InstrumentationEngine.Extensions.config.Name was copied.
9/29/2016 12:15:47 PM: [Verbose] MicrosoftInstrumentationEngine_x86.dll.Name was copied.
9/29/2016 12:15:47 PM: [Verbose] End of Application Insights Profiler configuration.
9/29/2016 12:15:47 PM: [Verbose] Loading config from D:\home\site\wwwroot\ApplicationInsights.config
9/29/2016 12:15:47 PM: [Verbose] Application is already instrumented with Application Insights version: 2.1.0.0
9/29/2016 12:15:47 PM: [Verbose] End of Application Insights installation and configuration.

So how can I get dependency logging with sql query text logging?

I have a hunch this would work if I had the telemetry key in the applicationinsights.config file but I want to set that programmatically from the app settings.


回答1:


According to this: https://azure.microsoft.com/en-us/documentation/articles/app-insights-dependencies/

To get dependencies you either need to install Status Monitor or upgrade your application to .NET framework 4.6 or later.




回答2:


Also check that the applicationinsights.config file is copied over to your deployment folder - i.e. it is marked as "copy if newer" in the "Copy to Output Directory" property. I don't think msbuild does this for you.



来源:https://stackoverflow.com/questions/39573603/application-insights-application-map-doesnt-show-dependency-calls

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!