Skip to content

Commit

Permalink
Discard otel errors (#5193)
Browse files Browse the repository at this point in the history
Signed-off-by: Shinnosuke Sawada-Dazai <shin@warashi.dev>
  • Loading branch information
Warashi authored Sep 6, 2024
1 parent 3994f61 commit ac32fda
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pkg/app/piped/cmd/piped/piped.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,18 +237,19 @@ func (p *piped) run(ctx context.Context, input cli.Input) (runErr error) {
return err
}

// if control plane's flag monitoring.enabled is false, otel provider logs errors.
// it's no problem but we don't want to see it.
// so we discard the errors and the logs.
otel.SetErrorHandler(otel.ErrorHandlerFunc(func(err error) {}))
otel.SetLogger(logr.Discard())

tracerProvider, err := p.createTracerProvider(ctx, cfg.APIAddress, cfg.ProjectID, cfg.PipedID, pipedKey)
if err != nil {
input.Logger.Error("failed to create tracer provider", zap.Error(err))
return err
}
otel.SetTracerProvider(tracerProvider)

// if control plane's flag monitoring.enabled is false, otel provider logs errors.
// it's no problem but we don't want to see it.
// so we discard the logger.
otel.SetLogger(logr.Discard())

// Send the newest piped meta to the control-plane.
if err := p.sendPipedMeta(ctx, apiClient, cfg, input.Logger); err != nil {
input.Logger.Error("failed to report piped meta to control-plane", zap.Error(err))
Expand Down

0 comments on commit ac32fda

Please sign in to comment.