Documentation
¶
Overview ¶
Package tracing configures OpenTelemetry trace export and lifecycle helpers. Applications own sampling, attribute classification, collector availability, and telemetry retention.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrExporterNotConfigured = errors.New("tracing: OTLP exporter endpoint is not configured")
ErrExporterNotConfigured indicates that neither an exporter nor valid endpoint exists.
Functions ¶
func GetTraceID ¶
func GetTraceID(c *gpp.Context) string
GetTraceID extracts the standards-compliant active OpenTelemetry trace ID.
func Middleware ¶
func Middleware() gpp.HandlerFunc
Middleware instruments requests with the process-wide OpenTelemetry provider. Prefer Provider.Middleware when this package owns exporter configuration.
Types ¶
type Config ¶
type Config struct {
ServiceName string
ServiceVersion string
Environment string
Endpoint string
Headers map[string]string
Insecure bool
SampleRatio float64
BatchTimeout time.Duration
ExportTimeout time.Duration
Exporter sdktrace.SpanExporter
Propagator propagation.TextMapPropagator
}
Config defines service identity, export transport, sampling, and batching.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider owns the OpenTelemetry SDK lifecycle. Applications should call Shutdown during graceful termination to flush queued spans.
func NewProvider ¶
NewProvider validates configuration and constructs an owned OpenTelemetry provider.
func (*Provider) ForceFlush ¶
ForceFlush exports queued spans within ctx.
func (*Provider) Inject ¶
Inject writes W3C trace context and baggage headers for an outgoing request.
func (*Provider) Middleware ¶
func (provider *Provider) Middleware() gpp.HandlerFunc
Middleware instruments requests using this provider and its propagator.