Skip to content

Observability

OpenTelemetry Tracing

otel.Instrument(q *queue.Queue, opts ...otel.InstrumentOption)

Imports:

import jobsotel "github.com/jdziat/simple-durable-jobs/v4/pkg/otel"

Attaches tracing to a queue with no hand-rolled hook wiring. By default the instrumentation uses the global TracerProvider; pass jobsotel.WithTracerProvider(tp) to override.

jobsotel.Instrument(queue) // uses otel.GetTracerProvider()
// or
jobsotel.Instrument(queue, jobsotel.WithTracerProvider(tp))

Spans emitted:

SpanWhen
job.enqueueQueue.Enqueue — producer span; trace context is persisted on the job so the consumer picks it up.
job.process {type}Worker handler execution — child of job.enqueue.
job.retrySpan event added to job.process when a job is retried.

Every span carries job.id, job.type, job.queue, job.attempt, and job.priority attributes.