From 48b2fee75c5929f9ede045d2c9941f778c7244e3 Mon Sep 17 00:00:00 2001 From: Mikhail Mazurskiy Date: Wed, 11 Sep 2024 11:16:13 +1000 Subject: [PATCH] Allow GC to collect exported spans --- sdk/trace/batch_span_processor.go | 1 + 1 file changed, 1 insertion(+) diff --git a/sdk/trace/batch_span_processor.go b/sdk/trace/batch_span_processor.go index 1d399a75db2f..bdb27b9c7bfa 100644 --- a/sdk/trace/batch_span_processor.go +++ b/sdk/trace/batch_span_processor.go @@ -280,6 +280,7 @@ func (bsp *batchSpanProcessor) exportSpans(ctx context.Context) error { // // It is up to the exporter to implement any type of retry logic if a batch is failing // to be exported, since it is specific to the protocol and backend being sent to. + clear(bsp.batch) // Let GC collect objects bsp.batch = bsp.batch[:0] if err != nil {