Documentation
¶
Overview ¶
Package telemetry provides OpenTelemetry tracing for Wadjet.
Wadjet already generates W3C-compatible TraceID/SpanID and propagates them through NATS tasks. This package bridges those IDs into the OTel SDK so they are exported to Jaeger, Tempo, or any OTLP-compatible backend.
Index ¶
- func SpanIDFromContext(ctx context.Context) string
- func TraceIDFromContext(ctx context.Context) string
- func TraceIDToBytes(hexID string) [16]byte
- type Config
- type Provider
- func (p *Provider) Shutdown(ctx context.Context) error
- func (p *Provider) StartRemoteSpan(ctx context.Context, name, traceIDHex, parentSpanIDHex string, ...) (context.Context, trace.Span)
- func (p *Provider) StartSpan(ctx context.Context, name string, attrs ...attribute.KeyValue) (context.Context, trace.Span)
- func (p *Provider) Tracer() trace.Tracer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SpanIDFromContext ¶
SpanIDFromContext extracts the current span's ID as a hex string. Useful for propagating through Wadjet's task system.
func TraceIDFromContext ¶
TraceIDFromContext extracts the current trace ID as a hex string.
func TraceIDToBytes ¶
TraceIDToBytes converts a 32-char hex trace ID to [16]byte.
Types ¶
type Config ¶
type Config struct {
Endpoint string // OTLP gRPC endpoint (e.g., "localhost:4317")
Insecure bool // use plaintext gRPC (no TLS)
ServiceName string // service name (default: "wadjet")
SampleRate float64 // sampling rate 0.0-1.0 (default: 1.0 = always)
}
Config configures the OTLP trace exporter.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider wraps an OTel TracerProvider for clean shutdown.
func Init ¶
Init initializes the OTLP trace exporter and registers a global TracerProvider. Returns a Provider that must be shut down on exit.
func (*Provider) StartRemoteSpan ¶
func (p *Provider) StartRemoteSpan(ctx context.Context, name, traceIDHex, parentSpanIDHex string, attrs ...attribute.KeyValue) (context.Context, trace.Span)
StartRemoteSpan begins a span linked to a remote parent identified by the Wadjet TraceID/SpanID strings (from distributed.TraceContext). This bridges Wadjet's custom propagation to OTel spans.