I am trying to enable Azure Application Insights Auto Instrumentation for my existing ASP.NET web application hosted on App Service. It does not work, so I try to investigate and found this section from https://learn.microsoft.com/en-us/troubleshoot/azure/azure-monitor/app-insights/auto-instrumentation-troubleshoot?source=recommendations
A diagnostics library was detected
Auto-instrumentation fails if it detects the following libraries:
System.Diagnostics.DiagnosticSource
Microsoft.AspNet.TelemetryCorrelation
Microsoft.ApplicationInsights
These libraries must be removed for auto-instrumentation to succeed.
In my case, my web application has a dependency on System.Diagnostics.DiagnosticSource
. But to my surprise, this library is a transitive dependency for Azure.Core
, and most of the sdks to connnect with Azure services have a dependency on Azure.Core
. And it is very unlikely that we want to deploy a web app on Azure without connecting to Azure services.
So does this mean that it is nearly impossible to use the auto instrumentation on a non-trivial app?