MediaWiki master
Wikimedia\Telemetry\ProbabilisticSampler Class Reference

A SamplerInterface implementation that samples a given percentage of root spans, while respecting sampling decisions made by other samplers for a given trace. More...

Inherits Wikimedia\Telemetry\SamplerInterface.

Collaboration diagram for Wikimedia\Telemetry\ProbabilisticSampler:

Public Member Functions

 __construct (int $percentChance)
 
 shouldSample (?SpanContext $parentSpanContext)
 Determine whether a newly created span should be sampled based on its parent span data.
Parameters
SpanContext | null$parentSpanContextContext of he parent span of the newly created span, or null if the newly created span is a root span.
Returns
bool Whether the newly created span should be sampled.

 

Detailed Description

A SamplerInterface implementation that samples a given percentage of root spans, while respecting sampling decisions made by other samplers for a given trace.

Since
1.43
Access: internal

Definition at line 13 of file ProbabilisticSampler.php.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Telemetry\ProbabilisticSampler::__construct ( int $percentChance)

Definition at line 20 of file ProbabilisticSampler.php.

Member Function Documentation

◆ shouldSample()

Wikimedia\Telemetry\ProbabilisticSampler::shouldSample ( ?SpanContext $parentSpanContext)

Determine whether a newly created span should be sampled based on its parent span data.

Parameters
SpanContext | null$parentSpanContextContext of he parent span of the newly created span, or null if the newly created span is a root span.
Returns
bool Whether the newly created span should be sampled.

Implements Wikimedia\Telemetry\SamplerInterface.

Definition at line 30 of file ProbabilisticSampler.php.

References Wikimedia\Telemetry\SpanContext\isSampled().


The documentation for this class was generated from the following file: