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

[Instrumentation.Hangfire] drop default parameter from registration method #1129

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Expand Up @@ -5,4 +5,5 @@ OpenTelemetry.Trace.HangfireInstrumentationOptions.HangfireInstrumentationOption
OpenTelemetry.Trace.HangfireInstrumentationOptions.RecordException.get -> bool
OpenTelemetry.Trace.HangfireInstrumentationOptions.RecordException.set -> void
OpenTelemetry.Trace.TracerProviderBuilderExtensions
static OpenTelemetry.Trace.TracerProviderBuilderExtensions.AddHangfireInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder, System.Action<OpenTelemetry.Trace.HangfireInstrumentationOptions> configureHangfireInstrumentationOptions = null) -> OpenTelemetry.Trace.TracerProviderBuilder
static OpenTelemetry.Trace.TracerProviderBuilderExtensions.AddHangfireInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder) -> OpenTelemetry.Trace.TracerProviderBuilder
static OpenTelemetry.Trace.TracerProviderBuilderExtensions.AddHangfireInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder, System.Action<OpenTelemetry.Trace.HangfireInstrumentationOptions> configure) -> OpenTelemetry.Trace.TracerProviderBuilder
2 changes: 2 additions & 0 deletions src/OpenTelemetry.Instrumentation.Hangfire/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

* Update OTel API version to `1.4.0`.
([#1038](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1038))
* Removes `AddHangfireInstrumentation` method with default configure default parameter.
([#1129](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1129))

## 1.0.0-beta.4

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,25 @@ public static class TracerProviderBuilderExtensions
/// Adds Hangfire instrumentation to the tracer provider.
/// </summary>
/// <param name="builder"><see cref="TracerProviderBuilder"/> being configured.</param>
/// <param name="configureHangfireInstrumentationOptions">Callback action for configuring <see cref="HangfireInstrumentationOptions"/>.</param>
/// <returns>The instance of <see cref="TracerProviderBuilder"/> to chain the calls.</returns>
public static TracerProviderBuilder AddHangfireInstrumentation(
this TracerProviderBuilder builder) =>
AddHangfireInstrumentation(builder, configure: null);

/// <summary>
/// Adds Hangfire instrumentation to the tracer provider.
/// </summary>
/// <param name="builder"><see cref="TracerProviderBuilder"/> being configured.</param>
/// <param name="configure">Callback action for configuring <see cref="HangfireInstrumentationOptions"/>.</param>
/// <returns>The instance of <see cref="TracerProviderBuilder"/> to chain the calls.</returns>
public static TracerProviderBuilder AddHangfireInstrumentation(
this TracerProviderBuilder builder,
Action<HangfireInstrumentationOptions> configureHangfireInstrumentationOptions = null)
Action<HangfireInstrumentationOptions> configure)
{
Guard.ThrowIfNull(builder);

var options = new HangfireInstrumentationOptions();
configureHangfireInstrumentationOptions?.Invoke(options);
configure?.Invoke(options);

Hangfire.GlobalJobFilters.Filters.Add(new HangfireInstrumentationJobFilterAttribute(options));

Expand Down