Documentation
¶
Index ¶
- func EndSpanWithError(span trace.Span, err error)
- func InitOtel(ctx context.Context, opts ...Option) (context.Context, func(context.Context) error, error)
- func IsExpectedError(err error) bool
- type Option
- func WithInitialLogFields(ilf map[string]interface{}) Option
- func WithInsecureOtelEndpoint(endpoint string) Option
- func WithLoggingDisabled() Option
- func WithOtelEndpoint(endpoint string, tlsCertPath string, tlsCert string) Option
- func WithServiceName(serviceName string) Option
- func WithTracingDisabled() Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EndSpanWithError ¶ added in v0.8.22
EndSpanWithError ends a span and records the error if it is non-nil and not an expected error. Expected errors (context cancellation, deadline exceeded) are recorded with an Unset status to avoid polluting error dashboards.
func InitOtel ¶
func InitOtel(ctx context.Context, opts ...Option) (context.Context, func(context.Context) error, error)
InitOtel initializes OpenTelemetry with the given configuration. It returns a function that can be called to shutdown OpenTelemetry.
func IsExpectedError ¶ added in v0.8.22
IsExpectedError returns true for errors that are expected during normal operation and should not be recorded as span errors.
Types ¶
type Option ¶ added in v0.2.90
type Option func(*otelConfig)
Option is a function that configures an otelConfig.
func WithInitialLogFields ¶ added in v0.2.90
WithInitialLogFields sets the log fields that will be added to all log messages.
func WithInsecureOtelEndpoint ¶ added in v0.2.90
WithInsecureOtelEndpoint sets the endpoint for both tracing and logging with insecure connection.
func WithLoggingDisabled ¶ added in v0.2.90
func WithLoggingDisabled() Option
WithLoggingDisabled disables logging.
func WithOtelEndpoint ¶ added in v0.2.90
WithOtelEndpoint sets the endpoint and TLS certificate for both tracing and logging.
func WithServiceName ¶ added in v0.2.90
WithServiceName sets the service name for the OpenTelemetry configuration.
func WithTracingDisabled ¶ added in v0.2.90
func WithTracingDisabled() Option
WithTracingDisabled disables tracing.