ExtensionTracer
class ExtensionTracer implements TracerInterface, SpanEventHandlerInterface
This implementation of the TracerInterface utilizes the opencensus extension to manage span context. The opencensus extension augments user created spans and adds automatic tracing to several commonly desired events.
Traits
Methods
Instrument a callable by creating a Span
Start 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.
Triggers when an attribute is added to a span.
Details
at line 51
__construct(SpanContext $initialContext = null)
Create a new ExtensionTracer
at line 67
mixed
inSpan(array $spanOptions, callable $callable, array $arguments = [])
Instrument a callable by creating a Span
at line 86
startSpan(array $spanOptions)
Start a new Span. The start time is already set to the current time.
at line 102
Scope
withSpan(Span $span)
Attaches the provided span as the current span and returns a Scope object which must be closed.
at line 137
SpanData[]
spans()
Return the spans collected.
at line 156
addAttribute(string $attribute, string $value, array $options = [])
Add an attribute to the provided Span
at line 174
addAnnotation(string $description, array $options = [])
Add an annotation to the provided Span
at line 195
addLink(string $traceId, string $spanId, array $options = [])
Add a link to the provided Span
at line 218
addMessageEvent(string $type, string $id, array $options = [])
Add an message event to the provided Span
at line 231
SpanContext
spanContext()
Returns the current SpanContext
at line 246
bool
enabled()
Whether or not this tracer is enabled.
at line 258
attributeAdded(Span $span, string $attribute, string $value)
Triggers when an attribute is added to a span.