opentelemetry-js icon indicating copy to clipboard operation
opentelemetry-js copied to clipboard

fix(sdk-metrics): fix duplicated registration of metrics for collectors

Open legendecas opened this issue 2 years ago • 2 comments

Which problem is this PR solving?

Fixes https://github.com/open-telemetry/opentelemetry-js/issues/3472

Short description of the changes

  • Fixes that MetricStorageRegistry.findOrUpdateCompatibleCollectorStorage always returns undefined, 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.findOrUpdateCompatibleCollectorStorage returns the expected value.

Checklist:

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

legendecas avatar Dec 15 '22 07:12 legendecas

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:

codecov[bot] avatar Dec 15 '22 07:12 codecov[bot]

Simpler than expected fix

dyladan avatar Dec 15 '22 17:12 dyladan