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']);
Tags
phpstan-import-type

TAttributeValueMap from Attributes

Properties

$attributes  : Attributes
$context  : SpanContext
$droppedAttributeCount  : int

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, droppedAttributeCount: int}
Normalize the SpanLink to an array representation for serialization.

Properties

$droppedAttributeCount

public int $droppedAttributeCount = 0

Methods

create()

Create a SpanLink with the given context and optional attributes.

public static create(SpanContext $context[, Attributes|TAttributeValueMap $attributes = [] ][, int $droppedAttributeCount = 0 ]) : self
Parameters
$context : SpanContext

The linked span's context

$attributes : Attributes|TAttributeValueMap = []

Link attributes

$droppedAttributeCount : int = 0

Number of attributes dropped due to limits

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, droppedAttributeCount?: int} $data) : self
Parameters
$data : array{context: array{traceId: array{hex: string}, spanId: array{hex: string}, parentSpanId: null|array{hex: string}, isRemote: bool}, attributes: array, droppedAttributeCount?: int}

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, droppedAttributeCount: int}
Return values
array{context: array{traceId: array{hex: string}, spanId: array{hex: string}, parentSpanId: null|array{hex: string}, isRemote: bool}, attributes: array, droppedAttributeCount: int}

        
On this page

Search results