TransactionInterface
interface TransactionInterface 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).
Transactions that are 'sampled' will include all available information Transactions that are not sampled will not have 'spans' or 'context'.
Hex encoded 64 random bits ID of the parent transaction or span.
Begins a new span with the current execution segment as the new span's parent and sets as the new span as the current span for this transaction.
Begins a new span with the current execution segment as the new span's parent and sets the new span as the current span for this transaction.
Returns the current span.
Returns context (context allows to set labels, etc.)
The result of the transaction.
No description
If the transaction does not have a parent ID yet, calling this method generates a new ID, sets it as the parent ID of this transaction, and returns it as a string.
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.
bool
isSampled()
Transactions that are 'sampled' will include all available information Transactions that are not sampled will not have 'spans' or 'context'.
string|null
getParentId()
Hex encoded 64 random bits ID of the parent transaction or span.
Only a root transaction of a trace does not have a parent ID, otherwise it needs to be set.
SpanInterface
beginCurrentSpan(string $name, string $type, string|null $subtype = null, string|null $action = null, float|null $timestamp = null)
Begins a new span with the current execution segment as the new span's parent and sets as the new span as the current span for this transaction.
The current execution segment is the current span if there is one or this transaction itself otherwise.
mixed
captureCurrentSpan(string $name, string $type, Closure $callback, string|null $subtype = null, string|null $action = null, float|null $timestamp = null)
Begins a new span with the current execution segment as the new span's parent and sets the new span as the current span for this transaction.
The current execution segment is the current span if there is one or this transaction itself otherwise.
SpanInterface
getCurrentSpan()
Returns the current span.
TransactionContextInterface
context()
Returns context (context allows to set labels, etc.)
void
setResult(string|null $result)
The result of the transaction.
For HTTP-related transactions, this should be the status code formatted like 'HTTP 2xx'.
string|null
getResult()
No description
string
ensureParentId()
If the transaction does not have a parent ID yet, calling this method generates a new ID, sets it as the parent ID of this transaction, and returns it as a string.