mirror of
https://github.com/docker/compose.git
synced 2026-10-12 02:13:08 +00:00
feat(tracing): surface otel shutdown errors via --debug
OTel SDK/exporter errors already go through docker/cli's own otel.SetErrorHandler(debug.OTELErrorHandler), installed by the plugin framework at startup. Our own handler, installed at package init time, was always clobbered before any command ran (plugin.Run() sets its handler after all inits execute), so it never had any effect - verified by tracing the exact call order and reproducing the flag behavior against a built binary. Drop that dead handler along with the COMPOSE_OTEL_DEBUG env var it introduced. The one genuinely-discarded error (the tracer shutdown/flush error in wrapRunE) now goes through logrus like everything else in the codebase: it's already gated by --debug/-D via logrus's own level, so no explicit check is needed. Signed-off-by: hiroto.toyoda <[email protected]>
This commit is contained in:
committed by
Guillaume Lours
parent
d0c384aeae
commit
1ebdc06c18
@@ -26,6 +26,7 @@ import (
|
||||
|
||||
dockercli "github.com/docker/cli/cli"
|
||||
"github.com/docker/cli/cli/command"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/spf13/cobra"
|
||||
flag "github.com/spf13/pflag"
|
||||
"go.opentelemetry.io/otel"
|
||||
@@ -110,9 +111,9 @@ func wrapRunE(c *cobra.Command, cmdSpan trace.Span, tracingShutdown tracing.Shut
|
||||
// been canceled already
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond)
|
||||
defer cancel()
|
||||
// TODO(milas): add an env var to enable logging from the
|
||||
// OTel components for debugging purposes
|
||||
_ = tracingShutdown(ctx)
|
||||
if err := tracingShutdown(ctx); err != nil {
|
||||
logrus.WithError(err).Debug("otel: shutdown error")
|
||||
}
|
||||
}
|
||||
return cmdErr
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user