Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Kielek committed Apr 5, 2024
1 parent 7d538b2 commit 0e6b2ae
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion OpenTelemetry.sln
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{A49299
src\Shared\DiagnosticDefinitions.cs = src\Shared\DiagnosticDefinitions.cs
src\Shared\ExceptionExtensions.cs = src\Shared\ExceptionExtensions.cs
src\Shared\Guard.cs = src\Shared\Guard.cs
src\Shared\InstrumentationScopeHelper..cs = src\Shared\InstrumentationScopeHelper..cs
src\Shared\InstrumentationScopeHelper.cs = src\Shared\InstrumentationScopeHelper.cs
src\Shared\MathHelper.cs = src\Shared\MathHelper.cs
src\Shared\PeerServiceResolver.cs = src\Shared\PeerServiceResolver.cs
src\Shared\PeriodicExportingMetricReaderHelper.cs = src\Shared\PeriodicExportingMetricReaderHelper.cs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal sealed class GrpcClientDiagnosticListener : ListenerHandler
{
internal static readonly AssemblyName AssemblyName = typeof(GrpcClientDiagnosticListener).Assembly.GetName();
internal static readonly string ActivitySourceName = AssemblyName.Name;
internal static readonly string Version = InstrumentationScopeHelper.GetVersion<GrpcClientDiagnosticListener>();
internal static readonly string Version = InstrumentationScopeHelper.GetPackageVersion<GrpcClientDiagnosticListener>();
internal static readonly ActivitySource ActivitySource = new(ActivitySourceName, Version);

private const string OnStartEvent = "Grpc.Net.Client.GrpcOut.Start";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal sealed class SqlActivitySourceHelper

public static readonly AssemblyName AssemblyName = typeof(SqlActivitySourceHelper).Assembly.GetName();
public static readonly string ActivitySourceName = AssemblyName.Name;
public static readonly ActivitySource ActivitySource = new(ActivitySourceName, InstrumentationScopeHelper.GetVersion<SqlActivitySourceHelper>());
public static readonly ActivitySource ActivitySource = new(ActivitySourceName, InstrumentationScopeHelper.GetPackageVersion<SqlActivitySourceHelper>());
public static readonly string ActivityName = ActivitySourceName + ".Execute";

public static readonly IEnumerable<KeyValuePair<string, object>> CreationTags = new[]
Expand Down
8 changes: 4 additions & 4 deletions src/Shared/InstrumentationScopeHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ namespace OpenTelemetry.Instrumentation;

internal static class InstrumentationScopeHelper
{
public static string GetVersion<T>()
public static string GetPackageVersion<T>()
{
// MinVer https://github.com/adamralph/minver?tab=readme-ov-file#version-numbers
// together with Microsoft.SourceLink.GitHub https://github.com/dotnet/sourcelink
// fills tAssemblyInformationalVersionAttribute by
// `{NuGetPackageVersion}-{CommitHash}`, e.g. `1.7.0-beta.1.86+33d5521a73e881ac59d4bf1213765270ec2422ff`.
// For Scope version version without commit hash is returned.
// fills AssemblyInformationalVersionAttribute by
// `{NuGetPackageVersion}+{CommitHash}`, e.g. `1.7.0-beta.1.86+33d5521a73e881ac59d4bf1213765270ec2422ff`.
// For Scope version, value of AssemblyInformationalVersionAttribute without commit hash is returned.
return typeof(T).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()!.InformationalVersion.Split('+')[0];
}
}

0 comments on commit 0e6b2ae

Please sign in to comment.