yo11y

package
v0.0.0-...-cb9dc12 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2025 License: MIT Imports: 32 Imported by: 0

Documentation

Overview

yo11y contains helpers for setting up the opentelemetry (otel) sdk. The sdks primarily take configuration from the "OTEL_" environment variables.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(c Config) (O11y, O11yReg)

func NewMetric

func NewMetric(ctx context.Context, res *resource.Resource, c Config) error

func NewTrace

func NewTrace(ctx context.Context, res *resource.Resource, c Config) (http.Handler, error)

Types

type Config

type Config struct {
	LogLevel  slog.Level `env:"LOG_LEVEL"`
	LogFormat string     `env:"LOG_FORMAT"`
}

type O11y

type O11y struct {
	T trace.Tracer
	M metric.Meter
	L *slog.Logger
	H slog.Handler
	// contains filtered or unexported fields
}

func (O11y) Err

func (o O11y) Err(ctx context.Context, msg string, err error, attrs ...slog.Attr) error

func (O11y) HTTPErr

func (o O11y) HTTPErr(ctx context.Context, msg string, err error, rw http.ResponseWriter, code int, attrs ...slog.Attr)

func (O11y) Region

func (o O11y) Region(ctx context.Context, name string, do func(ctx context.Context, span trace.Span) error) error

func (O11y) Sub

func (o O11y) Sub(name string) O11y

type O11yReg

type O11yReg struct {
	LogZpage   http.Handler
	TraceZpage http.Handler
}

Jump to

Keyboard shortcuts

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