mirror of
https://github.com/docker/cli.git
synced 2026-11-12 15:53:52 -04:00
cli/command: disable retries for the OTLP exporters
The CLI flushes traces and metrics at exit with a 50ms timeout (ExportTimeout). The OTLP gRPC exporters were created with the default retry policy, so when the endpoint refuses the connection the export keeps backing off until the timeout expires instead of returning. This happens on every command when the current context points at a unix socket that has no listener, for example Docker Desktop's context while Desktop is not running, which leaves its analytics socket file behind. A retry cannot complete within 50ms anyway, so turn retries off. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Signed-off-by: Alexandre Zollinger Chohfi <alzollin@microsoft.com>
This commit is contained in:
co-authored by
Copilot App
parent
7c0f1b261a
commit
a5d7547c39
@@ -99,6 +99,10 @@ func dockerSpanExporter(ctx context.Context, cli Cli) []sdktrace.TracerProviderO
|
||||
|
||||
opts := []otlptracegrpc.Option{
|
||||
otlptracegrpc.WithEndpoint(endpoint),
|
||||
// The whole export is bounded by ExportTimeout, which is too short for a retry
|
||||
// backoff to complete. With retries on, a refused connection (for example a stale
|
||||
// Docker Desktop socket) waits out the full timeout instead of failing right away.
|
||||
otlptracegrpc.WithRetry(otlptracegrpc.RetryConfig{Enabled: false}),
|
||||
}
|
||||
if !secure {
|
||||
opts = append(opts, otlptracegrpc.WithInsecure())
|
||||
@@ -120,6 +124,7 @@ func dockerMetricExporter(ctx context.Context, cli Cli) []sdkmetric.Option {
|
||||
|
||||
opts := []otlpmetricgrpc.Option{
|
||||
otlpmetricgrpc.WithEndpoint(endpoint),
|
||||
otlpmetricgrpc.WithRetry(otlpmetricgrpc.RetryConfig{Enabled: false}),
|
||||
}
|
||||
if !secure {
|
||||
opts = append(opts, otlpmetricgrpc.WithInsecure())
|
||||
|
||||
Reference in New Issue
Block a user