TracksPushedScopesAndSpans
trait TracksPushedScopesAndSpans
Track pushed scopes and spans using coroutine-local storage.
State is stored in coroutine Context (keyed by the using class name) so that singleton features sharing this trait remain safe under concurrent coroutines.
Constants
| SPANS_CONTEXT_PREFIX |
Context key prefix for per-class span tracking state. |
Methods
Push a span onto the coroutine-local stack and set it as current on the hub.
Push a scope onto the hub and track the count in coroutine-local storage.
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.
Details
at line 24
protected void
pushSpan(Span $span)
Push a span onto the coroutine-local stack and set it as current on the hub.
at line 42
protected void
pushScope()
Push a scope onto the hub and track the count in coroutine-local storage.
at line 53
protected Span|null
maybePopSpan()
Pop a span from the coroutine-local stack and restore the parent span.
at line 76
protected void
maybePopScope()
Pop a scope from the hub if one was pushed in this coroutine.
at line 94
protected Span|null
maybeFinishSpan(SpanStatus|null $status = null)
Finish the current span if one exists on the coroutine-local stack.