
telemetry
Index
- Constants
- Variables
- func InitTracer(ctx context.Context, cfg config.TracingConfig) (func(context.Context) error, error)
- func StartClientSpan(ctx context.Context, name string, attrs …attribute.KeyValue) (context.Context, trace.Span)
- func StartSpan(ctx context.Context, name string, attrs …attribute.KeyValue) (context.Context, trace.Span)
- func Tracer() trace.Tracer
- type TraceHandler
- func NewTraceHandler(inner slog.Handler) *TraceHandler
- func (h *TraceHandler) Enabled(ctx context.Context, level slog.Level) bool
- func (h *TraceHandler) Handle(ctx context.Context, r slog.Record) error
- func (h *TraceHandler) WithAttrs(attrs []slog.Attr) slog.Handler
- func (h *TraceHandler) WithGroup(name string) slog.Handler
Constants
Variables
Version of the service for trace metadata. Set at build time via -ldflags “-X github.com/afreidah/cloudflare-log-collector/internal/telemetry.Version=…”
func InitTracer
InitTracer initializes the OpenTelemetry tracer with OTLP export. Returns a shutdown function that should be called on service termination to flush spans.
func StartClientSpan
StartClientSpan creates a span with SpanKindClient for outbound service calls. Client spans are required for Tempo’s service graph to detect service-to-service edges.
func StartSpan
StartSpan creates a new span with the given name and attributes.
func Tracer
Tracer returns the global tracer for this service.
type TraceHandler
TraceHandler wraps an slog.Handler and injects OpenTelemetry trace context (trace_id, span_id) into every log record that has an active span.
func NewTraceHandler
NewTraceHandler creates a handler that injects trace context into log records before delegating to the inner handler.
func (*TraceHandler) Enabled
Enabled delegates to the inner handler.
func (*TraceHandler) Handle
Handle adds trace_id and span_id attributes if the context carries an active span, then delegates to the inner handler.
func (*TraceHandler) WithAttrs
WithAttrs returns a new TraceHandler wrapping the inner handler with attrs.
func (*TraceHandler) WithGroup
WithGroup returns a new TraceHandler wrapping the inner handler with a group.
Generated by gomarkdoc