Skip to content

Commit

Permalink
disable otel error logging
Browse files Browse the repository at this point in the history
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
  • Loading branch information
tonistiigi committed Jun 16, 2021
1 parent 9717e62 commit c676959
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmd/buildctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@ import (
"github.com/moby/buildkit/version"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
"go.opentelemetry.io/otel"
)

func init() {
apicaps.ExportedProduct = "buildkit"

stack.SetVersionInfo(version.Version, version.Revision)

// do not log tracing errors to stdio
otel.SetErrorHandler(skipErrors{})
}

func main() {
Expand Down Expand Up @@ -122,3 +126,7 @@ func handleErr(debug bool, err error) {
}
os.Exit(1)
}

type skipErrors struct{}

func (skipErrors) Handle(err error) {}
9 changes: 9 additions & 0 deletions cmd/buildkitd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import (
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/propagation"
"go.opentelemetry.io/otel/trace"
"golang.org/x/sync/errgroup"
Expand All @@ -66,6 +67,10 @@ func init() {
apicaps.ExportedProduct = "buildkit"
stack.SetVersionInfo(version.Version, version.Revision)

// OTEL error handling is broken https://github.com/open-telemetry/opentelemetry-go/pull/1851
// remove this with otel update
otel.SetErrorHandler(skipErrors{})

seed.WithTimeAndRand()
reexec.Init()
}
Expand Down Expand Up @@ -749,3 +754,7 @@ type constTracerProvider struct {
func (tp constTracerProvider) Tracer(instrumentationName string, opts ...trace.TracerOption) trace.Tracer {
return tp.tracer
}

type skipErrors struct{}

func (skipErrors) Handle(err error) {}

0 comments on commit c676959

Please sign in to comment.