You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2026-06-03 18:35:08 +02:00
chore(sdk/trace): join errors properly (#8030)
Co-authored-by: Robert Pająk <pellared@hotmail.com>
This commit is contained in:
committed by
GitHub
parent
cb0de1f26c
commit
aff375ac62
@@ -303,14 +303,7 @@ func (p *TracerProvider) Shutdown(ctx context.Context) error {
|
||||
sps.state.Do(func() {
|
||||
err = sps.sp.Shutdown(ctx)
|
||||
})
|
||||
if err != nil {
|
||||
if retErr == nil {
|
||||
retErr = err
|
||||
} else {
|
||||
// Poor man's list of errors
|
||||
retErr = fmt.Errorf("%w; %w", retErr, err)
|
||||
}
|
||||
}
|
||||
retErr = errors.Join(retErr, err)
|
||||
}
|
||||
p.spanProcessors.Store(&spanProcessorStates{})
|
||||
return retErr
|
||||
|
||||
@@ -150,7 +150,7 @@ func TestFailedProcessorShutdown(t *testing.T) {
|
||||
|
||||
err := stp.Shutdown(t.Context())
|
||||
assert.Error(t, err)
|
||||
assert.Equal(t, err, spErr)
|
||||
assert.ErrorIs(t, err, spErr)
|
||||
assert.True(t, stp.isShutdown.Load())
|
||||
}
|
||||
|
||||
@@ -169,7 +169,8 @@ func TestFailedProcessorsShutdown(t *testing.T) {
|
||||
|
||||
err := stp.Shutdown(t.Context())
|
||||
assert.Error(t, err)
|
||||
assert.EqualError(t, err, "basic span processor shutdown failure1; basic span processor shutdown failure2")
|
||||
assert.ErrorIs(t, err, spErr1)
|
||||
assert.ErrorIs(t, err, spErr2)
|
||||
assert.True(t, sp1.closed)
|
||||
assert.True(t, sp2.closed)
|
||||
assert.True(t, stp.isShutdown.Load())
|
||||
|
||||
Reference in New Issue
Block a user