global
v1.47.0
Documentation
pkg.go.dev ↗Package global provides the OpenTelemetry global API.
Functions
Debug
func Debug(msg string, keysAndValues ...any)
Debug prints messages about all internal changes in the API or SDK.
Error
func Error(err error, msg string, keysAndValues ...any)
Error prints messages about exceptional states of the API or SDK.
GetLogger
func GetLogger() logr.Logger
GetLogger returns the global logger.
Info
func Info(msg string, keysAndValues ...any)
Info prints messages about the general state of the API or SDK. This should usually be less than 5 messages a minute.
LoggerProvider
func LoggerProvider() log.LoggerProvider
LoggerProvider is the internal implementation for global.LoggerProvider.
MeterProvider
func MeterProvider() metric.MeterProvider
MeterProvider is the internal implementation for global.MeterProvider.
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.
SetLogger
func SetLogger(l logr.Logger)
SetLogger sets the global Logger to l.
To see Warn messages use a logger with `l.V(1).Enabled() == true` To see Info messages use a logger with `l.V(4).Enabled() == true` To see Debug messages use a logger with `l.V(8).Enabled() == true`.
SetLoggerProvider
func SetLoggerProvider(provider log.LoggerProvider)
SetLoggerProvider is the internal implementation for global.SetLoggerProvider.
SetMeterProvider
func SetMeterProvider(mp metric.MeterProvider)
SetMeterProvider is the internal implementation for global.SetMeterProvider.
SetTextMapPropagator
func SetTextMapPropagator(p propagation.TextMapPropagator)
SetTextMapPropagator is the internal implementation for global.SetTextMapPropagator.
SetTracerProvider
func SetTracerProvider(tp trace.TracerProvider)
SetTracerProvider is the internal implementation for global.SetTracerProvider.
TextMapPropagator
func TextMapPropagator() propagation.TextMapPropagator
TextMapPropagator is the internal implementation for global.TextMapPropagator.
TracerProvider
func TracerProvider() trace.TracerProvider
TracerProvider is the internal implementation for global.TracerProvider.
Warn
func Warn(msg string, keysAndValues ...any)
Warn prints messages about warnings in the API or SDK. Not an error but is likely more important than an informational event.
Types
ErrDelegator
type ErrDelegator = errorhandler.ErrDelegator
ErrDelegator is an alias for errorhandler.ErrDelegator, kept for backward compatibility with existing callers of internal/global.
ErrorHandler
type ErrorHandler = errorhandler.ErrorHandler
ErrorHandler is an alias for errorhandler.ErrorHandler, kept for backward compatibility with existing callers of internal/global.
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.