refactor(opentelemetry-sdk-node): simplify calculation of traceExportersList#6132
Merged
maryliag merged 3 commits intoopen-telemetry:mainfrom Nov 19, 2025
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6132 +/- ##
==========================================
- Coverage 95.21% 95.21% -0.01%
==========================================
Files 316 316
Lines 9390 9389 -1
Branches 2168 2167 -1
==========================================
- Hits 8941 8940 -1
Misses 449 449
🚀 New features to boost your workflow:
|
maryliag
reviewed
Nov 19, 2025
Contributor
maryliag
left a comment
There was a problem hiding this comment.
Thank you for the changes, and you can remove the function completely, looking at the history, I can see it was created for this use case, and since is no longer needed, it's safe to remove it.
About your question regarding the none, you can ignore it, because I'm making changes to this package (and the config one) that will solve this problem.
maryliag
approved these changes
Nov 19, 2025
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which problem is this PR solving?
This simplifies a calculation by avoiding repeated work.
Fixes # N/A
Short description of the changes
filterBlanksAndNulls()callsmap()on an array of strings, andtrim()s each element. Then,filter()s out empty strings and the string'null'. However,traceExportersListis computed using the result ofgetStringListFromEnv(), which also trims and filters out empty strings. So, the only work that needs to be added here, is the filtering of'null'. This saves amap()loop and simplifies thefilter()call.This was the only call site of
filterBlanksAndNulls(). If it's OK, I can remove that function as well (it seems OK, but is exported fromutils.ts).I also noticed something that might be a bug related to the validation of
'none', but it almost seems intentional. IftraceExportersList[0] === 'none', thengetSpanProcessorsFromEnv()returns[]. However, there is separate validation logic for the case where'none'is mixed with other exporters. As the code is currently written, that second piece of validation logic would not catch the case where'none'is the first element intraceExportersList, but the list also contains other exporters. If this is a bug, I can fix it in a followup. If it's intentional, maybe a comment should be added.Type of change
None of these. Performance refactor.
How Has This Been Tested?
Checklist: