Skip to content

Commit

Permalink
batchSpanProcessor.ForceFlush noop when ctx is canceled
Browse files Browse the repository at this point in the history
  • Loading branch information
pellared committed Jul 26, 2023
1 parent 0c8d9fa commit 1533304
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sdk/trace/batch_span_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ func (f forceFlushSpan) SpanContext() trace.SpanContext {

// ForceFlush exports all ended spans that have not yet been exported.
func (bsp *batchSpanProcessor) ForceFlush(ctx context.Context) error {
// Interrupt if context is already canceled.
if err := ctx.Err(); err != nil {
return err
}

// Do nothing after Shutdown.
if bsp.stopped.Load() {
return nil
Expand Down

0 comments on commit 1533304

Please sign in to comment.