tel

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: MIT Imports: 39 Imported by: 0

Documentation

Overview

Package tel provides OpenTelemetry integration for observability.

This file implements logging functionality with multi-handler support, combining standard slog handlers with OpenTelemetry bridges.

Package tel contains opentelemetry helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuiltinAttributeFlatStrings

func BuiltinAttributeFlatStrings() lists.List[string]

func BuiltinAttributeStrings

func BuiltinAttributeStrings() lists.List[string]

func BuiltinAttributes

func BuiltinAttributes() lists.List[attribute.KeyValue]

func Do

func Do(s trace.Span, err *error)

Do ends the span.

func Fingerprint

func Fingerprint() (hostname string, ip, mac []string, ns string)

func Logger

func Logger(name string) *slog.Logger

func SetupLoggersCreated

func SetupLoggersCreated(p log.LoggerProvider)

func SetupOTelLog

func SetupOTelLog(ctx context.Context, res *resource.Resource, remote Remote, headers map[string]string) (l *log.LoggerProvider, err error)

func SetupOTelSDK

func SetupOTelSDK(ctx context.Context, name string, config OpenTelemetry) (
	shutdown func(context.Context) error, err error)

SetupOTelSDK bootstraps the OpenTelemetry pipeline. If it does not return an error, make sure to call shutdown for proper cleanup. reference https://opentelemetry.io/docs/languages/go/getting-started/

func SetupTracer

func SetupTracer(t *trace.Tracer)

SetupTracer sets the global tracer.

func Span

func Span(ctx *context.Context, name string) (span trace.Span)

Span creates a new span.

Types

type Closable

type Closable func(context.Context) error

type Metric

type Metric[T any] struct {
	Instance T
	// contains filtered or unexported fields
}

type MultiHandler

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

func (MultiHandler) Enabled

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

func (MultiHandler) Handle

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

func (MultiHandler) WithAttrs

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

func (MultiHandler) WithGroup

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

type OpenTelemetry

type OpenTelemetry struct {
	Metric Remote `yaml:"metric"`
	Trace  Remote `yaml:"trace"`
	Log    Remote `yaml:"log"`
}

type Protocol

type Protocol string
const (
	GRPC Protocol = "grpc"
	HTTP Protocol = "http"
)

type Remote

type Remote struct {
	Protocol Protocol `yaml:"proto" default:"http"`
	Endpoint string   `yaml:"endpoint"`
}

type SimpleCounter

type SimpleCounter interface {
	Add(ctx context.Context, incr int64, options ...metric.AddOption) SimpleCounter
	Error() error
}

func Counter

func Counter(name string) SimpleCounter

type SimpleGauge

type SimpleGauge interface {
	Error() error
}

func Gauge

func Gauge(name string) SimpleGauge

type SimpleHistogram

type SimpleHistogram interface {
	Record(ctx context.Context, incr float64, options ...metric.RecordOption) SimpleHistogram
	Error() error
}

func Histogram

func Histogram(name string) SimpleHistogram

Jump to

Keyboard shortcuts

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