Flow PHP

SpanLink

Read onlyYes
FinalYes

A link from one span to another.

Links are used to associate spans that are causally related but not in a direct parent-child relationship. Common use cases include:

  • Batch operations where one span triggers multiple others
  • Fan-in/fan-out patterns
  • Linking to spans from previous traces

Example usage:

$link = SpanLink::create($otherSpanContext, ['reason' => 'batch']);

Properties

$attributes  : Attributes
$context  : SpanContext

Methods

__construct()  : mixed
create()  : self
Create a SpanLink with the given context and optional attributes.
fromArray()  : self
Create a SpanLink from a normalized array representation.
normalize()  : array{context: array{traceId: array{hex: string}, spanId: array{hex: string}, parentSpanId: null|array{hex: string}, isRemote: bool}, attributes: array}
Normalize the SpanLink to an array representation for serialization.

Properties

Methods

create()

Create a SpanLink with the given context and optional attributes.

public static create(SpanContext $context[, array<string, array<string|int, bool|DateTimeInterface|float|int|string|Throwable>|bool|DateTimeInterface|float|int|string|Throwable$attributes = [] ]) : self
Parameters
$context : SpanContext

The linked span's context

$attributes : array<string, array<string|int, bool|DateTimeInterface|float|int|string|Throwable>|bool|DateTimeInterface|float|int|string|Throwable> = []

Link attributes

Return values
self

fromArray()

Create a SpanLink from a normalized array representation.

public static fromArray(array{context: array{traceId: array{hex: string}, spanId: array{hex: string}, parentSpanId: null|array{hex: string}, isRemote: bool}, attributes: array$data) : self
Parameters
$data : array{context: array{traceId: array{hex: string}, spanId: array{hex: string}, parentSpanId: null|array{hex: string}, isRemote: bool}, attributes: array}

Normalized SpanLink data

Return values
self

normalize()

Normalize the SpanLink to an array representation for serialization.

public normalize() : array{context: array{traceId: array{hex: string}, spanId: array{hex: string}, parentSpanId: null|array{hex: string}, isRemote: bool}, attributes: array}
Return values
array{context: array{traceId: array{hex: string}, spanId: array{hex: string}, parentSpanId: null|array{hex: string}, isRemote: bool}, attributes: array}

        
On this page

Search results