package errorhandler
import "go.opentelemetry.io/otel/internal/errorhandler"
Package errorhandler provides the global error handler for OpenTelemetry.
This package has no OTel dependencies, allowing it to be imported by any package in the module without creating import cycles.
Index ¶
Functions ¶
func SetErrorHandler ¶
func SetErrorHandler(h ErrorHandler)
SetErrorHandler sets the global ErrorHandler to h.
The first time this is called all ErrorHandler previously returned from GetErrorHandler will send errors to h instead of the default logging ErrorHandler. Subsequent calls will set the global ErrorHandler, but not delegate errors to h.
Types ¶
type ErrDelegator ¶
type ErrDelegator struct {
// contains filtered or unexported fields
}
func (*ErrDelegator) Handle ¶
func (d *ErrDelegator) Handle(err error)
type ErrorHandler ¶
type ErrorHandler interface {
// Handle handles any error deemed irremediable by an OpenTelemetry
// component.
Handle(error)
}
ErrorHandler handles irremediable events.
func GetErrorHandler ¶
func GetErrorHandler() ErrorHandler
GetErrorHandler returns the global ErrorHandler instance.
The default ErrorHandler instance returned will log all errors to STDERR until an override ErrorHandler is set with SetErrorHandler. All ErrorHandler returned prior to this will automatically forward errors to the set instance instead of logging.
Subsequent calls to SetErrorHandler after the first will not forward errors to the new ErrorHandler for prior returned instances.
Source Files ¶
errorhandler.go
- Version
- v1.43.0 (latest)
- Published
- Apr 3, 2026
- Platform
- linux/amd64
- Imports
- 4 packages
- Last checked
- 3 hours ago –
Tools for package owners.