ContextTracer
class ContextTracer implements TracerInterface
This implementation of the TracerInterface manages your trace context throughout
the request. It maintains a stack of Span
records that are currently open
allowing you to know the current context at any moment.
Methods
Instrument a callable by creating a Span that manages the startTime and endTime.
Create a new Span. The start time is already set to the current time.
Add an attribute to the provided Span
Add an annotation to the provided Span
Add a link to the provided Span
Add an message event to the provided Span
Returns the current SpanContext
Whether or not this tracer is enabled.
Details
at line 40
__construct(SpanContext $initialContext = null)
at line 61
mixed
inSpan(array $spanOptions, callable $callable, array $arguments = [])
Instrument a callable by creating a Span that manages the startTime and endTime.
at line 82
startSpan(array $spanOptions = [])
Create a new Span. The start time is already set to the current time.
The newly created span is not attached to the current context.
at line 100
Scope
withSpan(Span $span)
Attaches the provided span as the current span and returns a Scope object which must be closed.
at line 124
Span[]
spans()
Return the spans collected.
at line 138
addAttribute(string $attribute, string $value, array $options = [])
Add an attribute to the provided Span
at line 154
addAnnotation(string $description, array $options = [])
Add an annotation to the provided Span
at line 173
addLink(string $traceId, string $spanId, array $options = [])
Add a link to the provided Span
at line 194
addMessageEvent(string $type, string $id, array $options = [])
Add an message event to the provided Span
at line 205
SpanContext
spanContext()
Returns the current SpanContext
at line 221
bool
enabled()
Whether or not this tracer is enabled.