Documentation
¶
Overview ¶
Package tracing constructs an explicitly owned OpenTelemetry provider. It does not install process-global providers or read application configuration.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHTTPTransport ¶
func NewHTTPTransport(base http.RoundTripper, tracer trace.Tracer) http.RoundTripper
NewHTTPTransport wraps a borrowed transport for a deliberately chosen integration. It injects W3C trace context, never baggage. Use only for destinations allowed to receive trace metadata. Spans end on response headers, not body consumption. URLs, headers, bodies and raw errors are never recorded. Nil base uses DefaultTransport. The tracer must be non-nil. The caller owns connection cleanup and client timeouts/redirect policy.
Types ¶
type Config ¶
type Config struct {
Enabled bool
ServiceName string
Endpoint string
SampleRatio float64
ExportTimeout time.Duration
ShutdownTimeout time.Duration
}
Config selects optional tracing. A disabled zero value is valid. Endpoint is the full OTLP HTTP URL, including /v1/traces. Credentials in URLs are rejected; use a local collector to handle backend authentication.
type Provider ¶
type Provider struct {
trace.TracerProvider
// contains filtered or unexported fields
}
Provider owns the exporter and its bounded batch worker. Borrow TracerProvider for instrumentation; stop all producers before Shutdown. Concurrent use is safe.
func Open ¶
Open acquires an exporter and starts its bounded batch worker. It does not contact the collector during setup. The caller owns Shutdown after all producers stop. Disabled tracing owns no worker; invalid settings fail before resource setup. Export outages lose telemetry, not application work; failed batches are reported through the borrowed logger without endpoint URLs, response bodies, or span data.