Skip to content

Commit

Permalink
fix(tracing): batch span exports to prevent blocking
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
milas authored and ndeloof committed Jan 17, 2024
1 parent f414bf7 commit d688d3b
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions internal/tracing/tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit d688d3b

Please sign in to comment.