Skip to content

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.

final class ReceivedSpan

SourceReceivedSpan.php
PropertyTypeDescription
$attributesarrayreadonly.
$endTimeUnixNanointreadonly.
$kindintreadonly.
$namestringreadonly.
$parentSpanId?``stringreadonly.
$resourceAttributesarrayreadonly.
$spanIdstringreadonly.
$startTimeUnixNanointreadonly.
$statusCodeintreadonly.
$statusMessagestringreadonly.
$traceIdstringreadonly.

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

ParameterTypeDescription
$traceIdstring
$spanIdstring
$parentSpanId?``string
$namestring
$kindint
$startTimeUnixNanoint
$endTimeUnixNanoint
$statusCodeint
$statusMessagestring
$attributesarray``<``string``, ``mixed``>
$resourceAttributesarray``<``string``, ``mixed``>

Returns mixed

MethodDescription
durationMillis(): floatThe span’s duration in milliseconds, derived from ReceivedSpan::durationNanos().
durationNanos(): intThe 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(): boolOTel Status.StatusCode: 0 = Unset, 1 = Ok, 2 = Error.
isRoot(): boolWhether this is the trace’s root span, i.e.
serviceName(): ?stringThe service.name resource attribute, or null when the exporter sent no such attribute or sent a non-string value for it.

public function durationMillis(): float

The span’s duration in milliseconds, derived from ReceivedSpan::durationNanos().

Returns float

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

public function isError(): bool

OTel Status.StatusCode: 0 = Unset, 1 = Ok, 2 = Error.

Returns bool

public function isRoot(): bool

Whether this is the trace’s root span, i.e.

it carries no parent span ID.

Returns bool

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