diff --git a/OpenTelemetry.sln b/OpenTelemetry.sln index c9a9a4c3f6f..e4f84237718 100644 --- a/OpenTelemetry.sln +++ b/OpenTelemetry.sln @@ -272,6 +272,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{A49299 src\Shared\RequestMethodHelper.cs = src\Shared\RequestMethodHelper.cs src\Shared\ResourceSemanticConventions.cs = src\Shared\ResourceSemanticConventions.cs src\Shared\SemanticConventions.cs = src\Shared\SemanticConventions.cs + src\Shared\SignalVersionHelper.cs = src\Shared\SignalVersionHelper.cs src\Shared\SpanAttributeConstants.cs = src\Shared\SpanAttributeConstants.cs src\Shared\SpanHelper.cs = src\Shared\SpanHelper.cs src\Shared\StatusHelper.cs = src\Shared\StatusHelper.cs diff --git a/src/Shared/SignalVersionHelper.cs b/src/Shared/SignalVersionHelper.cs new file mode 100644 index 00000000000..37f65ba6001 --- /dev/null +++ b/src/Shared/SignalVersionHelper.cs @@ -0,0 +1,14 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +using System.Reflection; + +namespace OpenTelemetry.Instrumentation; + +internal static class SignalVersionHelper +{ + public static string GetVersion() + { + return typeof(T).Assembly.GetCustomAttribute()!.InformationalVersion.Split('+')[0]; + } +}