otel

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package otel provides integration between containerd/log and OpenTelemetry.

In particular, it provides a hook that records log entries as events on active OpenTelemetry spans.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HookOpt

type HookOpt func(*LogrusHook)

func WithErrorStatusLevel

func WithErrorStatusLevel(level log.Level) HookOpt

WithErrorStatusLevel configures the minimum log level that marks the active span with an error status.

func WithLevel

func WithLevel(level log.Level) HookOpt

WithLevel configures the minimum log level handled by the hook. Entries below this level are ignored.

func WithTraceIDField

func WithTraceIDField(enabled bool) HookOpt

type LogrusHook

type LogrusHook struct {
	// contains filtered or unexported fields
}

LogrusHook is a logrus.Hook which adds logrus events to active spans. If the span is not recording or the span context is invalid, the hook is a no-op.

func NewLogrusHook

func NewLogrusHook(opts ...HookOpt) *LogrusHook

NewLogrusHook creates a new logrus hook

func (*LogrusHook) Fire

func (h *LogrusHook) Fire(entry *log.Entry) error

Fire is called when a log event occurs.

func (*LogrusHook) Levels

func (h *LogrusHook) Levels() []log.Level

Levels returns the logrus levels that this hook is interested in.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL