Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractFromBytes ¶
ExtractFromBytes deserializes a 26-byte binary trace context and returns a Go context with the remote span context attached. Returns context.Background() if data is nil or malformed.
func Init ¶
Init sets up the global OTel TracerProvider. When Endpoint is empty it registers a no-op provider (zero overhead). Returns a shutdown function that must be called on process exit to flush pending spans.
func InjectIntoBytes ¶
InjectIntoBytes serializes the span context from ctx into a compact 26-byte binary representation. Returns nil if the span context is invalid.
Types ¶
type Config ¶
type Config struct {
Endpoint string // OTLP HTTP endpoint (e.g. http://localhost:4318). Empty = disabled.
ServiceName string // OTel service name. Defaults to "swytch".
NodeID uint64 // Cluster node ID, added as a resource attribute.
Insecure bool // Use HTTP instead of HTTPS for the OTLP endpoint.
}
Config holds OpenTelemetry tracing configuration.
type TracingHandler ¶
type TracingHandler struct {
// contains filtered or unexported fields
}
TracingHandler wraps an slog.Handler to inject trace_id and span_id attributes from the context into every log record.
func NewTracingHandler ¶
func NewTracingHandler(inner slog.Handler) *TracingHandler
NewTracingHandler creates a new TracingHandler wrapping the given handler.