class SpanData

This plain PHP class represents a read-only version of a single timed event within a Trace. Spans can be nested and form a trace tree. Often, a trace contains a root span that describes the end-to-end latency of an operation and, optionally, one or more subspans for its suboperations. Spans do not need to be contiguous. There may be gaps between spans in a trace.

Methods

__construct(string $name, string $traceId, string $spanId, DateTimeInterface $startTime = null, DateTimeInterface $endTime = null, array $options = [])

Instantiate a new SpanData instance.

startTime()

Retrieve the start time for this span.

endTime()

Retrieve the end time for this span.

string
traceId()

Retrieve the ID of this span's trace.

string
spanId()

Retrieve the ID of this span.

string
parentSpanId()

Retrieve the ID of this span's parent if it exists.

string
name()

Retrieve the name of this span.

array
attributes()

Return the attributes for this span.

timeEvents()

Return the time events for this span.

Link[]
links()

Return the links for this span.

status()

Retrieve the final status for this span.

array
stackTrace()

Retrieve the stackTrace at the moment this span was created

string
stackTraceHashId()

Return a hash id for this span's stackTrace in hexadecimal

bool
sameProcessAsParentSpan()

Whether or not this span is in the same process as its parent.

string
kind()

Returns the span kind.

Details

at line 169
__construct(string $name, string $traceId, string $spanId, DateTimeInterface $startTime = null, DateTimeInterface $endTime = null, array $options = [])

Instantiate a new SpanData instance.

Parameters

string $name The name of the span.
string $traceId The ID of the trace in hexadecimal.
string $spanId The ID of the span in hexadecimal.
DateTimeInterface $startTime Start time of the span.
DateTimeInterface $endTime End time of the span.
array $options [optional] Configuration options.

 @type string $parentSpanId ID of the parent span if any in
       hexadecimal.
 @type array $attributes Associative array of $attribute => $value
       to attach to this span.
 @type array $stackTrace Stacktrace in `debug_backtrace` format.
 @type TimeEvent[] $timeEvents Timing events.
 @type Link[] $links Link references.
 @type Status $status The final status for this span.
 @type bool $sameProcessAsParentSpan True when the parentSpanId
       belongs to the same process as the current span.
 @type string $kind The span's type.

at line 209
DateTimeInterface startTime()

Retrieve the start time for this span.

Return Value

DateTimeInterface

at line 219
DateTimeInterface endTime()

Retrieve the end time for this span.

Return Value

DateTimeInterface

at line 229
string traceId()

Retrieve the ID of this span's trace.

Return Value

string

at line 239
string spanId()

Retrieve the ID of this span.

Return Value

string

at line 249
string parentSpanId()

Retrieve the ID of this span's parent if it exists.

Return Value

string

at line 259
string name()

Retrieve the name of this span.

Return Value

string

at line 269
array attributes()

Return the attributes for this span.

Return Value

array

at line 279
TimeEvent[] timeEvents()

Return the time events for this span.

Return Value

TimeEvent[]

Return the links for this span.

Return Value

Link[]

at line 299
Status status()

Retrieve the final status for this span.

Return Value

Status

at line 309
array stackTrace()

Retrieve the stackTrace at the moment this span was created

Return Value

array

at line 319
string stackTraceHashId()

Return a hash id for this span's stackTrace in hexadecimal

Return Value

string

at line 334
bool sameProcessAsParentSpan()

Whether or not this span is in the same process as its parent.

Return Value

bool

at line 344
string kind()

Returns the span kind.

Return Value

string