We have seen the use of Application Insights configuration file in my previous article that described how to integrate AI to your application. Today, we will explore the sections of ApplicationInsights.config (Note that the file is ApplicationInsights.xml for Java web apps) in detail.
As mentioned in that article, this file get automatically added to your application when you add the ApplicationInsights to your application via NuGet or if you specify the AI integration while creating a new project in Visual Studio. And the file will have the default entries/configuration values as shown below:
I have described the key sections in this configuration file below:
As shown above, each module added in this section collects the specific data/counts. You can add or remove line items for these module nodes depending on the information that you want to collect. Some of the common tracker modules under this section are:
You might have noticed this telemetry data in the graphs that I posted in my previous articles which talked about creation of AI telemetry charts. This data represents the number of calls that your application makes to the external databases or services.
<Add Type=”Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector” />
This is to collect system performance parameters such as your CPU and memory load.
<Add Type=”Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.PerformanceCollectorModule, Microsoft.AI.PerfCounterCollector”>
Application Insights Diagnostics
Use this if you want to collect error information from the AI instrumentation.
<Add Type=”Microsoft.ApplicationInsights.Extensibility.Implementation.Tracing.DiagnosticsTelemetryModule, Microsoft.ApplicationInsights” />
Use this if you want your application to send telemetry data one at a time while you step through your lines of code while debugging. Yes, you do not need this in your production configuration.
<Add Type=”Microsoft.ApplicationInsights.WindowsServer.DeveloperModeWithDebuggerAttachedTelemetryModule, Microsoft.AI.WindowsServer” />
Web Request Tracking
Used to collect the http requests, response time and response codes
<Add Type=”Microsoft.ApplicationInsights.Web.RequestTrackingTelemetryModule, Microsoft.AI.Web” />
This one collects data for unhandled exceptions in your applications. Very useful indeed!
<Add Type=”Microsoft.ApplicationInsights.Web.ExceptionTrackingTelemetryModule, Microsoft.AI.Web” />
This is responsible for buffering and sending the telemetry data collected in your application.
Notice the screenshot above and the initializers placed for client IP, Session, User, Domain, Device etc. These are set to set the context properties along with the telemetry data that is collected and sent to the AI service.
Use this section to specify the instrumentation key of the desired Application Insights Resource that you set up in your Azure account. Refer my previous article here for learning more about creating AI resource in Azure.