opentelemetry-js
opentelemetry-js copied to clipboard
fix(sdk-metrics): fix duplicated registration of metrics for collectors
Which problem is this PR solving?
Fixes https://github.com/open-telemetry/opentelemetry-js/issues/3472
Short description of the changes
- Fixes that
MetricStorageRegistry.findOrUpdateCompatibleCollectorStoragealways returnsundefined, which leads to duplicated registration of metric storage for a collector.
Type of change
- [x] Bug fix (non-breaking change which fixes an issue)
How Has This Been Tested?
- [x] Verified that
MetricStorageRegistry.findOrUpdateCompatibleCollectorStoragereturns the expected value.
Checklist:
- [x] Followed the style guidelines of this project
- [x] Unit tests have been added
Codecov Report
Merging #3488 (c54ba3b) into main (93222fc) will not change coverage. The diff coverage is
100.00%.
Additional details and impacted files
@@ Coverage Diff @@
## main #3488 +/- ##
=======================================
Coverage 93.78% 93.78%
=======================================
Files 249 249
Lines 7610 7610
Branches 1587 1587
=======================================
Hits 7137 7137
Misses 473 473
| Impacted Files | Coverage Δ | |
|---|---|---|
| ...ges/sdk-metrics/src/state/MetricStorageRegistry.ts | 96.49% <100.00%> (+1.75%) |
:arrow_up: |
| ...emetry-core/src/platform/node/RandomIdGenerator.ts | 87.50% <0.00%> (-6.25%) |
:arrow_down: |
Simpler than expected fix