feat(sdk-metrics-base): meter identity#2901
Conversation
569a402 to
af786dd
Compare
Codecov Report
@@ Coverage Diff @@
## main #2901 +/- ##
==========================================
+ Coverage 92.48% 92.51% +0.03%
==========================================
Files 151 151
Lines 4841 4848 +7
Branches 1022 1024 +2
==========================================
+ Hits 4477 4485 +8
+ Misses 364 363 -1
|
| const meterCollectionPromises = Array.from(this._sharedState.meterSharedStates.values()) | ||
| .map(meterSharedState => meterSharedState.collect(this, collectionTime)); |
There was a problem hiding this comment.
Random trivia: Array.from(states.values(), state => state.collect(this, collectionTime)); would be shorter, but benched it for fun and found that Array.from(states.values()).map(state => state.collect(this, collectionTime)); is ~4x faster on Node.js 🤷♂️
experimental/packages/opentelemetry-sdk-metrics-base/src/state/MeterProviderSharedState.ts
Outdated
Show resolved
Hide resolved
|
@dyladan updated, please take a look again :) |
dyladan
left a comment
There was a problem hiding this comment.
Looks good but I think my second suggestion for changelog wording was actually more accurate than the first. The implementation looks fine to me though.
|
@dyladan now that the implementation does return the same meter object on identical input, the changelog entry should be fine I think? As the "shared internal state" is not exposed to end-users, I'd find your first suggestion is good though. |
I missed the |
|
thank you for reviewing :) |
Which problem is this PR solving?
As spec defines:
Also said:
So we need to not create a new MeterSharedState when a given name+version+schemaUrl pair is already created in the MeterProvider.
Fixes Partial #2593
Short description of the changes
Type of change
How Has This Been Tested?
Checklist: