telemetry

package
v0.0.0-...-f8dffa4 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SpanFromContext

func SpanFromContext(ctx context.Context) trace.Span

SpanFromContext returns the current span from context.

func Tracer

func Tracer(name string) trace.Tracer

Tracer returns the global tracer for a given name. Use this when you don't have access to the Provider.

Types

type Config

type Config struct {
	Enabled    bool    `mapstructure:"enabled"`
	Endpoint   string  `mapstructure:"endpoint"`    // OTLP HTTP endpoint (e.g., "localhost:4318")
	SampleRate float64 `mapstructure:"sample_rate"` // 0.0-1.0
	Insecure   bool    `mapstructure:"insecure"`    // Use HTTP instead of HTTPS
}

Config holds telemetry configuration.

type Provider

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

Provider wraps the OpenTelemetry TracerProvider.

func NewProvider

func NewProvider(ctx context.Context, cfg Config, serviceName, serviceVersion string) (*Provider, error)

NewProvider creates a new telemetry provider.

func (*Provider) Shutdown

func (p *Provider) Shutdown(ctx context.Context) error

Shutdown gracefully shuts down the telemetry provider.

func (*Provider) Tracer

func (p *Provider) Tracer(name string) trace.Tracer

Tracer returns a named tracer.

Jump to

Keyboard shortcuts

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