Skip to content
Docs Try Aspire

OtlpConfigurationExtensions Methods

Class Methods 4 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)
{
// ...
}
}
resource IResource The resource to add annotations to.
configuration IConfiguration The configuration to use for the OTLP exporter endpoint URL.
environment IHostEnvironment The 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)
{
// ...
}
}
resource IResource The resource to add annotations to.
configuration IConfiguration The configuration to use for the OTLP exporter endpoint URL.
environment IHostEnvironment The host environment to check if the application is running in development mode.
protocol OtlpProtocol The protocol to use for the OTLP exporter. If not set, it will try gRPC then Http.
WithOtlpExporter(IResourceBuilder<T>) Section titled WithOtlpExporter(IResourceBuilder<T>) extension IResourceBuilder<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)
{
// ...
}
}
builder IResourceBuilder<T> The resource builder.
IResourceBuilder<T> The ApplicationModel.IResourceBuilder`1.
WithOtlpExporter(IResourceBuilder<T>, OtlpProtocol) Section titled WithOtlpExporter(IResourceBuilder<T>, OtlpProtocol) extension IResourceBuilder<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)
{
// ...
}
}
builder IResourceBuilder<T> The resource builder.
protocol OtlpProtocol The protocol to use for the OTLP exporter. If not set, it will try gRPC then Http.
IResourceBuilder<T> The ApplicationModel.IResourceBuilder`1.