feat(sdk-node)!: do not instantiate metrics SDK on empty metricReaders#6272
Merged
pichlermarc merged 3 commits intoopen-telemetry:mainfrom Jan 9, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6272 +/- ##
==========================================
- Coverage 95.40% 95.39% -0.01%
==========================================
Files 316 316
Lines 9568 9558 -10
Branches 2214 2210 -4
==========================================
- Hits 9128 9118 -10
Misses 440 440
🚀 New features to boost your workflow:
|
03da820 to
223fd02
Compare
cjihrig
reviewed
Jan 8, 2026
| if ( | ||
| this._meterProviderConfig?.readers && | ||
| // only register if there is a reader, otherwise we waste compute/memory. | ||
| this._meterProviderConfig.readers.length > 0 |
Contributor
There was a problem hiding this comment.
You could use optional chaining here and drop the first line of this check.
Member
Author
There was a problem hiding this comment.
yeah, I found the optional chaining to be a bit more difficult to read compared so I went with the other thing.
(this._meterProviderConfig?.readers?.length ?? 0) > 0
Contributor
There was a problem hiding this comment.
It looks like this didn't actually get changed.
JamieDanielson
approved these changes
Jan 8, 2026
Member
JamieDanielson
left a comment
There was a problem hiding this comment.
Small update in wording for the changelog (typo)
JacksonWeber
approved these changes
Jan 8, 2026
Co-authored-by: Jamie Danielson <jamiedanielson@honeycomb.io>
pichlermarc
commented
Jan 9, 2026
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?
There's currently no programmatic way to tell the SDK not to instantiate a Metrics SDK. For traces this can be done via
spanProcessors: []. We should follow the same behavior for metrics, wheremetricReaders: []-> instantiates no metrics SDK, no matter what's set inOTEL_METRICS_EXPORTERThis change is breaking only for users that use
metricReaders: []ANDOTEL_METRICS_EXPORTER=...at the same time.Ref #6092