You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-11-29 23:07:45 +02:00
Restructure RegisterCallback method (#3587)
* Restructure RegisterCallback method Instead of accepting instruments to register the callback with as a slice, accept them as variadic arguments. * Add changes to changelog * Add PR number to changes
This commit is contained in:
@@ -200,7 +200,7 @@ func (m *meter) Float64ObservableGauge(name string, options ...instrument.Float6
|
||||
|
||||
// RegisterCallback registers the function f to be called when any of the
|
||||
// insts Collect method is called.
|
||||
func (m *meter) RegisterCallback(insts []instrument.Asynchronous, f metric.Callback) (metric.Registration, error) {
|
||||
func (m *meter) RegisterCallback(f metric.Callback, insts ...instrument.Asynchronous) (metric.Registration, error) {
|
||||
for _, inst := range insts {
|
||||
// Only register if at least one instrument has a non-drop aggregation.
|
||||
// Otherwise, calling f during collection will be wasted computation.
|
||||
|
||||
Reference in New Issue
Block a user