From a5d7547c39e93518e1c3cf56ec395b249d650385 Mon Sep 17 00:00:00 2001 From: Alexandre Zollinger Chohfi Date: Fri, 6 Nov 2026 11:00:59 -0800 Subject: [PATCH] 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 --- cli/command/telemetry_docker.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cli/command/telemetry_docker.go b/cli/command/telemetry_docker.go index a5f9b19aedc9..d84013d7b5e5 100644 --- a/cli/command/telemetry_docker.go +++ b/cli/command/telemetry_docker.go @@ -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())