Configuration

Here you will find App Metrics configuration options related to integrating App Metrics in an ASP.NET Core application.

App Metrics Core

Program.cs

When bootstrapping an ASP.NET Core application in Program.cs using the Microsoft.AspNetCore.WebHost, App Metrics core functionality can be configured using extension methods provided on Microsoft.Extensions.Hosting.IWebHostBuilder.

Modifying or extending a MetricsBuilder that is pre-configured with the defaults configuration:

view code snippet

Using a MetricsBuilder where you define the desired configuration without defaults:

view code snippet

Startup.cs

Optionally, App Metrics core functionality can be configured in an ASP.NET Core application using the Startup.cs rather than bootstrapping on the WebHost. This is done by using the MetricsBuilder directly and the Microsoft.Extensions.DependencyInjection.IServiceCollection extension methods provided by App Metrics.

Modifying or extending a MetricsBuilder that is pre-configured with the defaults configuration:

view code snippet

Using a MetricsBuilder where you define the desired configuration without defaults:

view code snippet

For more details App Metrics core configuration options, refer to the configuration fundamentals documentation.

Tracking Middleware

For details on configuring App.Metrics.AspNetCore.Tracking, see the ASP.NET Core Web Metrics documentation.

Endpoint Middleware

For details on configuring App.Metrics.AspNetCore.Endpoints, see the ASP.NET Core Endpoints documentation.