-
Notifications
You must be signed in to change notification settings - Fork 786
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
[sdk-logs] Include instrumentation version in debug log #6074
base: main
Are you sure you want to change the base?
[sdk-logs] Include instrumentation version in debug log #6074
Conversation
@@ -69,7 +69,7 @@ public LoggerProviderSdk( | |||
this.instrumentations.Add(instrumentation.Instance); | |||
} | |||
|
|||
instrumentationFactoriesAdded.Append(instrumentation.Name); | |||
instrumentationFactoriesAdded.Append($"{instrumentation.Name} {instrumentation.Version}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not against logging of the Version here. It is important to mention that it will be taking the version in this way typeof(TInstrumentation).Assembly.GetName().Version?.ToString() ?? "1.0.0.0"
. It means that it will be reporting only major version of the library in most cases (if the library follows this recomendation).
This version will be different than typical data reported by the contrib instrumentation packages https://github.com/open-telemetry/opentelemetry-dotnet-contrib/blob/89f0af731441a364779693a1874c57f33b1e721c/src/Shared/AssemblyVersionExtensions.cs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
want me to change it to not record if no version is found?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am telling that it usually will record 1.0.0.0/2.0.0.0/3.0.0.0,etc. There will be no differences between e.g. 1.1.0 nuget package and 1.2.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then shouldnt it default to use the AssemblyInformationalVersionAttribute it is exists?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For sure, it is one of the options, you can consider, and it should working for all contrib packages.
test/OpenTelemetry.Tests/Logs/LoggerProviderBuilderExtensionsTests.cs
Outdated
Show resolved
Hide resolved
…ests.cs Co-authored-by: Piotr Kiełkowicz <pkiekowicz@splunk.com>
Changes
Given Instrumentation version is being captured in AddInstrumentation
I assume the intent is to use it in the logs? So i added it there and added a test to assert it.
If u think Instrumentation version has no value in the logs, do you want another PR that removes the redundant version detection?
Merge requirement checklist
CHANGELOG.md
files updated for non-trivial changes