Skip to content

Observability

moattarwork edited this page Dec 14, 2022 · 1 revision

The Observability has been defined in the API using ApplicationInsights in Azure.

To be able to use the telemetry, install the following package from the NuGet

dotnet add package LittleBlocks.AspNetCore.Telemetry.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