Skip to content

Commit

Permalink
[Instrumentation.AspNet] Remove AddAspNetInstrumentation with default…
Browse files Browse the repository at this point in the history
… parameter (#942)

Co-authored-by: Cijo Thomas <[email protected]>
  • Loading branch information
Kielek and cijothomas authored Jan 31, 2023
1 parent 9248719 commit cad8d76
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ OpenTelemetry.Instrumentation.AspNet.AspNetInstrumentationOptions.RecordExceptio
OpenTelemetry.Metrics.MeterProviderBuilderExtensions
OpenTelemetry.Trace.TracerProviderBuilderExtensions
static OpenTelemetry.Metrics.MeterProviderBuilderExtensions.AddAspNetInstrumentation(this OpenTelemetry.Metrics.MeterProviderBuilder builder) -> OpenTelemetry.Metrics.MeterProviderBuilder
static OpenTelemetry.Trace.TracerProviderBuilderExtensions.AddAspNetInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder, System.Action<OpenTelemetry.Instrumentation.AspNet.AspNetInstrumentationOptions> configureAspNetInstrumentationOptions = null) -> OpenTelemetry.Trace.TracerProviderBuilder
static OpenTelemetry.Trace.TracerProviderBuilderExtensions.AddAspNetInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder) -> OpenTelemetry.Trace.TracerProviderBuilder
static OpenTelemetry.Trace.TracerProviderBuilderExtensions.AddAspNetInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder, System.Action<OpenTelemetry.Instrumentation.AspNet.AspNetInstrumentationOptions> configure) -> OpenTelemetry.Trace.TracerProviderBuilder
3 changes: 3 additions & 0 deletions src/OpenTelemetry.Instrumentation.AspNet/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

* Removes `AddAspNetInstrumentation` method with default configure parameter.
([#942](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/942))

## 1.0.0-rc9.7

Released 2022-Nov-28
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,24 @@ public static class TracerProviderBuilderExtensions
/// Enables the incoming requests automatic data collection for ASP.NET.
/// </summary>
/// <param name="builder"><see cref="TracerProviderBuilder"/> being configured.</param>
/// <param name="configureAspNetInstrumentationOptions">ASP.NET Request configuration options.</param>
/// <returns>The instance of <see cref="TracerProviderBuilder"/> to chain the calls.</returns>
public static TracerProviderBuilder AddAspNetInstrumentation(this TracerProviderBuilder builder) =>
AddAspNetInstrumentation(builder, configure: null);

/// <summary>
/// Enables the incoming requests automatic data collection for ASP.NET.
/// </summary>
/// <param name="builder"><see cref="TracerProviderBuilder"/> being configured.</param>
/// <param name="configure">ASP.NET Request configuration options.</param>
/// <returns>The instance of <see cref="TracerProviderBuilder"/> to chain the calls.</returns>
public static TracerProviderBuilder AddAspNetInstrumentation(
this TracerProviderBuilder builder,
Action<AspNetInstrumentationOptions> configureAspNetInstrumentationOptions = null)
Action<AspNetInstrumentationOptions> configure)
{
Guard.ThrowIfNull(builder);

var aspnetOptions = new AspNetInstrumentationOptions();
configureAspNetInstrumentationOptions?.Invoke(aspnetOptions);
configure?.Invoke(aspnetOptions);

builder.AddInstrumentation(() => new AspNetInstrumentation(aspnetOptions));
builder.AddSource(TelemetryHttpModule.AspNetSourceName);
Expand Down

0 comments on commit cad8d76

Please sign in to comment.