SpanInterface
interface SpanInterface implements ExecutionSegmentInterface (View source)
Methods
Hex encoded 64 random bits (== 8 bytes == 16 hex digits) ID.
Hex encoded 128 random bits (== 16 bytes == 32 hex digits) ID of the correlated trace.
Begins a new span with this execution segment as the new span's parent.
Begins a new span with this execution segment as the new span's parent, runs the provided callback as the new span and automatically ends the new span.
- For transactions: The name of this transaction.
Type is a keyword of specific relevance in the service's domain e.g.,
- For transaction: 'db', 'external' for a span and 'request', 'backgroundjob' for a transaction, etc.
Returns distributed tracing data for the current span/transaction
Sets the end timestamp and finalizes this object's state.
Returns true if this execution segment has already ended.
Creates an error based on the given Throwable instance with this execution segment as the parent.
Creates an error based on the given Throwable instance with this execution segment as the parent.
The outcome of the transaction/span: success, failure, or unknown.
Returns true if this execution segment is a no-op (for example when recording is disabled).
Hex encoded 64 random bits ID of the correlated transaction.
Hex encoded 64 random bits ID of the parent.
The specific kind of event within the sub-type represented by the span e.g., 'query' for type/sub-type 'db'/'mysql', 'connect' for type/sub-type 'db'/'cassandra'
A further sub-division of the type e.g., 'mysql', 'postgresql' or 'elasticsearch' for type 'db', 'http' for type 'external', etc.
Returns context (context allows to set labels, etc.)
Extended version of ExecutionSegmentInterface::end()
Details
string
getId()
Hex encoded 64 random bits (== 8 bytes == 16 hex digits) ID.
string
getTraceId()
Hex encoded 128 random bits (== 16 bytes == 32 hex digits) ID of the correlated trace.
float
getTimestamp()
Recorded time of the event.
For events that have non-zero duration this time corresponds to the start of the event. UTC based and in microseconds since Unix epoch.
SpanInterface
beginChildSpan(string $name, string $type, string|null $subtype = null, string|null $action = null, float|null $timestamp = null)
Begins a new span with this execution segment as the new span's parent.
mixed
captureChildSpan(string $name, string $type, Closure $callback, string|null $subtype = null, string|null $action = null, float|null $timestamp = null)
Begins a new span with this execution segment as the new span's parent, runs the provided callback as the new span and automatically ends the new span.
void
setName(string $name)
- For transactions: The name of this transaction.
Generic designation of a transaction in the scope of a single service (eg: 'GET /users/:id').
- For spans: Generic designation of a span in the scope of a transaction.
The length of this string is limited to 1024.
void
setType(string $type)
Type is a keyword of specific relevance in the service's domain e.g.,
- For transaction: 'db', 'external' for a span and 'request', 'backgroundjob' for a transaction, etc.
- For span: 'db.postgresql.query', 'template.erb', etc.
The length of this string is limited to 1024.
DistributedTracingData|null
getDistributedTracingData()
deprecated
deprecated
No description
void
injectDistributedTracingHeaders(Closure $headerInjector)
Returns distributed tracing data for the current span/transaction
$headerInjector is callback to inject headers with signature
(string $headerName, string $headerValue): void
void
end(float|null $duration = null)
Sets the end timestamp and finalizes this object's state.
If any mutating method (for example any set...
method is a mutating method)
is called on a instance which has already then a warning is logged.
For example, end() is a mutating method as well.
bool
hasEnded()
Returns true if this execution segment has already ended.
string|null
createErrorFromThrowable(Throwable $throwable)
Creates an error based on the given Throwable instance with this execution segment as the parent.
string|null
createCustomError(CustomErrorData $customErrorData)
Creates an error based on the given Throwable instance with this execution segment as the parent.
void
setOutcome(string|null $outcome)
The outcome of the transaction/span: success, failure, or unknown.
Outcome may be one of a limited set of permitted values describing the success or failure of the transaction/span. This field can be used for calculating error rates for incoming/outgoing requests.
string|null
getOutcome()
No description
bool
isNoop()
Returns true if this execution segment is a no-op (for example when recording is disabled).
void
discard()
Discards this execution segment.
string
getTransactionId()
Hex encoded 64 random bits ID of the correlated transaction.
string
getParentId()
Hex encoded 64 random bits ID of the parent.
If this span is the root span of the correlated transaction the its parent is the correlated transaction otherwise its parent is the parent span.
void
setAction(string|null $action)
The specific kind of event within the sub-type represented by the span e.g., 'query' for type/sub-type 'db'/'mysql', 'connect' for type/sub-type 'db'/'cassandra'
The length of this string is limited to 1024.
void
setSubtype(string|null $subtype)
A further sub-division of the type e.g., 'mysql', 'postgresql' or 'elasticsearch' for type 'db', 'http' for type 'external', etc.
The length of this string is limited to 1024.
SpanContextInterface
context()
Returns context (context allows to set labels, etc.)
void
endSpanEx(int $numberOfStackFramesToSkip, float|null $duration = null)
Extended version of ExecutionSegmentInterface::end()