Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discard otel errors #5193

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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())
Comment on lines +240 to +244
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have to set global ErrorHandler and Logger before we create the tracer providers.


Check warning on line 245 in pkg/app/piped/cmd/piped/piped.go

View check run for this annotation

Codecov / codecov/patch

pkg/app/piped/cmd/piped/piped.go#L243-L245

Added lines #L243 - L245 were not covered by tests
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
Loading