OtlpConfigurationExtensions
Class static net8.0
Provides extension methods for configuring OpenTelemetry in projects using environment variables.
namespace Aspire.Hosting;
public static class OtlpConfigurationExtensions{ // ...}Methods4
Section titled MethodsAddOtlpEnvironment(IResource, IConfiguration, IHostEnvironment)static Configures OpenTelemetry in projects using environment variables.
AddOtlpEnvironment(IResource, IConfiguration, IHostEnvironment, OtlpProtocol)static Configures OpenTelemetry in projects using environment variables.
WithOtlpExporter(IResourceBuilder<T>)extensionats export 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.
WithOtlpExporter(IResourceBuilder<T>, OtlpProtocol)extensionats export 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.