QueueIntegration
class QueueIntegration extends Feature
Traits
Track pushed scopes and spans using coroutine-local storage.
Constants
| private QUEUE_SPAN_OP_QUEUE_PUBLISH |
|
| private QUEUE_PAYLOAD_BAGGAGE_DATA |
|
| private QUEUE_PAYLOAD_TRACE_PARENT_DATA |
|
| private QUEUE_PAYLOAD_PUBLISH_TIME |
|
| private QUEUE_PAYLOAD_DESTINATION_NAME |
|
| private QUEUE_SPAN_DATA_ARGUMENTS |
|
| private JOB_FRAMES_CONTEXT_KEY |
|
Methods
Indicate if the feature is applicable to the current environment.
Set up the feature in the environment.
Set up the feature in the environment in an inactive state (when no DSN was set).
Indicate if the given feature is enabled for tracing.
Indicate if the given feature is enabled for breadcrumbs.
Push a span onto the coroutine-local stack and set it as current on the hub.
Push a scope for the job with fresh breadcrumbs and propagation context.
Track an operation-local span without making it current on the Hub.
Pop a span from the coroutine-local stack and restore the parent span.
Pop a scope from the hub if one was pushed in this coroutine.
Finish the current span if one exists on the coroutine-local stack.
Finish an operation-local span by key if one exists.
Call the callback with the current span if it is sampled.
Get the status of an operation that cancellation stopped.
Finish the publish span of the job that failed to queue.
Finish the publish span of the job whose queueing was canceled.
Finish the process span and pop the scope of the processed job.
Push a scope and start a process span or transaction for the job being processed.
Drain pending events before the worker stops gracefully.
Finish the process span of the job that threw an exception.
Get the transaction started for the job running in this coroutine.
Details
at line 69
bool
isApplicable()
Indicate if the feature is applicable to the current environment.
in
Feature at line 48
void
register()
Register the feature in the environment.
at line 77
void
onBoot()
Set up the feature in the environment.
in
Feature at line 64
void
onBootInactive()
Set up the feature in the environment in an inactive state (when no DSN was set).
in
Feature at line 71
void
boot()
Initialize the feature.
in
Feature at line 81
void
bootInactive()
Initialize the feature in an inactive state (when no DSN was set).
in
Feature at line 91
protected array
getUserConfig()
Retrieve the user configuration.
in
Feature at line 99
protected bool
shouldSendDefaultPii()
Determine if default PII should be sent.
in
Feature at line 113
protected bool
shouldCollectGenAiInputs()
Determine whether AI inputs may be collected.
in
Feature at line 121
protected bool
shouldCollectGenAiOutputs()
Determine whether AI outputs may be collected.
in
Feature at line 146
protected bool
isTracingFeatureEnabled(string $feature, bool $default = true)
Indicate if the given feature is enabled for tracing.
in
Feature at line 159
protected bool
isBreadcrumbFeatureEnabled(string $feature, bool $default = true)
Indicate if the given feature is enabled for breadcrumbs.
in
Feature at line 182
protected bool
canRecordSpans()
Determine if the active SDK client can record spans.
in
Feature at line 196
protected bool
canRecordBreadcrumbs()
Determine if the active SDK client can record breadcrumbs.
in
TracksPushedScopesAndSpans at line 26
protected void
pushSpan(Span $span)
Push a span onto the coroutine-local stack and set it as current on the hub.
at line 513
protected Scope
pushScope()
Push a scope for the job with fresh breadcrumbs and propagation context.
in
TracksPushedScopesAndSpans at line 59
protected void
trackLocalSpan(string $key, Span $span)
Track an operation-local span without making it current on the Hub.
in
TracksPushedScopesAndSpans at line 70
protected Span|null
maybePopSpan()
Pop a span from the coroutine-local stack and restore the parent span.
in
TracksPushedScopesAndSpans at line 93
protected void
maybePopScope()
Pop a scope from the hub if one was pushed in this coroutine.
in
TracksPushedScopesAndSpans at line 109
protected Span|null
maybeFinishSpan(SpanStatus|null $status = null)
Finish the current span if one exists on the coroutine-local stack.
in
TracksPushedScopesAndSpans at line 129
protected Span|null
maybeFinishLocalSpan(string $key, SpanStatus|null $status = null)
Finish an operation-local span by key if one exists.
in
WorksWithSpans at line 18
protected Span|null
getParentSpanIfSampled()
Get the current span if it is sampled.
in
WorksWithSpans at line 35
protected void
withParentSpanIfSampled(callable $callback)
Call the callback with the current span if it is sampled.
in
WorksWithSpans at line 53
protected SpanStatus|null
cancellationStatus(Throwable $cancellation, Throwable|null $exception = null)
Get the status of an operation that cancellation stopped.
A direct cancellation with no earlier failure leaves the status unset: it is control flow, and the SDK has no canceled status. A known failure, or a cleanup failure carrying the cancellation, is an error.
at line 121
void
handleJobQueueingEvent(JobQueueing $event)
Start a publish span for the job being queued.
at line 161
void
handleJobQueuedEvent(JobQueued $event)
Finish the publish span of the queued job.
at line 169
void
handleJobQueueingFailedEvent(JobQueueingFailed $event)
Finish the publish span of the job that failed to queue.
at line 177
void
handleJobQueueingCanceledEvent(JobQueueingCanceled $event)
Finish the publish span of the job whose queueing was canceled.
at line 189
void
handleJobProcessedQueueEvent(JobProcessed $event)
Finish the process span and pop the scope of the processed job.
at line 212
void
handleJobProcessingQueueEvent(JobProcessing $event)
Push a scope and start a process span or transaction for the job being processed.
at line 314
void
handleJobFailedEvent(JobFailed $event)
Handle a permanently failed job.
Finishes the span with an error status but does not pop the scope — breadcrumbs need to remain available for exception reporting. Once the attempt has ended, the scope is discarded when the next job starts or when the parent job completes.
at line 326
void
handleJobAttemptedEvent(JobAttempted $event)
Mark the job attempt as ended.
A failed job can keep running and dispatch other jobs, so a retained scope is only discarded once its attempt has ended. A canceled attempt skipped the processed and failed events, so its span finishes here.
at line 352
void
handleWorkerStoppingQueueEvent(WorkerStopping $event)
Drain pending events before the worker stops gracefully.
at line 364
void
handleJobExceptionOccurredQueueEvent(JobExceptionOccurred $event)
Finish the process span of the job that threw an exception.
at line 376
static Transaction|null
currentJobTransaction()
| internal |
Get the transaction started for the job running in this coroutine.
A job that runs within another transaction, or without a span, has none.