Skip to content
DocsTry Aspire
DocsTry

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)
{
// ...
}
}
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)
{
// ...
}
}
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.
Injects the appropriate environment variables to allow the resource to enable sending telemetry to the dashboard.
  1. It sets the OTLP endpoint to the value of the ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL environment variable.
  2. It sets the service name and instance id to the resource name and UID. Values are injected by the orchestrator.
  3. 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)
{
// ...
}
}
builderIResourceBuilder<T>The resource builder.
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.
  1. It sets the OTLP endpoint to the value of the ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL environment variable.
  2. It sets the service name and instance id to the resource name and UID. Values are injected by the orchestrator.
  3. 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)
{
// ...
}
}
builderIResourceBuilder<T>The resource builder.
protocolOtlpProtocolThe protocol to use for the OTLP exporter. If not set, it will try gRPC then Http.
IResourceBuilder<T>The ApplicationModel.IResourceBuilder`1.