telemetry

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMeter added in v0.2.1

func NewMeter(exporter metric.Exporter) func(context.Context) error

NewMeter - Creates new meter

func NewNoopMeter added in v0.2.1

func NewNoopMeter() omt.Meter

NewNoopMeter - Creates new noop meter

func NewTracer

func NewTracer(exporter trace.SpanExporter) func(context.Context) error

NewTracer - Creates new tracer

Types

type HandlerFn added in v0.9.6

type HandlerFn func(slog.Handler) slog.Handler

HandlerFn defines the handler used by slog.Handler as return value.

func NewOtelHandler added in v0.9.6

func NewOtelHandler(opts ...OtelHandlerOpt) HandlerFn

NewOtelHandler creates and returns a new HandlerFn, which wraps a handler with OtelHandler to use with log/slog.

type OtelHandler added in v0.9.6

type OtelHandler struct {
	// Next represents the next handler in the chain.
	Next slog.Handler
	// NoBaggage determines whether to add context baggage members to the log record.
	NoBaggage bool
	// NoTraceEvents determines whether to record an event for every log on the active trace.
	NoTraceEvents bool
}

func New added in v0.9.6

func New(next slog.Handler, opts ...OtelHandlerOpt) *OtelHandler

New creates a new OtelHandler to use with log/slog

func (OtelHandler) Enabled added in v0.9.6

func (h OtelHandler) Enabled(ctx context.Context, level slog.Level) bool

Enabled reports whether the logger emits log records at the given context and level. Note: We handover the decision down to the next handler.

func (OtelHandler) Handle added in v0.9.6

func (h OtelHandler) Handle(ctx context.Context, record slog.Record) error

Handle handles the provided log record and adds correlation between a slog record and an Open-Telemetry span.

func (OtelHandler) WithAttrs added in v0.9.6

func (h OtelHandler) WithAttrs(attrs []slog.Attr) slog.Handler

WithAttrs returns a new Otel whose attributes consists of handler's attributes followed by attrs.

func (OtelHandler) WithGroup added in v0.9.6

func (h OtelHandler) WithGroup(name string) slog.Handler

WithGroup returns a new Otel with a group, provided the group's name.

type OtelHandlerOpt added in v0.9.6

type OtelHandlerOpt func(handler *OtelHandler)

func WithNoBaggage added in v0.9.6

func WithNoBaggage(noBaggage bool) OtelHandlerOpt

WithNoBaggage returns an OtelHandlerOpt, which sets the NoBaggage flag

func WithNoTraceEvents added in v0.9.6

func WithNoTraceEvents(noTraceEvents bool) OtelHandlerOpt

WithNoTraceEvents returns an OtelHandlerOpt, which sets the NoTraceEvents flag

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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