Class OpenTelemetryServiceExtensions
- Namespace
- ReferenceApplication.Web.Extensions
- Assembly
- ReferenceApplication.Web.dll
Provides extension methods to register OpenTelemetry services for the application.
public static class OpenTelemetryServiceExtensions
- Inheritance
-
OpenTelemetryServiceExtensions
- Inherited Members
Methods
AddApplicationOpenTelemetry(IServiceCollection, IConfiguration, IHostEnvironment)
Adds OpenTelemetry tracing and metrics: ASP.NET Core and HttpClient instrumentation, and governance instrumentation.
public static IServiceCollection AddApplicationOpenTelemetry(this IServiceCollection services, IConfiguration configuration, IHostEnvironment environment)
Parameters
servicesIServiceCollectionThe service collection to add OpenTelemetry services to.
configurationIConfigurationThe application configuration source.
environmentIHostEnvironmentThe current hosting environment.
Returns
- IServiceCollection
The same service collection instance so calls can be chained.
Remarks
Governance instrumentation, on by default with EnableGovernanceInstrumentation, registers AsiBackbone's
OpenTelemetry governance emitter through UseOpenTelemetryEmission, collects its activity source and meter,
and collects the host's ReferenceApplication.AuditReconciliation gauges. The emitter records spans only
while tracing is enabled and metrics only while metrics are enabled. ReferenceApplication.Web.Extensions.ApplicationTelemetrySources
names every source and meter collected, and the Development pipeline inspector reads it too.