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

feat(sdk-node): add HostDetector as default resource detector #4566

Merged
merged 4 commits into from
Mar 25, 2024

Conversation

maryliag
Copy link
Contributor

@maryliag maryliag commented Mar 21, 2024

Which problem is this PR solving?

Host resources were not being set by default when initializing node SDK with NodeSDK.

Fixes #4282

Short description of the changes

  • Add HostDetector to the list of default resource detectors
  • Add test to make sure host and process values are being set by default
  • Update from deprecated sdk.detectResources() to sdk.start() on tests
  • Update from deprecated SemanticResourceAttributes.SERVICE_NAME to SEMRESATTRS_SERVICE_NAME on SDK file

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Tested manually
  • New test added to sdk.test.ts

Checklist:

  • Followed the style guidelines of this project
  • Unit tests have been added

@maryliag maryliag requested a review from a team as a code owner March 21, 2024 14:31
Copy link

codecov bot commented Mar 21, 2024

Codecov Report

Merging #4566 (8d7eb42) into main (fec6286) will decrease coverage by 0.02%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4566      +/-   ##
==========================================
- Coverage   92.85%   92.84%   -0.02%     
==========================================
  Files         328      328              
  Lines        9494     9494              
  Branches     2040     2040              
==========================================
- Hits         8816     8815       -1     
- Misses        678      679       +1     
Files Coverage Δ
...imental/packages/opentelemetry-sdk-node/src/sdk.ts 92.42% <100.00%> (-0.76%) ⬇️

Fixes open-telemetry#4282

- Add `HostDetector` to the list of default resource detectors
- Add test to make sure host and process values are being set by default
- Update from deprecated `sdk.detectResources()` to `sdk.start()` on tests
- Update from deprecated `SemanticResourceAttributes.SERVICE_NAME` to `SEMRESATTRS_SERVICE_NAME` on SDK file
Copy link
Contributor

@trentm trentm left a comment

Choose a reason for hiding this comment

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

Nice. LGTM.

I'll wait for a day at least before merging to give others a chance to comment, and as I find my comfort zone with https://github.com/open-telemetry/opentelemetry-js/blob/main/CONTRIBUTING.md#general-merge-requirements

],
});
sdk.detectResources();
sdk.start();
Copy link
Contributor

Choose a reason for hiding this comment

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

This was solely to resolve a deprecation warning, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right!

@pichlermarc pichlermarc changed the title feat(node-sdk): add HostDetector as default resource detector feat(sdk-node): add HostDetector as default resource detector Mar 25, 2024
Copy link
Member

@pichlermarc pichlermarc left a comment

Choose a reason for hiding this comment

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

Looks good, just one changelog nit. 🙂

@pichlermarc
Copy link
Member

pichlermarc commented Mar 25, 2024

Ah sorry about that - I broke lint when resolving the conflict 😞
Merging now 🙂

@pichlermarc pichlermarc merged commit 97af8e6 into open-telemetry:main Mar 25, 2024
20 checks passed
@maryliag maryliag deleted the add-host-detector branch March 25, 2024 16:10
@maryliag
Copy link
Contributor Author

Thank you both for the reviews! 😄

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.

[sdk-node] add HostDetector to the list of default resource detectors
3 participants