From d688d3bf22f262445a9c61aa98250c1b3f830657 Mon Sep 17 00:00:00 2001 From: Milas Bowman Date: Wed, 17 Jan 2024 14:35:08 -0500 Subject: [PATCH] fix(tracing): batch span exports to prevent blocking This was a bad configuration (my fault) that meant each span was exported synchronously, as it ended. That can cause weird behavior such as stuttering/blocking. There's really no reason to NOT use the batch processor, it's the recommended way to configure it. In the future, it might make sense to tune the intervals based on the fact that Compose is a CLI vs a long-running server app, but we handle flushing out on exit already, so it's not a huge deal. Signed-off-by: Milas Bowman --- internal/tracing/tracing.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/internal/tracing/tracing.go b/internal/tracing/tracing.go index 505f0b248e8..5fdf6b0bdab 100644 --- a/internal/tracing/tracing.go +++ b/internal/tracing/tracing.go @@ -115,11 +115,9 @@ func InitProvider(dockerCli command.Cli) (ShutdownFunc, error) { } muxExporter := MuxExporter{exporters: exporters} - sp := sdktrace.NewSimpleSpanProcessor(muxExporter) tracerProvider := sdktrace.NewTracerProvider( - sdktrace.WithSampler(sdktrace.AlwaysSample()), sdktrace.WithResource(res), - sdktrace.WithSpanProcessor(sp), + sdktrace.WithBatcher(muxExporter), ) otel.SetTracerProvider(tracerProvider)