-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add single instrument callback and split metric instrument configuration #3507
Conversation
Instead of having the same configuration for both the Synchronous and Asynchronous instruments, use specific options for both.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3507 +/- ##
=======================================
+ Coverage 78.7% 78.9% +0.2%
=======================================
Files 165 169 +4
Lines 12277 12435 +158
=======================================
+ Hits 9662 9814 +152
+ Misses 2417 2413 -4
- Partials 198 208 +10
|
Holding this as a draft until release v0.34.0 is made. |
Define callbacks to return the value observed. Because of the different types returned for different observables, the callbacks and options are move to the sync/async packages.
Return observations for distinct attr sets.
6affda3
to
ac57568
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.
code changes LGTM
Should we move file and directory naming from sync/async to ""/observer as well?
I'm okay with that, but what should we rename the sync packages to? |
I was also considering if we wanted to flatten the sync/async packages into the instrument package. Thoughts? |
I'm +1 to flattening.
My best suggestion is int64observableinstrument and int64instrument? Basically Int64ObservableCounter() would return an int64observableinstrument.Counter, and Int64Counter() returns int64instrument.Counter. But I think it would be moot if we flattened. |
@dashpole are you okay with flattening in a follow up PR? |
Yep, fine by me |
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.
We probably want to update the otel/metric asynchronous_single
example to use the new WithCallback Option. (An issue is fine)
If we are going to return errors with the individual callback, should we also look at returning an error with the multi-callback (via RegisterCallback
)? This would allow us to unify the logic under the hood to have a single collection of callbacks that need executing, because individual callbacks can be converted into multi-callbacks. (follow up is fine)
I'm also ok with flattening, even if this was counter to the original discussions we had a year ago that produced this design.
👍 I've opened #3572 and #3573 to track the example update and the multi-callback refactor. |
Add a
WithCallback
option for asynchronous instrumentsCloses #3451
The OpenTelemetry specification states:
This updates our implementation to conform with the specification.
Split instrument configuration specific number and async/sync combinations.
As discussed in #3451, the ideal callback design is...
In order to achieve this using the native Go type system the additional
Int64Option
,Float64Option
,Int64ObserverOption
, andFloat64ObserverOption
types are added for their respective instruments. Theinstrument.Option
remains to configure the unit and description of all instruments.