-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(sdk-metrics)!: remove MeterProvider.addMetricReader() in favor of constructor option #4419
feat(sdk-metrics)!: remove MeterProvider.addMetricReader() in favor of constructor option #4419
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## next #4419 +/- ##
==========================================
+ Coverage 92.24% 92.27% +0.03%
==========================================
Files 332 332
Lines 9437 9436 -1
Branches 1999 1996 -3
==========================================
+ Hits 8705 8707 +2
+ Misses 732 729 -3
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we deprecate MeterProvider.addMetricReader
instead while adding the new constructor option? In this way, we can avoid breaking all users of the sdk-metrics and allow them to migrate to the new option.
Yes. This PR is targeting the |
@legendecas, I opened another PR that targets main just now: #4427 |
Oh, I see. Thank you for clarifying. I didn't notice the target branch 😅 |
Which problem is this PR solving?
Currently a
MetricReader
is added to aMeterProvider
viaaddMetricReader()
. As Meters (and through it instruments) can be created before adding aMetricReader
. This gives the false impression that the order of calls does not matter. This PR removes the addMetricReader() method in favor of a constructor option as it is the case for most SDKs:MetricReader
after building theMeterProvider
MetricReader
after building theMeterProvider
MetricReader
is respected.MeterProvider
is not possibleAn alternative would be to allow adding a
MetricReader
like in the current interface, but re-configuring all instruments, their aggregations, assocaited views and their temporality. This however, is not required by the spec and would drastically increase complexity of an already very complex Metrics SDK.Fixes #4112
References #open-telemetry/opentelemetry-js-contrib#1900
Short description of the changes
Type of change
How Has This Been Tested?