Flow PHP

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

$description

public string|null $description = null

Methods

error()

Create an ERROR status with an optional description.

public static error([string|null $description = null ]) : self
Parameters
$description : string|null = null
Return values
self

fromArray()

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
self

isError()

Check if the status is ERROR.

public isError() : bool
Return values
bool

isOk()

Check if the status is OK.

public isOk() : bool
Return values
bool

isUnset()

Check if the status is UNSET.

public isUnset() : bool
Return values
bool

normalize()

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
self

unset()

Create an UNSET status (default).

public static unset() : self
Return values
self

        
On this page

Search results