Skip to content

Commit 8288929

Browse files
authored
Update the RegisterCallback of the SDK meter (#3604)
1 parent 697bc18 commit 8288929

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

sdk/metric/meter.go

+10-2
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,16 @@ func (m *meter) Float64ObservableGauge(name string, options ...instrument.Float6
205205
return inst, nil
206206
}
207207

208-
// RegisterCallback registers the function f to be called when any of the
209-
// insts Collect method is called.
208+
// RegisterCallback registers f to be called each collection cycle so it will
209+
// make observations for insts during those cycles.
210+
//
211+
// The only instruments f can make observations for are insts. All other
212+
// observations will be dropped and an error will be logged.
213+
//
214+
// Only instruments from this meter can be registered with f, an error is
215+
// returned if other instrument are provided.
216+
//
217+
// The returned Registration can be used to unregister f.
210218
func (m *meter) RegisterCallback(f metric.Callback, insts ...instrument.Asynchronous) (metric.Registration, error) {
211219
if len(insts) == 0 {
212220
// Don't allocate a observer if not needed.

0 commit comments

Comments
 (0)