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

[Resources.OperatingSystem] Add a fallback mechanism for build.id #2047

Conversation

ysolomchenko
Copy link
Contributor

Changes

Add a fallback mechanism for build.id in the OS detector

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)

@github-actions github-actions bot requested review from Kielek and lachmatt September 9, 2024 08:11
@github-actions github-actions bot added the comp:resources.operatingsystem Things related to OpenTelemetry.Resources.OperatingSystem label Sep 9, 2024
@ysolomchenko ysolomchenko marked this pull request as ready for review September 9, 2024 08:12
@ysolomchenko ysolomchenko requested a review from a team September 9, 2024 08:12
Copy link

codecov bot commented Sep 9, 2024

Codecov Report

Attention: Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.

Project coverage is 77.20%. Comparing base (71655ce) to head (feed0e6).
Report is 408 commits behind head on main.

Files with missing lines Patch % Lines
...sources.OperatingSystem/OperatingSystemDetector.cs 87.50% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2047      +/-   ##
==========================================
+ Coverage   73.91%   77.20%   +3.29%     
==========================================
  Files         267        3     -264     
  Lines        9615      136    -9479     
==========================================
- Hits         7107      105    -7002     
+ Misses       2508       31    -2477     
Flag Coverage Δ
unittests-Resources.OperatingSystem 77.20% <87.50%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...sources.OperatingSystem/OperatingSystemDetector.cs 82.25% <87.50%> (ø)

... and 269 files with indirect coverage changes

string? buildIdContent = null;
if (buildId.IsEmpty)
{
buildIdContent = File.ReadAllText(this.kernelOsRelease!).Trim();
Copy link
Contributor

Choose a reason for hiding this comment

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

What if kernelOsRelease is null? Should it be verified?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If kernelOsRelease is null, it should be considered a special case. In practice, kernelOsRelease would only be null if constructor used for testing explicitly sets it to null. In default scenarios, it will never be null. Therefore, I don't believe it's necessary to include a check for null in this case.

@Kielek Kielek changed the title Add a fallback mechanism for build.id in the OS detector [Resources.OperatingSystem] Add a fallback mechanism for build.id Sep 9, 2024
@Kielek Kielek merged commit 00e30cd into open-telemetry:main Sep 9, 2024
61 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:resources.operatingsystem Things related to OpenTelemetry.Resources.OperatingSystem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants