Documentation
¶
Overview ¶
Package telemetry provides OpenTelemetry tracing initialization and span helpers for cleat workflows.
It configures OTLP HTTP export, manages a global tracer, and provides convenience functions for creating workflow-level and event-level spans.
Key functions:
- InitTracing — initializes OTLP trace export with configurable endpoint
- WorkflowSpan — creates a span for workflow execution
- EventSpan — creates a span for workflow events
Index ¶
- Variables
- func EventSpan(ctx context.Context, step int, eventType, service, operation string) (context.Context, trace.Span)
- func InitTracing(ctx context.Context, endpoint, serviceName string) (func(context.Context) error, error)
- func WorkflowSpan(ctx context.Context, workflowID, defName string, defVersion int, ...) (context.Context, trace.Span)
Constants ¶
This section is empty.
Variables ¶
var Tracer trace.Tracer
Tracer is the global cleat tracer. It is set by InitTracing and used by WorkflowSpan and EventSpan.
Functions ¶
func EventSpan ¶
func EventSpan(ctx context.Context, step int, eventType, service, operation string) (context.Context, trace.Span)
EventSpan creates a span for a single event in the workflow history.
func InitTracing ¶
func InitTracing(ctx context.Context, endpoint, serviceName string) (func(context.Context) error, error)
InitTracing initializes OTLP trace export. Returns a shutdown function. endpoint is the OTLP HTTP endpoint, e.g., "localhost:4318". serviceName identifies this deployment (e.g., "cleat-worker"). If endpoint is empty, a no-op tracer provider is used and the returned shutdown is a no-op.
func WorkflowSpan ¶
func WorkflowSpan(ctx context.Context, workflowID, defName string, defVersion int, tenantID string, traceID string) (context.Context, trace.Span)
WorkflowSpan creates a root span for a workflow execution. If traceID is a non-empty 32-char hex string, the span is created with a W3C TraceContext parent link for end-to-end propagation.
Types ¶
This section is empty.