You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Asynchronous instruments have associated callback functions which are responsible for reporting Measurements.
Other than this statement, which is repeated in a few places, the only normative statements made about a recording API for these instruments is in how these callbacks care associated with the instruments
The API MUST support creation of asynchronous instruments by passing zero or more callback functions to be permanently registered to the newly created instrument.
The API SHOULD support registration of callback functions associated with asynchronous instruments after they are created.
Callbacks registered at the time of instrument creation MUST apply to the single instruments which is under construction.
Callbacks registered after the time of instrument creation MAY be associated with multiple instruments.
Multiple-instrument Callbacks MUST be associated at the time of registration with a declared set of asynchronous instruments from the same Meter instance.
There is no mention of a direct way to record an observation with an Observer method.
The metric API specification goes further to say how these Callbacks should be defined:
It is RECOMMENDED that the API authors use one of the following forms for the callback function:
The list (or tuple, etc.) returned by the callback function contains (Instrument, Measurement) pairs.
the Observable Result parameter receives an additional (Instrument, Measurement) pairs
Additionally...
Idiomatic APIs for multiple-instrument Callbacks MUST distinguish the instrument associated with each observed Measurement value.
Specifically here, the specification is requiring explicit association of a registered instrument to a Measurement and it makes a recommendation on how to achieve this with a returned list or result parameter. It specifically does not say that even within a callback an Observe method must, should, or even may be called.
The text was updated successfully, but these errors were encountered:
The asynchronous
Gauge
s,UpDownCounter
s, andCounter
s all currently export anObserve
method. This is unneeded once #3584 is merged.This method should be removed for the following reasons...
It is not used by an OTel user for any valid operation
For a single instrument callback, the appropriate
*Observer
type is used to record a measurement.opentelemetry-go/metric/instrument/asyncfloat64.go
Lines 61 to 73 in f941b3a
opentelemetry-go/metric/instrument/asyncint64.go
Lines 62 to 74 in f941b3a
And for a multi-instrument measurement, the
Observer
type is used once #3584 is merged.opentelemetry-go/metric/meter.go
Lines 109 to 121 in a562252
If an OTel user calls this method it will only ever error
opentelemetry-go/sdk/metric/instrument.go
Lines 241 to 251 in a562252
The specification does not specify this method
As stated in the metric API specification:
Other than this statement, which is repeated in a few places, the only normative statements made about a recording API for these instruments is in how these callbacks care associated with the instruments
There is no mention of a direct way to record an observation with an
Observer
method.The metric API specification goes further to say how these
Callback
s should be defined:Additionally...
Specifically here, the specification is requiring explicit association of a registered instrument to a
Measurement
and it makes a recommendation on how to achieve this with a returned list or result parameter. It specifically does not say that even within a callback anObserve
method must, should, or even may be called.The text was updated successfully, but these errors were encountered: