-
Notifications
You must be signed in to change notification settings - Fork 896
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
MetricProducers are passed via config to MetricReaders instead of RegisterProducer #3613
Conversation
93b927e
to
aa8f120
Compare
aa8f120
to
ef9fd5c
Compare
ef9fd5c
to
25a6902
Compare
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.
LGTM.
25a6902
to
d430aa1
Compare
So the "RegisterProducer" is actually a mechanical thing for how Java passes the metric producer TO a metric reader. Effectively, in Java we do something like:
This allows the SDK to hide the details of the internal
This has some problematic aspects, e.g. right now as I'd suggest we find a way to achieve the following two goals:
As such, I'd suggest leaving RegisterProducer, but providing additional |
I don't think this is necessarily true. Java (and Go) can continue to use the register functions to register the SDK as they do today. All this does is leave the register function unspecified (as it was before metric producers were in the spec), and require the ability to provide MetricProducers when constructing a MetricReader. You are more than welcome to implement the config option using register(). Here is my bad attempt at a partial prototype in java. |
…rough a RegisterProducer operation
909f0cf
to
d273ea7
Compare
@jsuereth Here is a more complete java prototype: open-telemetry/opentelemetry-java#5678 |
As long as we're under this shared understanding, I'm on board with this. It's probably worth it to keep the existing language on MetricReader#RegisterProducer method, but as a "MAY". |
I think it might need more changes to make sense. FWIW, I didn't implement registerProducer(Producer) in my java PoC (although I could have). The MetricProducers are passed via configuration: https://github.com/open-telemetry/opentelemetry-java/pull/5678/files#diff-afaf4d9b0605df68781d9b9befbaa9950b6f79c4c39a757a8efab8d18e82d6ecR74. The |
Fixes #3611
Changes
This change moves the registration of MetricProducers from a RegisterProducer function to a configuration option on the MetricReader.
The only potentially breaking impact of this change is that a user can no longer register new MetricProducers after the MetricReader is created. For example, it wouldn't be possible to dynamically register new MetricProducers. I don't know of any use-cases for this.
Explanation
Since it isn't feasible for JS to implement the spec as currently written, so we need to at least allow passing MetricProducers as config instead of via RegisterProducer.
However, it would be best if we had a consistent implantation across languages, and when I prototyped using configuration in Go, it simplified the implementation, and improved the user experience.
Given that both Go and JS would prefer to have them passed as configuration, rather than registration, and no other prototypes or implementations exist, I think it makes more sense to adapt the specification to require using configuration.
History
The RegisterProducer method was originally proposed and discussed here: #2722 (comment). I've spoken with the author after reviewing the prototype, and we both agree that configuration is actually a better way to pass MetricProducers.