Skip to content

ApplicationInsights

Mohammad Moattar edited this page Dec 4, 2020 · 3 revisions

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();

The Application Insights register the component with Application Name (Coming from the Application section of the configuration) and publish tracing and telemetry information there.

Extensions

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
});
Clone this wiki locally