internal

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package internal hides OTel SDK types behind a thin interface so the public tracer package can stay free of vendor-specific imports.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

type Attribute struct {
	Key   string
	Value any
}

Attribute is the internal mirror of tracer.Attribute.

type Carrier

type Carrier interface {
	Get(key string) string
	Set(key, value string)
	Keys() []string
}

Carrier is the internal mirror of tracer.Carrier.

type OTelConfig

type OTelConfig struct {
	ServiceName        string
	Endpoint           string
	Insecure           bool
	SampleRatio        float64
	Headers            map[string]string
	UseGRPC            bool
	ResourceAttributes []Attribute
}

OTelConfig is the resolved configuration for the OTel impl.

type Span

type Span interface {
	End()
	SetAttributes(attrs ...Attribute)
	SetStatus(code int, description string)
	RecordError(err error, attrs ...Attribute)
	AddEvent(name string, attrs ...Attribute)
	SpanContext() SpanContext
	IsRecording() bool
}

Span is the internal span surface.

type SpanContext

type SpanContext struct {
	TraceID    string
	SpanID     string
	TraceFlags byte
	Remote     bool
}

SpanContext is the internal mirror of tracer.SpanContext.

type StartConfig

type StartConfig struct {
	Kind       int
	Attributes []Attribute
}

StartConfig is the internal mirror of tracer.StartConfig.

type Tracer

type Tracer interface {
	Start(ctx context.Context, name string, cfg StartConfig) (context.Context, Span)
	SpanFromContext(ctx context.Context) Span
	Inject(ctx context.Context, carrier Carrier)
	Extract(ctx context.Context, carrier Carrier) context.Context
	Shutdown(ctx context.Context) error
}

Tracer is the internal tracer surface.

func NewNoopTracer

func NewNoopTracer() Tracer

NewNoopTracer returns a Tracer that does nothing — useful when tracing is explicitly disabled.

func NewOTelTracer

func NewOTelTracer(cfg OTelConfig) (Tracer, error)

NewOTelTracer builds an OTel-backed Tracer with an OTLP exporter and the W3C tracecontext + baggage propagator.

Jump to

Keyboard shortcuts

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