-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Describe the current state
#63 introduced Asynchronous Instruments.
Those are collected in Meter as "ObservableXXX" instrument types and dispatched to the right implementation under Instrument
.
As initially introduced in the PR, the DX to consume these instrument is a little weird because users aren't expected to consume the returned instance of any ObservableInstrument.
Only Meter
should access them: they'll be "scraped" when MetricReader
collects data from the Meter, invoking their callbacks through measurementsData
.
The only operation that should be user-facing is managing callbacks.
While we have a registerCallback
method on each Async Instrument, we don't have a way to un-register callbacks, which is indicated in the OTel spec.
Describe the desired state
To simplify and improve the way Async Instruments are consumed, I think we have 2 options:
- remove entirely the return type from
Meter.createObservableXYZ
: this makes the Async Instrument inaccessible outside of the Meter - change the design, treat the Observable Instruments as separate from Instrument
Whichever is taken, a functionality to remove callbacks from Async Instrument should be planned and added.