ReceivedSpan
A span decoded from an OTLP ExportTraceServiceRequest by OtlpDecoder, flattened into plain PHP values so nothing downstream (DashboardState, DashboardView, tests) needs to touch protobuf types.
Synopsis
Section titled “Synopsis”final class ReceivedSpan
| Source | ReceivedSpan.php |
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
$attributes | array | readonly. |
$endTimeUnixNano | int | readonly. |
$kind | int | readonly. |
$name | string | readonly. |
$parentSpanId | ?``string | readonly. |
$resourceAttributes | array | readonly. |
$spanId | string | readonly. |
$startTimeUnixNano | int | readonly. |
$statusCode | int | readonly. |
$statusMessage | string | readonly. |
$traceId | string | readonly. |
Constructor
Section titled “Constructor”__construct()
Section titled “__construct()”public function __construct(string $traceId, string $spanId, ?string $parentSpanId, string $name, int $kind, int $startTimeUnixNano, int $endTimeUnixNano, int $statusCode, string $statusMessage, array<string, mixed> $attributes, array<string, mixed> $resourceAttributes): mixed
| Parameter | Type | Description |
|---|---|---|
$traceId | string | |
$spanId | string | |
$parentSpanId | ?``string | |
$name | string | |
$kind | int | |
$startTimeUnixNano | int | |
$endTimeUnixNano | int | |
$statusCode | int | |
$statusMessage | string | |
$attributes | array``<``string``, ``mixed``> | |
$resourceAttributes | array``<``string``, ``mixed``> |
Returns mixed
Methods
Section titled “Methods”| Method | Description |
|---|---|
durationMillis(): float | The span’s duration in milliseconds, derived from ReceivedSpan::durationNanos(). |
durationNanos(): int | The span’s wall-clock duration in nanoseconds, clamped at zero so an end timestamp that precedes the start one never yields a negative duration. |
isError(): bool | OTel Status.StatusCode: 0 = Unset, 1 = Ok, 2 = Error. |
isRoot(): bool | Whether this is the trace’s root span, i.e. |
serviceName(): ?string | The service.name resource attribute, or null when the exporter sent no such attribute or sent a non-string value for it. |
durationMillis()
Section titled “durationMillis()”public function durationMillis(): float
The span’s duration in milliseconds, derived from ReceivedSpan::durationNanos().
Returns float
durationNanos()
Section titled “durationNanos()”public function durationNanos(): int
The span’s wall-clock duration in nanoseconds, clamped at zero so an end timestamp that precedes the start one never yields a negative duration.
Returns int
isError()
Section titled “isError()”public function isError(): bool
OTel Status.StatusCode: 0 = Unset, 1 = Ok, 2 = Error.
Returns bool
isRoot()
Section titled “isRoot()”public function isRoot(): bool
Whether this is the trace’s root span, i.e.
it carries no parent span ID.
Returns bool
serviceName()
Section titled “serviceName()”public function serviceName(): ?string
The service.name resource attribute, or null when the exporter sent no such attribute or sent a non-string value for it.
Returns ?``string