opentelemetry-go
opentelemetry-go copied to clipboard
fix callback err not return
for _, c := range p.callbacks {
// TODO make the callbacks parallel. ( #3034 )
if e := c(ctx); e != nil {
err = errors.Join(err, e)
}
if err := ctx.Err(); err != nil {
rm.Resource = nil
clear(rm.ScopeMetrics) // Erase elements to let GC collect objects.
rm.ScopeMetrics = rm.ScopeMetrics[:0]
return err
}
}
for e := p.multiCallbacks.Front(); e != nil; e = e.Next() {
// TODO make the callbacks parallel. ( #3034 )
f := e.Value.(multiCallback)
if e := f(ctx); e != nil {
err = errors.Join(err, e)
}
if err := ctx.Err(); err != nil {
// This means the context expired before we finished running callbacks.
rm.Resource = nil
clear(rm.ScopeMetrics) // Erase elements to let GC collect objects.
rm.ScopeMetrics = rm.ScopeMetrics[:0]
return err
}
}
if ctx.Err() is not nil, the c(ctx) err is not return
The committers listed above are authorized under a signed CLA.
- :white_check_mark: login: NameHaibinZhang / name: Zhanghaibin (9e8fd1416f2fc15de36fbd03b1be8481117341fd)
Thank you for the PR.
Can you add a changelog entry and add a unit tests to cover these cases?
Thank you for the PR.
Can you add a changelog entry and add a unit tests to cover these cases?
ok,i will add test
@NameHaibinZhang, are you able to work on this PR?
Superseded by https://github.com/open-telemetry/opentelemetry-go/pull/6914.