-
Notifications
You must be signed in to change notification settings - Fork 829
[sdk-logs] Include instrumentation version in debug log #6074
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
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 <[email protected]>
This PR was marked stale due to lack of activity and will be closed in 7 days. Commenting or pushing will instruct the bot to automatically remove the label. This bot runs once per day. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6074 +/- ##
==========================================
- Coverage 86.40% 86.40% -0.01%
==========================================
Files 257 257
Lines 11656 11655 -1
==========================================
- Hits 10071 10070 -1
Misses 1585 1585
|
Closed as inactive. Feel free to reopen if this PR is still being worked on. |
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