-
Notifications
You must be signed in to change notification settings - Fork 888
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
Clarify whether multiple callbacks are allowed for async instruments #2249
Comments
It seems this statement in the spec is clear, do we expect to "have more clarification" or "change the behavior"?
I can see problems, the API spec allows optional parameters to be added in the future, which might break Java's implementation. |
I actually was the one who misinterpreted this (when first approving the PR and then when implementing). I think this is far too restrictive as written and really diverges from
We need to define instrument identity. If we add new parameters that alter instrument identity, we're likely causing user-friction/breakages. I'd like to understand what sorts of parameters we'd add (that alter metric identity) that are non-breaking for other implementations. |
Resolved in #2317. |
What are you trying to achieve?
Clarify behavior of metrics API / SDK when multiple callbacks are registered to the same instrument. The api spec says:
In java, we interpret that as meaning that you can't register conflicting instruments under the same name. However, if the instrument type, name, unit, and description match, we'll return the previously registered instrument.
For example, in the following snippet, no error is generated and
counter1
andcounter2
are the instrument.This makes sense for synchronous instruments, but its not clear what to do in the async case. Currently, if multiple callbacks are registered for the same instrument, we silently ignore registrations after the first. This isn't great, and minimally we should log an error when subsequent callbacks are registered. However, there's also an argument to made that registering multiple callbacks should be allowed and should result in each being invoked.
This has been raised in Issue #4051 and we believe it needs raising in the spec for resolution.
In particular, we want to make sure that our plans to publish a stable version of the metrics API would not be impacted by the spec resolution of this issue.
Additional context.
Issue #4005 aims to log a warning when multiple callbacks are registered, and is implemented in Issue #4020.
The text was updated successfully, but these errors were encountered: