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 46
__construct(SpanContext $initialContext = null)
Create a new ContextTracer
at line 67
mixed
inSpan(array $spanOptions, callable $callable, array $arguments = [])
Instrument a callable by creating a Span that manages the startTime and endTime.
at line 88
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 106
Scope
withSpan(Span $span)
Attaches the provided span as the current span and returns a Scope object which must be closed.
at line 131
SpanData[]
spans()
Return the spans collected.
at line 147
addAttribute(string $attribute, string $value, array $options = [])
Add an attribute to the provided Span
at line 163
addAnnotation(string $description, array $options = [])
Add an annotation to the provided Span
at line 182
addLink(string $traceId, string $spanId, array $options = [])
Add a link to the provided Span
at line 203
addMessageEvent(string $type, string $id, array $options = [])
Add an message event to the provided Span
at line 214
SpanContext
spanContext()
Returns the current SpanContext
at line 230
bool
enabled()
Whether or not this tracer is enabled.