diff --git a/cmd/cmdtrace/cmd_span.go b/cmd/cmdtrace/cmd_span.go index cce3e5db3f3..a08a158b480 100644 --- a/cmd/cmdtrace/cmd_span.go +++ b/cmd/cmdtrace/cmd_span.go @@ -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 } diff --git a/internal/tracing/errors.go b/internal/tracing/errors.go deleted file mode 100644 index 9fa615054c0..00000000000 --- a/internal/tracing/errors.go +++ /dev/null @@ -1,29 +0,0 @@ -/* - Copyright 2023 Docker Compose CLI authors - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package tracing - -import ( - "go.opentelemetry.io/otel" -) - -// skipErrors is a no-op otel.ErrorHandler. -type skipErrors struct{} - -// Handle does nothing, ignoring any errors passed to it. -func (skipErrors) Handle(_ error) {} - -var _ otel.ErrorHandler = skipErrors{} diff --git a/internal/tracing/tracing.go b/internal/tracing/tracing.go index 85325dbea0f..ffb68ec9746 100644 --- a/internal/tracing/tracing.go +++ b/internal/tracing/tracing.go @@ -40,8 +40,6 @@ import ( func init() { detect.ServiceName = "compose" - // do not log tracing errors to stdio - otel.SetErrorHandler(skipErrors{}) } // OTLPConfig contains the necessary values to initialize an OTLP client