OtlpConfigurationExtensions Methods
ClassMethods4 members
Provides extension methods for configuring OpenTelemetry in projects using environment variables.
AddOtlpEnvironment(IResource, IConfiguration, IHostEnvironment)Section titled AddOtlpEnvironment(IResource, IConfiguration, IHostEnvironment)static Configures OpenTelemetry in projects using environment variables.
public static class OtlpConfigurationExtensions{ public static void AddOtlpEnvironment( IResource resource, IConfiguration configuration, IHostEnvironment environment) { // ... }}Parameters
resourceIResourceThe resource to add annotations to.configurationIConfigurationThe configuration to use for the OTLP exporter endpoint URL.environmentIHostEnvironmentThe host environment to check if the application is running in development mode.AddOtlpEnvironment(IResource, IConfiguration, IHostEnvironment, OtlpProtocol)Section titled AddOtlpEnvironment(IResource, IConfiguration, IHostEnvironment, OtlpProtocol)static Configures OpenTelemetry in projects using environment variables.
public static class OtlpConfigurationExtensions{ public static void AddOtlpEnvironment( IResource resource, IConfiguration configuration, IHostEnvironment environment, OtlpProtocol protocol) { // ... }}Parameters
resourceIResourceThe resource to add annotations to.configurationIConfigurationThe configuration to use for the OTLP exporter endpoint URL.environmentIHostEnvironmentThe host environment to check if the application is running in development mode.protocolOtlpProtocolThe protocol to use for the OTLP exporter. If not set, it will try gRPC then Http.WithOtlpExporter(IResourceBuilder<T>)Section titled WithOtlpExporter(IResourceBuilder<T>)extensionIResourceBuilder<T> Injects the appropriate environment variables to allow the resource to enable sending telemetry to the dashboard.
- It sets the OTLP endpoint to the value of the
ASPIRE_DASHBOARD_OTLP_ENDPOINT_URLenvironment variable. - It sets the service name and instance id to the resource name and UID. Values are injected by the orchestrator.
- It sets a small batch schedule delay in development. This reduces the delay that OTLP exporter waits to sends telemetry and makes the dashboard telemetry pages responsive.
public static class OtlpConfigurationExtensions{ public static IResourceBuilder<T> WithOtlpExporter<T>( this IResourceBuilder<T> builder) { // ... }}Parameters
builderIResourceBuilder<T>The resource builder.Returns
IResourceBuilder<T>The ApplicationModel.IResourceBuilder`1.WithOtlpExporter(IResourceBuilder<T>, OtlpProtocol)Section titled WithOtlpExporter(IResourceBuilder<T>, OtlpProtocol)extensionIResourceBuilder<T> Injects the appropriate environment variables to allow the resource to enable sending telemetry to the dashboard.
- It sets the OTLP endpoint to the value of the
ASPIRE_DASHBOARD_OTLP_ENDPOINT_URLenvironment variable. - It sets the service name and instance id to the resource name and UID. Values are injected by the orchestrator.
- It sets a small batch schedule delay in development. This reduces the delay that OTLP exporter waits to sends telemetry and makes the dashboard telemetry pages responsive.
public static class OtlpConfigurationExtensions{ public static IResourceBuilder<T> WithOtlpExporter<T>( this IResourceBuilder<T> builder, OtlpProtocol protocol) { // ... }}Parameters
builderIResourceBuilder<T>The resource builder.protocolOtlpProtocolThe protocol to use for the OTLP exporter. If not set, it will try gRPC then Http.Returns
IResourceBuilder<T>The ApplicationModel.IResourceBuilder`1.