class QueueInstrumentation extends AbstractInstrumentation

Traits

LogsMessagesTrait

Constants

protected SENT_MESSAGES_METRIC

protected SEND_DURATION_METRIC

protected CONSUMED_MESSAGES_METRIC

protected PROCESS_DURATION_METRIC

protected SYSTEM_NAME_ATTRIBUTE

protected DESTINATION_NAME_ATTRIBUTE

protected OPERATION_NAME_ATTRIBUTE

protected OPERATION_TYPE_ATTRIBUTE

protected MESSAGE_ID_ATTRIBUTE

protected MESSAGE_ENVELOPE_SIZE_ATTRIBUTE

protected OPERATION_TYPE_SEND

protected OPERATION_TYPE_PROCESS

protected SYSTEM_NAME_AWS_SQS

protected DEPTH_METRIC

protected OUTBOX_DELIVERED_METRIC

protected OUTBOX_DURATION_METRIC

protected OUTBOX_LATENCY_METRIC

protected CONNECTION_ATTRIBUTE

protected DURATION_BOUNDARIES

Properties

protected InstrumentationOptions $options from  AbstractInstrumentation
protected TracerInterface|null $tracer
protected CounterInterface|null $sentMessages
protected HistogramInterface|null $sendDuration
protected CounterInterface|null $consumedMessages
protected HistogramInterface|null $processDuration
protected CounterInterface|null $outboxDelivered
protected HistogramInterface|null $outboxDuration
protected HistogramInterface|null $outboxLatency
protected bool $propagation
protected array<string, string> $connectionDrivers
protected array<string, true> $syncConnections
protected QueueConsumerState> $consumerStates

Methods

void
register(array $options)

Register the instrumentation with normalized options.

void
registerInstrumentation()

Register queue listeners, propagation, and instruments.

bool
tracesEnabled()

Determine whether trace output is enabled.

bool
metricEnabled(string $name)

Determine whether a metric is enabled.

bool
isDirectCancellation(Throwable|null $exception)

Determine whether the throwable is a direct coroutine cancellation.

string
schemaUrl()

Return the semantic conventions schema URL for Hypervel instrumentation scopes.

array
indexObservers(array $names, array $observers)

Index callback observers by their matching instrument name.

__construct(Dispatcher $events, Repository $config, QueueManager $queues, TracerProviderInterface $tracerProvider, MeterProviderInterface $meterProvider, ClockInterface $clock, TextMapPropagatorInterface $propagator, ExceptionContextRegistry $exceptionContexts, OperationOrigin $origins, ProcessIdentity $identity, LogContextScopeFactory $logContextScopes)

Create queue instrumentation.

void
registerMetrics()

Create enabled queue metric instruments.

void
registerOutboxMetrics()

Register outbox delivery metrics without observing or resolving ordinary queue operations.

void
recordOutboxDelivery(OutboxBatchDelivered|OutboxBatchDeliveryFailed $event)

Record confirmed acceptance separately from publication or settlement failure.

void
finalizePayload(JobPayloadFinalizing $event)

Inject propagation and start a persistent producer span.

void
finishProducer(string $payload, Throwable|null $exception = null, bool $sendAttempted = true)

Complete persistent producer telemetry.

void
completeProducer(QueueProducerState $state, Throwable|null $exception, bool $sendAttempted)

Complete producer telemetry from its started state.

string|null
payloadUuid(string $payload)

Return a framework UUID from a rewritten terminal payload.

void
registerLocalPropagation()

Register flat propagation for local asynchronous queue drivers.

void
startConsumer(JobProcessing $event)

Start consumer telemetry when a job reaches application processing.

void
recordConsumerError(Job $job, Throwable $exception)

Retain the first ordinary consumer failure.

void
recordConsumerTimeout(Job $job)

Retain a timeout when no earlier failure explains the attempt.

void
finishConsumer(JobAttempted $event)

Complete consumer telemetry at the canonical attempt boundary.

void
registerDepthMetric()

Register collection-only queue depth in event worker zero.

array
attributes(string $connection, string|null $queue, string $operation, string $operationType)

Return low-cardinality attributes shared by queue spans and metrics.

array
connectionDrivers()

Return configured connection drivers by connection name.

string
spanName(string $operation, string|null $queue)

Return a queue operation span name.

Details

final void register(array $options)

Register the instrumentation with normalized options.

Parameters

array $options

Return Value

void

at line 159
protected void registerInstrumentation()

Register queue listeners, propagation, and instruments.

Return Value

void

protected bool tracesEnabled()

Determine whether trace output is enabled.

Return Value

bool

protected bool metricEnabled(string $name)

Determine whether a metric is enabled.

Parameters

string $name

Return Value

bool

protected bool isDirectCancellation(Throwable|null $exception)

Determine whether the throwable is a direct coroutine cancellation.

Ending an operation by direct cancellation is control flow, not a failure.

Parameters

Throwable|null $exception

Return Value

bool

protected string schemaUrl()

Return the semantic conventions schema URL for Hypervel instrumentation scopes.

Every tracer, meter and logger obtained for one scope must pass the same URL.

Return Value

string

protected array indexObservers(array $names, array $observers)

Index callback observers by their matching instrument name.

The SDK supplies observers in the same order as the instruments passed to batchObserve(), so the unchanged name order is the mapping contract.

Parameters

array $names
array $observers

Return Value

array

at line 140
__construct(Dispatcher $events, Repository $config, QueueManager $queues, TracerProviderInterface $tracerProvider, MeterProviderInterface $meterProvider, ClockInterface $clock, TextMapPropagatorInterface $propagator, ExceptionContextRegistry $exceptionContexts, OperationOrigin $origins, ProcessIdentity $identity, LogContextScopeFactory $logContextScopes)

Create queue instrumentation.

Parameters

Dispatcher $events
Repository $config
QueueManager $queues
TracerProviderInterface $tracerProvider
MeterProviderInterface $meterProvider
ClockInterface $clock
TextMapPropagatorInterface $propagator
ExceptionContextRegistry $exceptionContexts
OperationOrigin $origins
ProcessIdentity $identity
LogContextScopeFactory $logContextScopes

at line 244
protected void registerMetrics()

Create enabled queue metric instruments.

Return Value

void

at line 290
protected void registerOutboxMetrics()

Register outbox delivery metrics without observing or resolving ordinary queue operations.

Return Value

void

at line 329
protected void recordOutboxDelivery(OutboxBatchDelivered|OutboxBatchDeliveryFailed $event)

Record confirmed acceptance separately from publication or settlement failure.

Parameters

OutboxBatchDelivered|OutboxBatchDeliveryFailed $event

Return Value

void

at line 352
protected void finalizePayload(JobPayloadFinalizing $event)

Inject propagation and start a persistent producer span.

Parameters

JobPayloadFinalizing $event

Return Value

void

at line 430
protected void finishProducer(string $payload, Throwable|null $exception = null, bool $sendAttempted = true)

Complete persistent producer telemetry.

Parameters

string $payload
Throwable|null $exception
bool $sendAttempted

Return Value

void

at line 449
protected void completeProducer(QueueProducerState $state, Throwable|null $exception, bool $sendAttempted)

Complete producer telemetry from its started state.

Parameters

QueueProducerState $state
Throwable|null $exception
bool $sendAttempted

Return Value

void

at line 488
protected string|null payloadUuid(string $payload)

Return a framework UUID from a rewritten terminal payload.

Parameters

string $payload

Return Value

string|null

at line 504
protected void registerLocalPropagation()

Register flat propagation for local asynchronous queue drivers.

Return Value

void

at line 534
protected void startConsumer(JobProcessing $event)

Start consumer telemetry when a job reaches application processing.

Parameters

JobProcessing $event

Return Value

void

at line 623
protected void recordConsumerError(Job $job, Throwable $exception)

Retain the first ordinary consumer failure.

Parameters

Job $job
Throwable $exception

Return Value

void

at line 638
protected void recordConsumerTimeout(Job $job)

Retain a timeout when no earlier failure explains the attempt.

Parameters

Job $job

Return Value

void

at line 652
protected void finishConsumer(JobAttempted $event)

Complete consumer telemetry at the canonical attempt boundary.

Parameters

JobAttempted $event

Return Value

void

at line 711
protected void registerDepthMetric()

Register collection-only queue depth in event worker zero.

Return Value

void

at line 763
protected array attributes(string $connection, string|null $queue, string $operation, string $operationType)

Return low-cardinality attributes shared by queue spans and metrics.

Parameters

string $connection
string|null $queue
string $operation
string $operationType

Return Value

array

at line 783
protected array connectionDrivers()

Return configured connection drivers by connection name.

Return Value

array

at line 805
protected string spanName(string $operation, string|null $queue)

Return a queue operation span name.

Parameters

string $operation
string|null $queue

Return Value

string