trait WorksWithSpans

Methods

Span|null
getParentSpanIfSampled()

Get the current span if it is sampled.

void
withParentSpanIfSampled(callable $callback)

Call the callback with the current span if it is sampled.

SpanStatus|null
cancellationStatus(Throwable $cancellation, Throwable|null $exception = null)

Get the status of an operation that cancellation stopped.

Details

at line 18
protected Span|null getParentSpanIfSampled()

Get the current span if it is sampled.

Return Value

Span|null

at line 35
protected void withParentSpanIfSampled(callable $callback)

Call the callback with the current span if it is sampled.

Parameters

callable $callback

Return Value

void

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.

Parameters

Throwable $cancellation
Throwable|null $exception

Return Value

SpanStatus|null