-
Notifications
You must be signed in to change notification settings - Fork 3
ApplicationInsights
To be able to use the telemetry using ApplicationInsights, install the following package from the NuGet
dotnet add package Easify.Azure.AspNetCore.AppInsights
The following section for ApplicationInsights need to be added to appsettings.json
"ApplicationInsights": {
"InstrumentationKey": "Instrument Key Here"
},
And finally, in the startup, the following extension will activate
services.AddTelemetry();
By default, it configures the ApplicationInsights and register the component with Application Name (Coming from the Application section of the configuration), and publish tracing and telemetry information there. It also enables the SQL server trace when the telemetry involves the connection to SQL Server.
The configure optional parameter can be used to disable the SQL tracing. Here is an example:
services.AddTelemetry(options =>
{
options.DisableSqlInstrumentation();
});
AddTelemetry extension method registers Application Insights with the default configurations but it can take a delegate as a parameter which allows on making further configuration changes.
services.AddTelemetry(options =>
{
// Make changes to options here
});