Documentation
¶
Overview ¶
Package otel bootstraps OpenTelemetry trace and metric pipelines for chassis-go services. It is the sole SDK consumer — all other chassis modules depend only on OTel API packages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AlwaysSample ¶
AlwaysSample returns a sampler that samples every trace.
func DetachContext ¶
DetachContext returns a new context.Background() populated with the OTel SpanContext from the original context. Cancellation is detached; trace correlation is preserved. Use this when spawning goroutines from request handlers.
func RatioSample ¶
RatioSample returns a sampler that samples a fraction of traces.
Types ¶
type Config ¶
type Config struct {
ServiceName string
ServiceVersion string
Endpoint string // OTLP gRPC endpoint, defaults to localhost:4317
Sampler sdktrace.Sampler // defaults to AlwaysSample
}
Config configures the OpenTelemetry bootstrap.
type ShutdownFunc ¶
ShutdownFunc drains and closes all OTel providers.
func Init ¶
func Init(cfg Config) ShutdownFunc
Init initializes OpenTelemetry trace and metric pipelines. Returns a ShutdownFunc that must be called on process exit.