You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-11-27 22:49:15 +02:00
Redesign RegisterCallback API (#3584)
* Update RegisterCallback and Callback declerations RegisterCallback accepts variadic Asynchronous instruments instead of a slice. Callback accepts an observation result recorder to ensure instruments that are observed by a callback. * Update global, noop, SDK implementations * Fix examples * Add changes to changelog * Test RegisterCallback for invalid observers * Test callbacks from foreign sources not collected * Support registering delegating instruments
This commit is contained in:
@@ -54,7 +54,7 @@ func TestEmptyPipeline(t *testing.T) {
|
||||
})
|
||||
|
||||
require.NotPanics(t, func() {
|
||||
pipe.addMultiCallback(emptyCallback)
|
||||
pipe.addMultiCallback(func(context.Context) error { return nil })
|
||||
})
|
||||
|
||||
output, err = pipe.produce(context.Background())
|
||||
@@ -78,7 +78,7 @@ func TestNewPipeline(t *testing.T) {
|
||||
})
|
||||
|
||||
require.NotPanics(t, func() {
|
||||
pipe.addMultiCallback(emptyCallback)
|
||||
pipe.addMultiCallback(func(context.Context) error { return nil })
|
||||
})
|
||||
|
||||
output, err = pipe.produce(context.Background())
|
||||
@@ -121,7 +121,7 @@ func TestPipelineConcurrency(t *testing.T) {
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
pipe.addMultiCallback(emptyCallback)
|
||||
pipe.addMultiCallback(func(context.Context) error { return nil })
|
||||
}()
|
||||
}
|
||||
wg.Wait()
|
||||
|
||||
Reference in New Issue
Block a user