From 52a03b11aef3b75fdeaa4dd0fe8e9b1d71ea4e0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= Date: Tue, 30 Jan 2024 02:30:48 +0100 Subject: [PATCH] Rename GrpcClientInstrumentationOptions to GrpcClientTraceInstrumentationOptions (#5272) Co-authored-by: Alan West <3676547+alanwest@users.noreply.github.com> --- .../.publicApi/PublicAPI.Unshipped.txt | 20 +++++++++---------- .../CHANGELOG.md | 3 +++ .../GrpcClientInstrumentation.cs | 2 +- ... GrpcClientTraceInstrumentationOptions.cs} | 2 +- .../GrpcClientDiagnosticListener.cs | 4 ++-- .../TracerProviderBuilderExtensions.cs | 10 +++++----- .../GrpcTests.client.cs | 4 ++-- 7 files changed, 24 insertions(+), 21 deletions(-) rename src/OpenTelemetry.Instrumentation.GrpcNetClient/{GrpcClientInstrumentationOptions.cs => GrpcClientTraceInstrumentationOptions.cs} (96%) diff --git a/src/OpenTelemetry.Instrumentation.GrpcNetClient/.publicApi/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Instrumentation.GrpcNetClient/.publicApi/PublicAPI.Unshipped.txt index db708294cc8..32e717dc82b 100644 --- a/src/OpenTelemetry.Instrumentation.GrpcNetClient/.publicApi/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry.Instrumentation.GrpcNetClient/.publicApi/PublicAPI.Unshipped.txt @@ -1,12 +1,12 @@ -OpenTelemetry.Instrumentation.GrpcNetClient.GrpcClientInstrumentationOptions -OpenTelemetry.Instrumentation.GrpcNetClient.GrpcClientInstrumentationOptions.EnrichWithHttpRequestMessage.get -> System.Action -OpenTelemetry.Instrumentation.GrpcNetClient.GrpcClientInstrumentationOptions.EnrichWithHttpRequestMessage.set -> void -OpenTelemetry.Instrumentation.GrpcNetClient.GrpcClientInstrumentationOptions.EnrichWithHttpResponseMessage.get -> System.Action -OpenTelemetry.Instrumentation.GrpcNetClient.GrpcClientInstrumentationOptions.EnrichWithHttpResponseMessage.set -> void -OpenTelemetry.Instrumentation.GrpcNetClient.GrpcClientInstrumentationOptions.GrpcClientInstrumentationOptions() -> void -OpenTelemetry.Instrumentation.GrpcNetClient.GrpcClientInstrumentationOptions.SuppressDownstreamInstrumentation.get -> bool -OpenTelemetry.Instrumentation.GrpcNetClient.GrpcClientInstrumentationOptions.SuppressDownstreamInstrumentation.set -> void +OpenTelemetry.Instrumentation.GrpcNetClient.GrpcClientTraceInstrumentationOptions +OpenTelemetry.Instrumentation.GrpcNetClient.GrpcClientTraceInstrumentationOptions.EnrichWithHttpRequestMessage.get -> System.Action +OpenTelemetry.Instrumentation.GrpcNetClient.GrpcClientTraceInstrumentationOptions.EnrichWithHttpRequestMessage.set -> void +OpenTelemetry.Instrumentation.GrpcNetClient.GrpcClientTraceInstrumentationOptions.EnrichWithHttpResponseMessage.get -> System.Action +OpenTelemetry.Instrumentation.GrpcNetClient.GrpcClientTraceInstrumentationOptions.EnrichWithHttpResponseMessage.set -> void +OpenTelemetry.Instrumentation.GrpcNetClient.GrpcClientTraceInstrumentationOptions.GrpcClientTraceInstrumentationOptions() -> void +OpenTelemetry.Instrumentation.GrpcNetClient.GrpcClientTraceInstrumentationOptions.SuppressDownstreamInstrumentation.get -> bool +OpenTelemetry.Instrumentation.GrpcNetClient.GrpcClientTraceInstrumentationOptions.SuppressDownstreamInstrumentation.set -> void OpenTelemetry.Trace.TracerProviderBuilderExtensions static OpenTelemetry.Trace.TracerProviderBuilderExtensions.AddGrpcClientInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder) -> OpenTelemetry.Trace.TracerProviderBuilder -static OpenTelemetry.Trace.TracerProviderBuilderExtensions.AddGrpcClientInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder, string name, System.Action configure) -> OpenTelemetry.Trace.TracerProviderBuilder -static OpenTelemetry.Trace.TracerProviderBuilderExtensions.AddGrpcClientInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder, System.Action configure) -> OpenTelemetry.Trace.TracerProviderBuilder \ No newline at end of file +static OpenTelemetry.Trace.TracerProviderBuilderExtensions.AddGrpcClientInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder, string name, System.Action configure) -> OpenTelemetry.Trace.TracerProviderBuilder +static OpenTelemetry.Trace.TracerProviderBuilderExtensions.AddGrpcClientInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder, System.Action configure) -> OpenTelemetry.Trace.TracerProviderBuilder diff --git a/src/OpenTelemetry.Instrumentation.GrpcNetClient/CHANGELOG.md b/src/OpenTelemetry.Instrumentation.GrpcNetClient/CHANGELOG.md index 56946c1533e..66390b0daab 100644 --- a/src/OpenTelemetry.Instrumentation.GrpcNetClient/CHANGELOG.md +++ b/src/OpenTelemetry.Instrumentation.GrpcNetClient/CHANGELOG.md @@ -15,6 +15,9 @@ Now that this suite of attributes are stable, this instrumentation will only emit the new attributes. ([#5259](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5259)) +* **Breaking Change**: Renamed `GrpcClientInstrumentationOptions` to + `GrpcClientTraceInstrumentationOptions`. + ([#5272](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5272)) ## 1.6.0-beta.3 diff --git a/src/OpenTelemetry.Instrumentation.GrpcNetClient/GrpcClientInstrumentation.cs b/src/OpenTelemetry.Instrumentation.GrpcNetClient/GrpcClientInstrumentation.cs index 7c9ee1ffede..961ddc17749 100644 --- a/src/OpenTelemetry.Instrumentation.GrpcNetClient/GrpcClientInstrumentation.cs +++ b/src/OpenTelemetry.Instrumentation.GrpcNetClient/GrpcClientInstrumentation.cs @@ -16,7 +16,7 @@ internal sealed class GrpcClientInstrumentation : IDisposable /// Initializes a new instance of the class. /// /// Configuration options for Grpc client instrumentation. - public GrpcClientInstrumentation(GrpcClientInstrumentationOptions options = null) + public GrpcClientInstrumentation(GrpcClientTraceInstrumentationOptions options = null) { this.diagnosticSourceSubscriber = new DiagnosticSourceSubscriber(new GrpcClientDiagnosticListener(options), isEnabledFilter: null, GrpcInstrumentationEventSource.Log.UnknownErrorProcessingEvent); this.diagnosticSourceSubscriber.Subscribe(); diff --git a/src/OpenTelemetry.Instrumentation.GrpcNetClient/GrpcClientInstrumentationOptions.cs b/src/OpenTelemetry.Instrumentation.GrpcNetClient/GrpcClientTraceInstrumentationOptions.cs similarity index 96% rename from src/OpenTelemetry.Instrumentation.GrpcNetClient/GrpcClientInstrumentationOptions.cs rename to src/OpenTelemetry.Instrumentation.GrpcNetClient/GrpcClientTraceInstrumentationOptions.cs index 415bf8f0f71..b4cd871980b 100644 --- a/src/OpenTelemetry.Instrumentation.GrpcNetClient/GrpcClientInstrumentationOptions.cs +++ b/src/OpenTelemetry.Instrumentation.GrpcNetClient/GrpcClientTraceInstrumentationOptions.cs @@ -8,7 +8,7 @@ namespace OpenTelemetry.Instrumentation.GrpcNetClient; /// /// Options for GrpcClient instrumentation. /// -public class GrpcClientInstrumentationOptions +public class GrpcClientTraceInstrumentationOptions { /// /// Gets or sets a value indicating whether down stream instrumentation is suppressed (disabled). diff --git a/src/OpenTelemetry.Instrumentation.GrpcNetClient/Implementation/GrpcClientDiagnosticListener.cs b/src/OpenTelemetry.Instrumentation.GrpcNetClient/Implementation/GrpcClientDiagnosticListener.cs index 9ac826921d8..0804f57363b 100644 --- a/src/OpenTelemetry.Instrumentation.GrpcNetClient/Implementation/GrpcClientDiagnosticListener.cs +++ b/src/OpenTelemetry.Instrumentation.GrpcNetClient/Implementation/GrpcClientDiagnosticListener.cs @@ -25,9 +25,9 @@ internal sealed class GrpcClientDiagnosticListener : ListenerHandler private static readonly PropertyFetcher StartRequestFetcher = new("Request"); private static readonly PropertyFetcher StopResponseFetcher = new("Response"); - private readonly GrpcClientInstrumentationOptions options; + private readonly GrpcClientTraceInstrumentationOptions options; - public GrpcClientDiagnosticListener(GrpcClientInstrumentationOptions options) + public GrpcClientDiagnosticListener(GrpcClientTraceInstrumentationOptions options) : base("Grpc.Net.Client") { this.options = options; diff --git a/src/OpenTelemetry.Instrumentation.GrpcNetClient/TracerProviderBuilderExtensions.cs b/src/OpenTelemetry.Instrumentation.GrpcNetClient/TracerProviderBuilderExtensions.cs index 567bdb72c14..aa87988869c 100644 --- a/src/OpenTelemetry.Instrumentation.GrpcNetClient/TracerProviderBuilderExtensions.cs +++ b/src/OpenTelemetry.Instrumentation.GrpcNetClient/TracerProviderBuilderExtensions.cs @@ -27,11 +27,11 @@ public static TracerProviderBuilder AddGrpcClientInstrumentation(this TracerProv /// Enables gRPC client instrumentation. /// /// being configured. - /// Callback action for configuring . + /// Callback action for configuring . /// The instance of to chain the calls. public static TracerProviderBuilder AddGrpcClientInstrumentation( this TracerProviderBuilder builder, - Action configure) + Action configure) => AddGrpcClientInstrumentation(builder, name: null, configure); /// @@ -39,12 +39,12 @@ public static TracerProviderBuilder AddGrpcClientInstrumentation( /// /// being configured. /// Name which is used when retrieving options. - /// Callback action for configuring . + /// Callback action for configuring . /// The instance of to chain the calls. public static TracerProviderBuilder AddGrpcClientInstrumentation( this TracerProviderBuilder builder, string name, - Action configure) + Action configure) { Guard.ThrowIfNull(builder); @@ -60,7 +60,7 @@ public static TracerProviderBuilder AddGrpcClientInstrumentation( return builder.AddInstrumentation(sp => { - var options = sp.GetRequiredService>().Get(name); + var options = sp.GetRequiredService>().Get(name); return new GrpcClientInstrumentation(options); }); diff --git a/test/OpenTelemetry.Instrumentation.Grpc.Tests/GrpcTests.client.cs b/test/OpenTelemetry.Instrumentation.Grpc.Tests/GrpcTests.client.cs index 35fd982a7bd..3799ef73a7f 100644 --- a/test/OpenTelemetry.Instrumentation.Grpc.Tests/GrpcTests.client.cs +++ b/test/OpenTelemetry.Instrumentation.Grpc.Tests/GrpcTests.client.cs @@ -413,9 +413,9 @@ public void AddGrpcClientInstrumentationNamedOptionsSupported() using var tracerProvider = Sdk.CreateTracerProviderBuilder() .ConfigureServices(services => { - services.Configure(o => defaultExporterOptionsConfigureOptionsInvocations++); + services.Configure(o => defaultExporterOptionsConfigureOptionsInvocations++); - services.Configure("Instrumentation2", o => namedExporterOptionsConfigureOptionsInvocations++); + services.Configure("Instrumentation2", o => namedExporterOptionsConfigureOptionsInvocations++); }) .AddGrpcClientInstrumentation() .AddGrpcClientInstrumentation("Instrumentation2", configure: null)