Skip to content

Commit

Permalink
tracing/plugin: newTracer: ignore context.Canceled errors on Close()
Browse files Browse the repository at this point in the history
Before this, containerd would always print an error when shutting down;

    ERRO[2023-12-07T14:35:00.070333131Z] failed to close plugin                        error="context canceled" id=io.containerd.internal.v1.tracing

Signed-off-by: Sebastiaan van Stijn <[email protected]>
  • Loading branch information
thaJeztah committed Dec 18, 2023
1 parent 2c8a996 commit 2213854
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tracing/plugin/otlp.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package plugin

import (
"context"
"errors"
"fmt"
"io"
"net/url"
Expand Down Expand Up @@ -66,7 +67,7 @@ func init() {
TraceSamplingRatio: 1.0,
},
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
//get TracingProcessorPlugin which is a dependency
// get TracingProcessorPlugin which is a dependency
plugins, err := ic.GetByType(plugins.TracingProcessorPlugin)
if err != nil {
return nil, fmt.Errorf("failed to get tracing processors: %w", err)
Expand Down Expand Up @@ -178,13 +179,12 @@ func newTracer(ctx context.Context, config *TraceConfig, procs []trace.SpanProce

return &closer{close: func() error {
for _, p := range procs {
if err := p.Shutdown(ctx); err != nil {
if err := p.Shutdown(ctx); err != nil && !errors.Is(err, context.Canceled) {
return err
}
}
return nil
}}, nil

}

// Returns a composite TestMap propagator
Expand Down

0 comments on commit 2213854

Please sign in to comment.