Brian
Brian

Reputation: 13

Do I need to add application insights telemetry to application when running azure web apps

I recently moved my code over to Azure and am running it in a Azure web app service. I also have a resource for application insights and it shows me data from the specific web app. Now I was wondering if I still need to add services.AddApplicationInsightsTelemetry("instrumentationKey"); to my startup of my C# .net 6.0 project. Including all the packages off course.

Does adding the telemetry give me more detail in application insights? Do I even need to specify something of application insights in my project when running a Azure Web App or is it managing that for you? Couldn't really find an answer to this.

If you need to add it, how would you manage instrumentation keys when you have two Production environments as a backup situation? You would want both web apps to send data to the correct app insights resource.

Upvotes: 1

Views: 1660

Answers (1)

Peter Bons
Peter Bons

Reputation: 29840

Does adding the telemetry give me more detail in application insights? Do I even need to specify something of application insights in my project when running a Azure Web App or is it managing that for you? Couldn't really find an answer to this.

Not necessarily. Using the agent all major telemetry is logged, see the docs. However, there are certain advantages of using the SDK. Mainly, the ability to add additional data to your telemetry or reduce telemetry by using TelemetryInitializer and TelemetryProcessor as described here.

Also, you would be able to wire up ILogger output to Application Insights and you can manually track custom telemetry using the SDK

If you need to add it, how would you manage instrumentation keys when you have two Production environments as a backup situation? You would want both web apps to send data to the correct app insights resource.

Like any other connection string or secret like a database connection string. Some options are outlined here. We typically use a seperate appsettings.json per environment but you could also get the instrumentation key from Azure Key Vault or App Configuration Service or whatever you prefer.

Upvotes: 1

Related Questions