Skip to content
Docs Try Aspire
Docs Try

OpenTelemetryCollectorExtensions Methods

Class Methods 3 members
Provides extension methods for adding and configuring OpenTelemetry Collector resources.
AddOpenTelemetryCollector(IDistributedApplicationBuilder, string, Action<OpenTelemetryCollectorSettings>) Section titled AddOpenTelemetryCollector(IDistributedApplicationBuilder, string, Action<OpenTelemetryCollectorSettings>) extension IResourceBuilder<OpenTelemetryCollectorResource>
Adds an OpenTelemetry Collector container resource to the application model.
public static class OpenTelemetryCollectorExtensions
{
public static IResourceBuilder<OpenTelemetryCollectorResource> AddOpenTelemetryCollector(
this IDistributedApplicationBuilder builder,
string name,
Action<OpenTelemetryCollectorSettings>? configureSettings = null)
{
// ...
}
}
builder IDistributedApplicationBuilder The application builder.
name string The name of the resource.
configureSettings Action<OpenTelemetryCollectorSettings> optional An optional callback that configures the collector settings.
IResourceBuilder<OpenTelemetryCollectorResource> A reference to the resource builder.
WithAppForwarding(IResourceBuilder<OpenTelemetryCollectorResource>) Section titled WithAppForwarding(IResourceBuilder<OpenTelemetryCollectorResource>) extension IResourceBuilder<OpenTelemetryCollectorResource>
Configures all compatible resources in the application to forward telemetry to this collector.
public static class OpenTelemetryCollectorExtensions
{
public static IResourceBuilder<OpenTelemetryCollectorResource> WithAppForwarding(
this IResourceBuilder<OpenTelemetryCollectorResource> builder)
{
// ...
}
}
builder IResourceBuilder<OpenTelemetryCollectorResource> The collector resource builder.
IResourceBuilder<OpenTelemetryCollectorResource> A reference to the resource builder.
WithConfig(IResourceBuilder<OpenTelemetryCollectorResource>, string) Section titled WithConfig(IResourceBuilder<OpenTelemetryCollectorResource>, string) extension IResourceBuilder<OpenTelemetryCollectorResource>
Adds a configuration file to the collector resource.
public static class OpenTelemetryCollectorExtensions
{
public static IResourceBuilder<OpenTelemetryCollectorResource> WithConfig(
this IResourceBuilder<OpenTelemetryCollectorResource> builder,
string configPath)
{
// ...
}
}
builder IResourceBuilder<OpenTelemetryCollectorResource> The collector resource builder.
configPath string The path to the collector configuration file.
IResourceBuilder<OpenTelemetryCollectorResource> A reference to the resource builder.