ParentBasedSampler implements Sampler
Read onlyYes
FinalYes
Interfaces
Methods
- __construct() : mixed
- __toString() : string
- Get a string representation of this sampler for debugging.
- shouldSample() : SamplingResult
- Determine if a span should be sampled.
Methods
__construct()
public
__construct(Sampler $rootSampler[, null|Sampler $remoteParentSampled = null ][, null|Sampler $remoteParentNotSampled = null ][, null|Sampler $localParentSampled = null ][, null|Sampler $localParentNotSampled = null ]) : mixed
Parameters
- $rootSampler : Sampler
-
Sampler to use for root spans (no parent)
- $remoteParentSampled : null|Sampler = null
-
Sampler for remote sampled parents (default: AlwaysOnSampler)
- $remoteParentNotSampled : null|Sampler = null
-
Sampler for remote non-sampled parents (default: AlwaysOffSampler)
- $localParentSampled : null|Sampler = null
-
Sampler for local sampled parents (default: AlwaysOnSampler)
- $localParentNotSampled : null|Sampler = null
-
Sampler for local non-sampled parents (default: AlwaysOffSampler)
__toString()
Get a string representation of this sampler for debugging.
public
__toString() : string
Examples:
- "AlwaysOnSampler"
- "TraceIdRatioBasedSampler{0.001}"
- "ParentBased{root=AlwaysOnSampler}"
Return values
stringshouldSample()
Determine if a span should be sampled.
public
shouldSample(Context $parentContext, Span $span) : SamplingResult
Parameters
- $parentContext : Context
-
The parent context of the span to be created
- $span : Span
-
The span to evaluate for sampling
Return values
SamplingResult —The sampling decision