Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add better documentation for IResourceDetector and OltpExporter configuration #4230

Merged
merged 27 commits into from
Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
145ff7f
Added IServiceProvider option to callbacks for hosting extensions
cromefire Feb 24, 2023
5c86fc1
Added changelog entry
cromefire Feb 24, 2023
c6dc65d
Reverted changes to metrics and tracing
cromefire Feb 24, 2023
b7f6156
Removed unneeded stuff from the public API
cromefire Feb 24, 2023
12ef20c
Swapped params
cromefire Feb 24, 2023
5da158c
Added more documentation on the option configuration
cromefire Feb 24, 2023
796cad8
Made the AddDetector variant for the ResolvingResourceDetector availa…
cromefire Feb 24, 2023
dbbe47f
Added more documentation to the IResourceDetector
cromefire Feb 24, 2023
7e5ef07
Fixed APIs
cromefire Feb 24, 2023
b53a42c
Fixed Changelog
cromefire Feb 24, 2023
2c242c5
Removed unneeded version of ConfigureResource
cromefire Feb 24, 2023
7415513
Removed extra formatting
cromefire Feb 24, 2023
c68f85b
Merge remote-tracking branch 'upsteam/main' into service-provider-cal…
cromefire Feb 25, 2023
2847aa6
Reverted public API change
cromefire Mar 6, 2023
2b4831b
Reverted note
cromefire Mar 6, 2023
261ea06
Reverted API doc changes
cromefire Mar 6, 2023
c7c6d09
Merge remote-tracking branch 'upsteam/main' into service-provider-cal…
cromefire Mar 6, 2023
290d486
Improved resource detector docs
cromefire Mar 6, 2023
ba2edeb
Satisfied markdownlint
cromefire Mar 6, 2023
11a81a3
Merge branch 'main' into service-provider-callbacks
cromefire Mar 6, 2023
138fff0
Merge branch 'main' into service-provider-callbacks
cijothomas Mar 7, 2023
f7f0488
Merge branch 'main' into service-provider-callbacks
cromefire Mar 7, 2023
6d81fe4
Added dependency injection to sample
cromefire Mar 30, 2023
9a189f2
Merge remote-tracking branch 'origin/service-provider-callbacks' into…
cromefire Mar 30, 2023
31fc495
Merge branch 'main' into service-provider-callbacks
cromefire Mar 30, 2023
afef252
Merge branch 'main' into service-provider-callbacks
CodeBlanch Mar 31, 2023
db3d00f
Merge branch 'main' into service-provider-callbacks
CodeBlanch Mar 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
Microsoft.Extensions.DependencyInjection.OpenTelemetryServicesExtensions
OpenTelemetry.OpenTelemetryBuilder
OpenTelemetry.OpenTelemetryBuilder.ConfigureResource(System.Action<OpenTelemetry.Resources.ResourceBuilder!>! configure) -> OpenTelemetry.OpenTelemetryBuilder!
OpenTelemetry.OpenTelemetryBuilder.ConfigureResource(System.Action<OpenTelemetry.Resources.ResourceBuilder!, System.IServiceProvider!>! configure) -> OpenTelemetry.OpenTelemetryBuilder!
OpenTelemetry.OpenTelemetryBuilder.Services.get -> Microsoft.Extensions.DependencyInjection.IServiceCollection!
OpenTelemetry.OpenTelemetryBuilder.WithMetrics() -> OpenTelemetry.OpenTelemetryBuilder!
OpenTelemetry.OpenTelemetryBuilder.WithMetrics(System.Action<OpenTelemetry.Metrics.MeterProviderBuilder!>! configure) -> OpenTelemetry.OpenTelemetryBuilder!
OpenTelemetry.OpenTelemetryBuilder.WithMetrics(System.Action<OpenTelemetry.Metrics.MeterProviderBuilder!, System.IServiceProvider!>! configure) -> OpenTelemetry.OpenTelemetryBuilder!
OpenTelemetry.OpenTelemetryBuilder.WithTracing() -> OpenTelemetry.OpenTelemetryBuilder!
OpenTelemetry.OpenTelemetryBuilder.WithTracing(System.Action<OpenTelemetry.Trace.TracerProviderBuilder!>! configure) -> OpenTelemetry.OpenTelemetryBuilder!
OpenTelemetry.OpenTelemetryBuilder.WithTracing(System.Action<OpenTelemetry.Trace.TracerProviderBuilder!, System.IServiceProvider!>! configure) -> OpenTelemetry.OpenTelemetryBuilder!
static Microsoft.Extensions.DependencyInjection.OpenTelemetryServicesExtensions.AddOpenTelemetry(this Microsoft.Extensions.DependencyInjection.IServiceCollection! services) -> OpenTelemetry.OpenTelemetryBuilder!

3 changes: 3 additions & 0 deletions src/OpenTelemetry.Extensions.Hosting/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
* Removed deprecated extensions: `AddOpenTelemetryTracing`,
`AddOpenTelemetryMetrics`, `Configure`, & `GetServices`.
([#4071](https://github.com/open-telemetry/opentelemetry-dotnet/pull/4071))
* Added optional IServiceProvider arguments to the callbacks
of `ConfigureResource`, `WithTracing`, & `WithMetrics`.
([#4230](https://github.com/open-telemetry/opentelemetry-dotnet/pull/4230))

## 1.4.0-rc.4

Expand Down
65 changes: 63 additions & 2 deletions src/OpenTelemetry.Extensions.Hosting/OpenTelemetryBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,29 @@ public OpenTelemetryBuilder ConfigureResource(
return this;
}

/// <summary>
/// Registers an action to configure the <see cref="ResourceBuilder"/>s used
/// by tracing and metrics.
/// </summary>
/// <remarks><inheritdoc cref="ConfigureResource(System.Action{OpenTelemetry.Resources.ResourceBuilder})" path="/remarks"/></remarks>
/// <param name="configure"><see cref="ResourceBuilder"/> configuration
/// action.</param>
/// <returns>The supplied <see cref="OpenTelemetryBuilder"/> for chaining
/// calls.</returns>
public OpenTelemetryBuilder ConfigureResource(
cromefire marked this conversation as resolved.
Show resolved Hide resolved
Action<ResourceBuilder, IServiceProvider> configure)
{
Guard.ThrowIfNull(configure);

this.Services.ConfigureOpenTelemetryMeterProvider(
(sp, builder) => builder.ConfigureResource(configure));

this.Services.ConfigureOpenTelemetryTracerProvider(
(sp, builder) => builder.ConfigureResource(configure));

return this;
}

/// <summary>
/// Adds metric services into the builder.
/// </summary>
Expand Down Expand Up @@ -95,7 +118,26 @@ public OpenTelemetryBuilder WithMetrics(Action<MeterProviderBuilder> configure)

var builder = new MeterProviderBuilderBase(this.Services);

configure(builder);
builder.Configure(configure);

return this;
}

/// <summary>
/// Adds metric services into the builder.
/// </summary>
/// <remarks><inheritdoc cref="WithMetrics()" path="/remarks"/></remarks>
/// <param name="configure"><see cref="MeterProviderBuilder"/>
/// configuration callback.</param>
/// <returns>The supplied <see cref="OpenTelemetryBuilder"/> for chaining
/// calls.</returns>
public OpenTelemetryBuilder WithMetrics(Action<MeterProviderBuilder, IServiceProvider> configure)
cromefire marked this conversation as resolved.
Show resolved Hide resolved
{
Guard.ThrowIfNull(configure);

var builder = new MeterProviderBuilderBase(this.Services);

builder.Configure(configure);

return this;
}
Expand Down Expand Up @@ -127,7 +169,26 @@ public OpenTelemetryBuilder WithTracing(Action<TracerProviderBuilder> configure)

var builder = new TracerProviderBuilderBase(this.Services);

configure(builder);
builder.Configure(configure);

return this;
}

/// <summary>
/// Adds tracing services into the builder.
/// </summary>
/// <remarks><inheritdoc cref="WithTracing()" path="/remarks"/></remarks>
/// <param name="configure"><see cref="TracerProviderBuilder"/>
/// configuration callback.</param>
/// <returns>The supplied <see cref="OpenTelemetryBuilder"/> for chaining
/// calls.</returns>
public OpenTelemetryBuilder WithTracing(Action<TracerProviderBuilder, IServiceProvider> configure)
cromefire marked this conversation as resolved.
Show resolved Hide resolved
{
Guard.ThrowIfNull(configure);

var builder = new TracerProviderBuilderBase(this.Services);

builder.Configure(configure);

return this;
}
Expand Down
2 changes: 2 additions & 0 deletions src/OpenTelemetry/.publicApi/net462/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ static OpenTelemetry.Trace.TracerProviderBuilderExtensions.AddProcessor<T>(this
static OpenTelemetry.Trace.TracerProviderBuilderExtensions.SetSampler(this OpenTelemetry.Trace.TracerProviderBuilder! tracerProviderBuilder, System.Func<System.IServiceProvider!, OpenTelemetry.Trace.Sampler!>! implementationFactory) -> OpenTelemetry.Trace.TracerProviderBuilder!
static OpenTelemetry.Trace.TracerProviderBuilderExtensions.SetSampler<T>(this OpenTelemetry.Trace.TracerProviderBuilder! tracerProviderBuilder) -> OpenTelemetry.Trace.TracerProviderBuilder!
static OpenTelemetry.Metrics.MeterProviderBuilderExtensions.ConfigureResource(this OpenTelemetry.Metrics.MeterProviderBuilder! meterProviderBuilder, System.Action<OpenTelemetry.Resources.ResourceBuilder!>! configure) -> OpenTelemetry.Metrics.MeterProviderBuilder!
static OpenTelemetry.Metrics.MeterProviderBuilderExtensions.ConfigureResource(this OpenTelemetry.Metrics.MeterProviderBuilder! meterProviderBuilder, System.Action<OpenTelemetry.Resources.ResourceBuilder!, System.IServiceProvider!>! configure) -> OpenTelemetry.Metrics.MeterProviderBuilder!
static OpenTelemetry.Trace.TracerProviderBuilderExtensions.ConfigureResource(this OpenTelemetry.Trace.TracerProviderBuilder! tracerProviderBuilder, System.Action<OpenTelemetry.Resources.ResourceBuilder!>! configure) -> OpenTelemetry.Trace.TracerProviderBuilder!
static OpenTelemetry.Trace.TracerProviderBuilderExtensions.ConfigureResource(this OpenTelemetry.Trace.TracerProviderBuilder! tracerProviderBuilder, System.Action<OpenTelemetry.Resources.ResourceBuilder!, System.IServiceProvider!>! configure) -> OpenTelemetry.Trace.TracerProviderBuilder!
OpenTelemetry.Metrics.MetricType.LongSumNonMonotonic = 138 -> OpenTelemetry.Metrics.MetricType
OpenTelemetry.Metrics.MetricType.DoubleSumNonMonotonic = 141 -> OpenTelemetry.Metrics.MetricType
2 changes: 2 additions & 0 deletions src/OpenTelemetry/.publicApi/net6.0/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ static OpenTelemetry.Trace.TracerProviderBuilderExtensions.AddProcessor<T>(this
static OpenTelemetry.Trace.TracerProviderBuilderExtensions.SetSampler(this OpenTelemetry.Trace.TracerProviderBuilder! tracerProviderBuilder, System.Func<System.IServiceProvider!, OpenTelemetry.Trace.Sampler!>! implementationFactory) -> OpenTelemetry.Trace.TracerProviderBuilder!
static OpenTelemetry.Trace.TracerProviderBuilderExtensions.SetSampler<T>(this OpenTelemetry.Trace.TracerProviderBuilder! tracerProviderBuilder) -> OpenTelemetry.Trace.TracerProviderBuilder!
static OpenTelemetry.Metrics.MeterProviderBuilderExtensions.ConfigureResource(this OpenTelemetry.Metrics.MeterProviderBuilder! meterProviderBuilder, System.Action<OpenTelemetry.Resources.ResourceBuilder!>! configure) -> OpenTelemetry.Metrics.MeterProviderBuilder!
static OpenTelemetry.Metrics.MeterProviderBuilderExtensions.ConfigureResource(this OpenTelemetry.Metrics.MeterProviderBuilder! meterProviderBuilder, System.Action<OpenTelemetry.Resources.ResourceBuilder!, System.IServiceProvider!>! configure) -> OpenTelemetry.Metrics.MeterProviderBuilder!
static OpenTelemetry.Trace.TracerProviderBuilderExtensions.ConfigureResource(this OpenTelemetry.Trace.TracerProviderBuilder! tracerProviderBuilder, System.Action<OpenTelemetry.Resources.ResourceBuilder!>! configure) -> OpenTelemetry.Trace.TracerProviderBuilder!
static OpenTelemetry.Trace.TracerProviderBuilderExtensions.ConfigureResource(this OpenTelemetry.Trace.TracerProviderBuilder! tracerProviderBuilder, System.Action<OpenTelemetry.Resources.ResourceBuilder!, System.IServiceProvider!>! configure) -> OpenTelemetry.Trace.TracerProviderBuilder!
OpenTelemetry.Metrics.MetricType.LongSumNonMonotonic = 138 -> OpenTelemetry.Metrics.MetricType
OpenTelemetry.Metrics.MetricType.DoubleSumNonMonotonic = 141 -> OpenTelemetry.Metrics.MetricType
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ static OpenTelemetry.Trace.TracerProviderBuilderExtensions.AddProcessor<T>(this
static OpenTelemetry.Trace.TracerProviderBuilderExtensions.SetSampler(this OpenTelemetry.Trace.TracerProviderBuilder! tracerProviderBuilder, System.Func<System.IServiceProvider!, OpenTelemetry.Trace.Sampler!>! implementationFactory) -> OpenTelemetry.Trace.TracerProviderBuilder!
static OpenTelemetry.Trace.TracerProviderBuilderExtensions.SetSampler<T>(this OpenTelemetry.Trace.TracerProviderBuilder! tracerProviderBuilder) -> OpenTelemetry.Trace.TracerProviderBuilder!
static OpenTelemetry.Metrics.MeterProviderBuilderExtensions.ConfigureResource(this OpenTelemetry.Metrics.MeterProviderBuilder! meterProviderBuilder, System.Action<OpenTelemetry.Resources.ResourceBuilder!>! configure) -> OpenTelemetry.Metrics.MeterProviderBuilder!
static OpenTelemetry.Metrics.MeterProviderBuilderExtensions.ConfigureResource(this OpenTelemetry.Metrics.MeterProviderBuilder! meterProviderBuilder, System.Action<OpenTelemetry.Resources.ResourceBuilder!, System.IServiceProvider!>! configure) -> OpenTelemetry.Metrics.MeterProviderBuilder!
static OpenTelemetry.Trace.TracerProviderBuilderExtensions.ConfigureResource(this OpenTelemetry.Trace.TracerProviderBuilder! tracerProviderBuilder, System.Action<OpenTelemetry.Resources.ResourceBuilder!>! configure) -> OpenTelemetry.Trace.TracerProviderBuilder!
static OpenTelemetry.Trace.TracerProviderBuilderExtensions.ConfigureResource(this OpenTelemetry.Trace.TracerProviderBuilder! tracerProviderBuilder, System.Action<OpenTelemetry.Resources.ResourceBuilder!, System.IServiceProvider!>! configure) -> OpenTelemetry.Trace.TracerProviderBuilder!
OpenTelemetry.Metrics.MetricType.LongSumNonMonotonic = 138 -> OpenTelemetry.Metrics.MetricType
OpenTelemetry.Metrics.MetricType.DoubleSumNonMonotonic = 141 -> OpenTelemetry.Metrics.MetricType
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ static OpenTelemetry.Trace.TracerProviderBuilderExtensions.AddProcessor<T>(this
static OpenTelemetry.Trace.TracerProviderBuilderExtensions.SetSampler(this OpenTelemetry.Trace.TracerProviderBuilder! tracerProviderBuilder, System.Func<System.IServiceProvider!, OpenTelemetry.Trace.Sampler!>! implementationFactory) -> OpenTelemetry.Trace.TracerProviderBuilder!
static OpenTelemetry.Trace.TracerProviderBuilderExtensions.SetSampler<T>(this OpenTelemetry.Trace.TracerProviderBuilder! tracerProviderBuilder) -> OpenTelemetry.Trace.TracerProviderBuilder!
static OpenTelemetry.Metrics.MeterProviderBuilderExtensions.ConfigureResource(this OpenTelemetry.Metrics.MeterProviderBuilder! meterProviderBuilder, System.Action<OpenTelemetry.Resources.ResourceBuilder!>! configure) -> OpenTelemetry.Metrics.MeterProviderBuilder!
static OpenTelemetry.Metrics.MeterProviderBuilderExtensions.ConfigureResource(this OpenTelemetry.Metrics.MeterProviderBuilder! meterProviderBuilder, System.Action<OpenTelemetry.Resources.ResourceBuilder!, System.IServiceProvider!>! configure) -> OpenTelemetry.Metrics.MeterProviderBuilder!
static OpenTelemetry.Trace.TracerProviderBuilderExtensions.ConfigureResource(this OpenTelemetry.Trace.TracerProviderBuilder! tracerProviderBuilder, System.Action<OpenTelemetry.Resources.ResourceBuilder!>! configure) -> OpenTelemetry.Trace.TracerProviderBuilder!
static OpenTelemetry.Trace.TracerProviderBuilderExtensions.ConfigureResource(this OpenTelemetry.Trace.TracerProviderBuilder! tracerProviderBuilder, System.Action<OpenTelemetry.Resources.ResourceBuilder!, System.IServiceProvider!>! configure) -> OpenTelemetry.Trace.TracerProviderBuilder!
OpenTelemetry.Metrics.MetricType.LongSumNonMonotonic = 138 -> OpenTelemetry.Metrics.MetricType
OpenTelemetry.Metrics.MetricType.DoubleSumNonMonotonic = 141 -> OpenTelemetry.Metrics.MetricType
10 changes: 10 additions & 0 deletions src/OpenTelemetry/Metrics/Builder/MeterProviderBuilderBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,16 @@ MeterProviderBuilder IDeferredMeterProviderBuilder.Configure(Action<IServiceProv
internal MeterProvider InvokeBuild()
=> this.Build();

internal void Configure(Action<MeterProviderBuilder> configure)
{
this.ConfigureBuilderInternal((_, builder) => configure(builder));
}

internal void Configure(Action<MeterProviderBuilder, IServiceProvider> configure)
{
this.ConfigureBuilderInternal((sp, builder) => configure(builder, sp));
}

/// <summary>
/// Run the configured actions to initialize the <see cref="MeterProvider"/>.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,26 @@ public static MeterProviderBuilder ConfigureResource(this MeterProviderBuilder m
return meterProviderBuilder;
}

/// <summary>
/// Modify the <see cref="ResourceBuilder"/> from which the Resource associated with
/// this provider is built from in-place.
/// </summary>
/// <param name="meterProviderBuilder"><see cref="MeterProviderBuilder"/>.</param>
/// <param name="configure">An action which modifies the provided <see cref="ResourceBuilder"/> in-place.</param>
/// <returns>The supplied <see cref="MeterProviderBuilder"/> for chaining.</returns>
public static MeterProviderBuilder ConfigureResource(this MeterProviderBuilder meterProviderBuilder, Action<ResourceBuilder, IServiceProvider> configure)
{
meterProviderBuilder.ConfigureBuilder((sp, builder) =>
{
if (builder is MeterProviderBuilderSdk meterProviderBuilderSdk)
{
meterProviderBuilderSdk.ConfigureResource(resourceBuilder => configure(resourceBuilder, sp));
}
});

return meterProviderBuilder;
}

/// <summary>
/// Run the given actions to initialize the <see cref="MeterProvider"/>.
/// </summary>
Expand Down
22 changes: 18 additions & 4 deletions src/OpenTelemetry/Trace/Builder/TracerProviderBuilderBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ public TracerProviderBuilderBase()
.AddOpenTelemetrySharedProviderBuilderServices()
.AddOpenTelemetryTracerProviderBuilderServices()
.TryAddSingleton<TracerProvider>(
sp => throw new NotSupportedException("Self-contained TracerProvider cannot be accessed using the application IServiceProvider call Build instead."));
sp => throw new NotSupportedException(
"Self-contained TracerProvider cannot be accessed using the application IServiceProvider call Build instead."));
cromefire marked this conversation as resolved.
Show resolved Hide resolved

services.ConfigureOpenTelemetryTracerProvider((sp, builder) => this.services = null);

Expand Down Expand Up @@ -69,7 +70,8 @@ internal TracerProviderBuilderBase(IServiceCollection services)
TracerProvider? ITracerProviderBuilder.Provider => null;

/// <inheritdoc />
public override TracerProviderBuilder AddInstrumentation<TInstrumentation>(Func<TInstrumentation> instrumentationFactory)
public override TracerProviderBuilder AddInstrumentation<TInstrumentation>(
Func<TInstrumentation> instrumentationFactory)
{
Guard.ThrowIfNull(instrumentationFactory);

Expand Down Expand Up @@ -112,12 +114,23 @@ TracerProviderBuilder ITracerProviderBuilder.ConfigureServices(Action<IServiceCo
=> this.ConfigureServicesInternal(configure);

/// <inheritdoc />
TracerProviderBuilder IDeferredTracerProviderBuilder.Configure(Action<IServiceProvider, TracerProviderBuilder> configure)
TracerProviderBuilder IDeferredTracerProviderBuilder.Configure(
Action<IServiceProvider, TracerProviderBuilder> configure)
=> this.ConfigureBuilderInternal(configure);

internal TracerProvider InvokeBuild()
=> this.Build();

internal void Configure(Action<TracerProviderBuilder> configure)
{
this.ConfigureBuilderInternal((_, builder) => configure(builder));
}

internal void Configure(Action<TracerProviderBuilder, IServiceProvider> configure)
{
this.ConfigureBuilderInternal((sp, builder) => configure(builder, sp));
}

/// <summary>
/// Adds instrumentation to the provider.
/// </summary>d
Expand Down Expand Up @@ -154,7 +167,8 @@ protected TracerProvider Build()
{
if (!this.allowBuild)
{
throw new NotSupportedException("A TracerProviderBuilder bound to external service cannot be built directly. Access the TracerProvider using the application IServiceProvider instead.");
throw new NotSupportedException(
"A TracerProviderBuilder bound to external service cannot be built directly. Access the TracerProvider using the application IServiceProvider instead.");
}

var services = this.services;
Expand Down
22 changes: 22 additions & 0 deletions src/OpenTelemetry/Trace/Builder/TracerProviderBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,28 @@ public static TracerProviderBuilder ConfigureResource(this TracerProviderBuilder
return tracerProviderBuilder;
}

/// <summary>
/// Modify the <see cref="ResourceBuilder"/> from which the Resource associated with
/// this provider is built from in-place.
/// </summary>
/// <param name="tracerProviderBuilder"><see cref="TracerProviderBuilder"/>.</param>
/// <param name="configure">An action which modifies the provided <see cref="ResourceBuilder"/> in-place.</param>
/// <returns>Returns <see cref="TracerProviderBuilder"/> for chaining.</returns>
public static TracerProviderBuilder ConfigureResource(this TracerProviderBuilder tracerProviderBuilder, Action<ResourceBuilder, IServiceProvider> configure)
{
Guard.ThrowIfNull(configure);

tracerProviderBuilder.ConfigureBuilder((sp, builder) =>
{
if (builder is TracerProviderBuilderSdk tracerProviderBuilderSdk)
{
tracerProviderBuilderSdk.ConfigureResource(traceBuilder => configure(traceBuilder, sp));
}
});

return tracerProviderBuilder;
}

/// <summary>
/// Adds a processor to the provider.
/// </summary>
Expand Down