Skip to content

Commit d688d3b

Browse files
milasndeloof
authored andcommitted
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 <[email protected]>
1 parent f414bf7 commit d688d3b

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

internal/tracing/tracing.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,9 @@ func InitProvider(dockerCli command.Cli) (ShutdownFunc, error) {
115115
}
116116

117117
muxExporter := MuxExporter{exporters: exporters}
118-
sp := sdktrace.NewSimpleSpanProcessor(muxExporter)
119118
tracerProvider := sdktrace.NewTracerProvider(
120-
sdktrace.WithSampler(sdktrace.AlwaysSample()),
121119
sdktrace.WithResource(res),
122-
sdktrace.WithSpanProcessor(sp),
120+
sdktrace.WithBatcher(muxExporter),
123121
)
124122
otel.SetTracerProvider(tracerProvider)
125123

0 commit comments

Comments
 (0)