OpenTelemetry PHP

SamplingIntent
in package
implements SamplingIntentInterface

FinalYes

Immutable {@see SamplingIntentInterface}.

Tags
experimental

Table of Contents

Interfaces

SamplingIntentInterface
The sampling preference returned by a {@see ComposableSamplerInterface}.

Constants

INVALID_THRESHOLD  : mixed = -1
The threshold of an intent that drops the span.

Properties

$adjustedCountReliable  : bool
$attributes  : iterable<string|int, mixed>
$threshold  : int
$traceStateUpdater  : Closure|null

Methods

__construct()  : mixed
getAttributes()  : iterable<string, mixed>
Attributes to add to the span when it is sampled.
getThreshold()  : int
The rejection threshold: the lower, the more likely the span is sampled (0 samples every span).
isAdjustedCountReliable()  : bool
Whether the threshold can be used to compute the adjusted count (the reciprocal of the sampling probability, used for span to metrics estimation).
updateTraceState()  : TraceStateInterface
Returns the TraceState of the span, given the one of the parent and the final decision. Called for every span.

Constants

INVALID_THRESHOLD

The threshold of an intent that drops the span.

public mixed INVALID_THRESHOLD = -1

Properties

$adjustedCountReliable read-only

private bool $adjustedCountReliable = true

$attributes read-only

private iterable<string|int, mixed> $attributes = []

$traceStateUpdater read-only

private Closure|null $traceStateUpdater = null

Methods

__construct()

public __construct(int $threshold[, bool $adjustedCountReliable = true ][, iterable<string, mixed> $attributes = [] ][, callable(TraceStateInterface, bool): TraceStateInterface|null $traceStateUpdater = null ]) : mixed
Parameters
$threshold : int
$adjustedCountReliable : bool = true
$attributes : iterable<string, mixed> = []
$traceStateUpdater : callable(TraceStateInterface, bool): TraceStateInterface|null = null

Must not modify the ot entry

getAttributes()

Attributes to add to the span when it is sampled.

public getAttributes() : iterable<string, mixed>
Attributes
#[Override]
Return values
iterable<string, mixed>

getThreshold()

The rejection threshold: the lower, the more likely the span is sampled (0 samples every span).

public getThreshold() : int

SamplingIntent::INVALID_THRESHOLD means that the span is dropped.

Attributes
#[Override]
Return values
int

isAdjustedCountReliable()

Whether the threshold can be used to compute the adjusted count (the reciprocal of the sampling probability, used for span to metrics estimation).

public isAdjustedCountReliable() : bool
Attributes
#[Override]
Return values
bool

updateTraceState()

Returns the TraceState of the span, given the one of the parent and the final decision. Called for every span.

public updateTraceState(TraceStateInterface $parentState, bool $sampled) : TraceStateInterface

Implementations must not modify the ot entry, which is owned by the CompositeSampler.

Parameters
$parentState : TraceStateInterface
$sampled : bool

whether the final decision is RECORD_AND_SAMPLE

Attributes
#[Override]
Return values
TraceStateInterface
On this page

Search results