TracerInterface
interface TracerInterface
This interface allows you to use the null object pattern for your tracer.
Whenever you want to instrument your code, you don't need to check if the configured tracer is null or a real tracer.
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.
Details
at line 40
mixed
inSpan(array $spanOptions, callable $callable, array $arguments = [])
Instrument a callable by creating a Span
at line 48
startSpan(array $spanOptions)
Start 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 57
Scope
withSpan(Span $span)
Attaches the provided span as the current span and returns a Scope object which must be closed.
at line 64
SpanData[]
spans()
Return the spans collected.
at line 75
addAttribute(string $attribute, string $value, array $options = [])
Add an attribute to the provided Span
at line 87
addAnnotation(string $description, array $options = [])
Add an annotation to the provided Span
at line 102
addLink(string $traceId, string $spanId, array $options = [])
Add a link to the provided Span
at line 119
addMessageEvent(string $type, string $id, array $options = [])
Add an message event to the provided Span
at line 126
SpanContext
spanContext()
Returns the current SpanContext
at line 133
bool
enabled()
Whether or not this tracer is enabled.