SpanStatus
Read onlyYes
FinalYes
Represents the status of a span.
SpanStatus combines a status code with an optional description message. According to OpenTelemetry specification, descriptions are only meaningful for ERROR status.
Example usage:
$status = SpanStatus::ok();
$status = SpanStatus::error('Connection timeout');
Properties
- $code : SpanStatusCode
- $description : string|null
Methods
- __construct() : mixed
- error() : self
- Create an ERROR status with an optional description.
- fromArray() : self
- Create a SpanStatus from a normalized array representation.
- isError() : bool
- Check if the status is ERROR.
- isOk() : bool
- Check if the status is OK.
- isUnset() : bool
- Check if the status is UNSET.
- normalize() : array{code: int, description: null|string}
- Normalize the SpanStatus to an array representation for serialization.
- ok() : self
- Create an OK status.
- unset() : self
- Create an UNSET status (default).
Properties
$code
public
SpanStatusCode
$code
$description
public
string|null
$description
= null
Methods
__construct()
public
__construct(SpanStatusCode $code[, string|null $description = null ]) : mixed
Parameters
- $code : SpanStatusCode
- $description : string|null = null
error()
Create an ERROR status with an optional description.
public
static error([string|null $description = null ]) : self
Parameters
- $description : string|null = null
Return values
selffromArray()
Create a SpanStatus from a normalized array representation.
public
static fromArray(array{code: int, description: null|string} $data) : self
Parameters
- $data : array{code: int, description: null|string}
-
Normalized SpanStatus data
Return values
selfisError()
Check if the status is ERROR.
public
isError() : bool
Return values
boolisOk()
Check if the status is OK.
public
isOk() : bool
Return values
boolisUnset()
Check if the status is UNSET.
public
isUnset() : bool
Return values
boolnormalize()
Normalize the SpanStatus to an array representation for serialization.
public
normalize() : array{code: int, description: null|string}
Return values
array{code: int, description: null|string}ok()
Create an OK status.
public
static ok() : self
Return values
selfunset()
Create an UNSET status (default).
public
static unset() : self