-
Notifications
You must be signed in to change notification settings - Fork 812
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
fix(sdk-node): use warn instead of error on unknown OTEL_NODE_RESOURCE_DETECTORS values #5034
fix(sdk-node): use warn instead of error on unknown OTEL_NODE_RESOURCE_DETECTORS values #5034
Conversation
…CTORS values as per issue open-telemetry#4882. I referenced the OpenTelemetry specification document, which clarified that diag.warn should be used for unrecognized values that don't critically break the system.
Hi @matschaffer @weyert this PR is ready for review |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5034 +/- ##
==========================================
- Coverage 93.39% 93.27% -0.13%
==========================================
Files 46 317 +271
Lines 712 8194 +7482
Branches 120 1640 +1520
==========================================
+ Hits 665 7643 +6978
- Misses 47 551 +504
|
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.
@RichardChukwu thanks for fixing this 🙂
I took the liberty to change the PR title. Please also add a changelog entry in ./experimental/CHANGELOG.md
(can be categorized as a bugfix) then we can merge this 🙂
bugfix changelog entry
@pichlermarc "I've added the changelog entry as requested. Let me know if anything else is needed. Thanks!" |
Thanks for the approval @maryliag |
e0e2b4a
Which problem is this PR solving?
This PR addresses the issue #4882, which involves logging an unrecognized OTEL_NODE_RESOURCE_DETECTORS value. According to the OpenTelemetry specification, unrecognized enum values should generate a warning rather than an error. The current implementation uses diag.error to log this issue, but it should use diag.warn instead to align with the specification and avoid unnecessary error-level logging.
Fixes: #4882
Short description of the changes
Updated opentelemetry-sdk-node/src/utils.ts and auto-instrumentations-node/src/utils.ts to replace diag.error with diag.warn for handling unrecognized OTEL_NODE_RESOURCE_DETECTORS values.
This change ensures that unrecognized values generate a warning, as specified in the OpenTelemetry SDK environment variable guidelines.
Type of change
Bug fix (non-breaking change which fixes an issue)
How Has This Been Tested?
Ran the existing test suite using npm test to confirm that all tests pass successfully.
Manually verified that unrecognized OTEL_NODE_RESOURCE_DETECTORS values log a warning instead of an error.
Checklist:
Followed the style guidelines of this project
Unit tests have been added (if applicable)
Documentation has been updated where necessary