Flow PHP

SamplingResult

Read onlyYes
FinalYes

Result of a sampling decision.

Contains the sampling decision along with additional attributes that should be added to the span and an optional updated trace state.

Example usage:

$result = new SamplingResult(
    SamplingDecision::RECORD_AND_SAMPLE,
    ['sampling.reason' => 'head-based'],
);

if ($result->decision->isSampled()) {
    // Create and export the span
}
Tags
phpstan-import-type

TAttributeValueMap from Attributes

Properties

$attributes  : TAttributeValueMap
$decision  : SamplingDecision
$traceState  : TraceState|null

Methods

__construct()  : mixed
drop()  : self
Create a result indicating the span should be dropped.
recordAndSample()  : self
Create a result indicating the span should be recorded and exported.
recordOnly()  : self
Create a result indicating the span should be recorded but not exported.

Properties

Methods

drop()

Create a result indicating the span should be dropped.

public static drop() : self
Return values
self

recordAndSample()

Create a result indicating the span should be recorded and exported.

public static recordAndSample([TAttributeValueMap|Attributes $attributes = [] ][, TraceState|null $traceState = null ]) : self
Parameters
$attributes : TAttributeValueMap|Attributes = []
$traceState : TraceState|null = null
Return values
self

recordOnly()

Create a result indicating the span should be recorded but not exported.

public static recordOnly([TAttributeValueMap|Attributes $attributes = [] ][, TraceState|null $traceState = null ]) : self
Parameters
$attributes : TAttributeValueMap|Attributes = []
$traceState : TraceState|null = null
Return values
self
On this page

Search results