How It Works
Job Dispatched (PRODUCER span)
When a job is dispatched, a
PRODUCER span is created with the span name send {queue} (e.g. send default). The current trace context is serialised and stored in the job payload so it can be recovered by the worker process.Span Attributes
Both producer and consumer spans include the following attributes where available:| Attribute | Description |
|---|---|
messaging.system | The queue driver (e.g. redis, sqs, database). |
messaging.operation.type | send for producer, process for consumer. |
messaging.message.id | The job UUID. |
messaging.destination.name | The queue name. |
messaging.message.envelope_size | Size of the job payload in bytes. |
messaging.message.job_name | The fully-qualified job class name. |
messaging.message.attempts | Number of attempts. |
messaging.message.max_tries | Maximum allowed attempts. |
messaging.message.timeout | Job timeout in seconds. |
Failed Jobs
If a job fails, the exception is recorded on the consumer span and the span status is set toERROR.
Configuration
Inconfig/opentelemetry.php:
Trace context is propagated automatically via the job payload. No changes to your job classes are required.
Disabling
Set the environment variable tofalse to disable this instrumentation:
QueueInstrumentation::class from the instrumentation array in config/opentelemetry.php.