Reputation: 2554
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?
Upvotes: 1
Views: 1791
Reputation: 7367
Isn't it nearly impossible to use Azure Application Insights Auto Instrumentations for .NET?
Thanks @Peter Bons for the comment.
As per this MSDoc, Auto Instrumentation is supported for
Windows - .NET Core LTS Linux - Only ASP.NET Core 6.0.
Please check the auto-instrumentation supported environments.
It is not impossible, but Auto-Instrumentation may not track all the required telemetry data as you have specified.
To avoid all this, it is advised to configure the Application Insights
Manually.
Auto-Instrumentation works well when you you want to track data for easy and small Application.
If you want to track any custom events and metrics, then better to go with manual Application Insights.
In appsettings.json
file add the ApplicationInsights ConnectionString
.
Refer the below links
.NET Core
Applications.Upvotes: 3