telemetry

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RecordDBError

func RecordDBError(span trace.Span, err error)

RecordDBError records an error on the current span.

func SpanFromContext

func SpanFromContext(ctx context.Context) trace.Span

SpanFromContext returns the current span from context.

func StartDBSpan

func StartDBSpan(ctx context.Context, operation string, attrs ...attribute.KeyValue) (context.Context, trace.Span)

StartDBSpan starts a new span for a database operation. Usage:

ctx, span := telemetry.StartDBSpan(ctx, "FindingRepository.GetByID")
defer span.End()

func Tracer

func Tracer(name string) trace.Tracer

Tracer returns a named tracer for creating spans.

Types

type Config

type Config struct {
	ServiceName    string
	ServiceVersion string
	Environment    string
	OTLPEndpoint   string // e.g. "localhost:4318" for HTTP
	SampleRate     float64
	Enabled        bool
}

Config holds the configuration for the tracer provider.

type TracerProvider

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

TracerProvider wraps the OpenTelemetry SDK tracer provider with shutdown support.

func NewTracerProvider

func NewTracerProvider(ctx context.Context, cfg Config) (*TracerProvider, error)

NewTracerProvider creates and configures a new OpenTelemetry tracer provider. If tracing is disabled, returns a no-op provider.

func (*TracerProvider) Shutdown

func (tp *TracerProvider) Shutdown(ctx context.Context) error

Shutdown gracefully shuts down the tracer provider.

Jump to

Keyboard shortcuts

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