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. Operation-local spans are tracked by key without becoming current on the Hub.
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.
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.
Details
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 45
protected Scope
pushScope()
Push a scope onto the hub and track the count in coroutine-local storage.
at line 59
protected void
trackLocalSpan(string $key, Span $span)
Track an operation-local span without making it current on the Hub.
at line 70
protected Span|null
maybePopSpan()
Pop a span from the coroutine-local stack and restore the parent span.
at line 93
protected void
maybePopScope()
Pop a scope from the hub if one was pushed in this coroutine.
at line 109
protected Span|null
maybeFinishSpan(SpanStatus|null $status = null)
Finish the current span if one exists on the coroutine-local stack.
at line 129
protected Span|null
maybeFinishLocalSpan(string $key, SpanStatus|null $status = null)
Finish an operation-local span by key if one exists.