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

suggestion: CARGO_BIN_NAME instead of unknown_service as default serv… #991

Merged
merged 3 commits into from
Mar 12, 2023

Conversation

danielschaffel
Copy link
Contributor

closes #942

@danielschaffel danielschaffel requested a review from a team March 12, 2023 01:17
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Mar 12, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: danielschaffel (9eb9a49)

@codecov
Copy link

codecov bot commented Mar 12, 2023

Codecov Report

Patch coverage: 100.0% and no project coverage change.

Comparison is base (af21bea) 69.9% compared to head (90c5e7d) 69.9%.

Additional details and impacted files
@@          Coverage Diff          @@
##            main    #991   +/-   ##
=====================================
  Coverage   69.9%   69.9%           
=====================================
  Files        116     116           
  Lines       8920    8922    +2     
=====================================
+ Hits        6237    6245    +8     
+ Misses      2683    2677    -6     
Impacted Files Coverage Δ
opentelemetry-sdk/src/resource/env.rs 90.0% <100.0%> (+0.2%) ⬆️

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@hdost hdost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! can you please update the comment docs on the SdkProvidedResourceDetector struct so that it matches the functionality as its is no longer using doing the provided steps?

@djc
Copy link
Contributor

djc commented Mar 12, 2023

Please note that there is a difference between env!("CARGO_BIN_NAME") and env::var("CARGO_BIN_NAME"). The former gets the binary name at compile-time through a variable set by Cargo, while the former gets the value of the environment variable at run-time. IMO the former is useful for this, but the latter isn't.

@danielschaffel
Copy link
Contributor Author

From what I understand using env!("CARGO_BIN_NAME") would make it impossible to build and test the opentelemetry-sdk package. This is because it is a lib not a bin so this method will always fail and cause an error. I chose to use option_env and not add a test because I don't know how I would test something that only happens when building the package as part of a library.

Copy link
Contributor

@hdost hdost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again I apologize for missing this on the first review 😔

@TommyCpp TommyCpp merged commit ac5d1e0 into open-telemetry:main Mar 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

suggestion: use env!("CARGO_BIN_NAME") instead of "unknown_service" as default service name
4 participants