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.GrpNetClient, Instrumentation.SqlCliet] set ActivitySource.Version to NuGet package version #5498

Merged
merged 18 commits into from
Apr 9, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add behavior description for version logic
  • Loading branch information
Kielek committed Apr 4, 2024
commit 4294446cff57b068dc3ad85fd66f993e34bca490
5 changes: 5 additions & 0 deletions src/Shared/InstrumentationScopeHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ internal static class InstrumentationScopeHelper
{
public static string GetVersion<T>()
Kielek marked this conversation as resolved.
Show resolved Hide resolved
{
// 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`.
Kielek marked this conversation as resolved.
Show resolved Hide resolved
// For Scope version version without commit hash is returned.
Kielek marked this conversation as resolved.
Show resolved Hide resolved
return typeof(T).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()!.InformationalVersion.Split('+')[0];
Kielek marked this conversation as resolved.
Show resolved Hide resolved
}
}