-
Notifications
You must be signed in to change notification settings - Fork 465
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
feat: export SDK crate version as constant #2504
base: main
Are you sure you want to change the base?
feat: export SDK crate version as constant #2504
Conversation
The committers listed above are authorized under a signed CLA. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2504 +/- ##
=====================================
Coverage 77.9% 77.9%
=====================================
Files 123 123
Lines 22887 22887
=====================================
Hits 17838 17838
Misses 5049 5049 ☔ View full report in Codecov by Sentry. |
|
||
/// The crate's version string, useful for populating [`Resource`] keys like | ||
/// [`telemetry.sdk.version`](https://docs.rs/opentelemetry-semantic-conventions/latest/opentelemetry_semantic_conventions/attribute/constant.TELEMETRY_SDK_VERSION.html) | ||
pub const VERSION: &str = env!("CARGO_PKG_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.
we try to keep public API as lean as possible, so unless there is a strong reason to expose this, we should not.
Users rarely need this as this is automatically populated.
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.
Thanks for your interest in contributing to the project!
I've requested changes. Please see https://github.com/open-telemetry/opentelemetry-rust/pull/2504/files#r1913817079
Changes
PR adds a simple constant for the SDK crate's version (pulled directly from the crate's manifest [ref]).
This is specifically useful in conjunction with things like populating the value of
telemetry.sdk.version
when building aResource
(for example).Merge requirement checklist
N/A
Unit tests added/updated (if applicable)N/A
AppropriateCHANGELOG.md
files updated for non-trivial, user-facing changesN/A
Changes in public API reviewed (if applicable)