From af3e76e7dd3cdaa6ba2161cb158d9c13e27e5379 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= Date: Tue, 2 Apr 2024 08:49:12 +0200 Subject: [PATCH] Instrumentation.GrpcNetClient --- src/OpenTelemetry.Instrumentation.GrpcNetClient/CHANGELOG.md | 3 +++ .../Implementation/GrpcClientDiagnosticListener.cs | 4 ++-- .../OpenTelemetry.Instrumentation.GrpcNetClient.csproj | 1 + .../GrpcTests.client.cs | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/OpenTelemetry.Instrumentation.GrpcNetClient/CHANGELOG.md b/src/OpenTelemetry.Instrumentation.GrpcNetClient/CHANGELOG.md index 4eba089688b..51c94f3f83a 100644 --- a/src/OpenTelemetry.Instrumentation.GrpcNetClient/CHANGELOG.md +++ b/src/OpenTelemetry.Instrumentation.GrpcNetClient/CHANGELOG.md @@ -2,6 +2,9 @@ ## Unreleased +* `ActivitySource.Version` is set to NuGet package version. + ([#5498](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5498)) + ## 1.7.0-beta.1 Released 2024-Feb-09 diff --git a/src/OpenTelemetry.Instrumentation.GrpcNetClient/Implementation/GrpcClientDiagnosticListener.cs b/src/OpenTelemetry.Instrumentation.GrpcNetClient/Implementation/GrpcClientDiagnosticListener.cs index 0804f57363b..bf7ecb60734 100644 --- a/src/OpenTelemetry.Instrumentation.GrpcNetClient/Implementation/GrpcClientDiagnosticListener.cs +++ b/src/OpenTelemetry.Instrumentation.GrpcNetClient/Implementation/GrpcClientDiagnosticListener.cs @@ -16,8 +16,8 @@ internal sealed class GrpcClientDiagnosticListener : ListenerHandler { internal static readonly AssemblyName AssemblyName = typeof(GrpcClientDiagnosticListener).Assembly.GetName(); internal static readonly string ActivitySourceName = AssemblyName.Name; - internal static readonly Version Version = AssemblyName.Version; - internal static readonly ActivitySource ActivitySource = new(ActivitySourceName, Version.ToString()); + internal static readonly string Version = SignalVersionHelper.GetVersion(); + internal static readonly ActivitySource ActivitySource = new(ActivitySourceName, Version); private const string OnStartEvent = "Grpc.Net.Client.GrpcOut.Start"; private const string OnStopEvent = "Grpc.Net.Client.GrpcOut.Stop"; diff --git a/src/OpenTelemetry.Instrumentation.GrpcNetClient/OpenTelemetry.Instrumentation.GrpcNetClient.csproj b/src/OpenTelemetry.Instrumentation.GrpcNetClient/OpenTelemetry.Instrumentation.GrpcNetClient.csproj index 48d9c8e5e65..1e21d2b1c68 100644 --- a/src/OpenTelemetry.Instrumentation.GrpcNetClient/OpenTelemetry.Instrumentation.GrpcNetClient.csproj +++ b/src/OpenTelemetry.Instrumentation.GrpcNetClient/OpenTelemetry.Instrumentation.GrpcNetClient.csproj @@ -14,6 +14,7 @@ + diff --git a/test/OpenTelemetry.Instrumentation.Grpc.Tests/GrpcTests.client.cs b/test/OpenTelemetry.Instrumentation.Grpc.Tests/GrpcTests.client.cs index 3799ef73a7f..f06eb5a6fcc 100644 --- a/test/OpenTelemetry.Instrumentation.Grpc.Tests/GrpcTests.client.cs +++ b/test/OpenTelemetry.Instrumentation.Grpc.Tests/GrpcTests.client.cs @@ -435,7 +435,7 @@ public void Grpc_BadArgs() private static void ValidateGrpcActivity(Activity activityToValidate) { Assert.Equal(GrpcClientDiagnosticListener.ActivitySourceName, activityToValidate.Source.Name); - Assert.Equal(GrpcClientDiagnosticListener.Version.ToString(), activityToValidate.Source.Version); + Assert.Equal(GrpcClientDiagnosticListener.Version, activityToValidate.Source.Version); Assert.Equal(ActivityKind.Client, activityToValidate.Kind); } }