function ParentBased::__construct
ParentBased sampler delegates the sampling decision based on the parent context.
Parameters
SamplerInterface $root Sampler called for the span with no parent (root span).:
SamplerInterface|null $remoteParentSampler Sampler called for the span with the remote sampled parent. When null, `AlwaysOnSampler` is used.:
SamplerInterface|null $remoteParentNotSampler Sampler called for the span with the remote not sampled parent. When null, `AlwaysOffSampler` is used.:
SamplerInterface|null $localParentSampler Sampler called for the span with local the sampled parent. When null, `AlwaysOnSampler` is used.:
SamplerInterface|null $localParentNotSampler Sampler called for the span with the local not sampled parent. When null, `AlwaysOffSampler` is used.:
File
-
vendor/
open-telemetry/ sdk/ Trace/ Sampler/ ParentBased.php, line 46
Class
- ParentBased
- This implementation of the SamplerInterface that respects parent context's sampling decision and delegates for the root span. Example: ``` use OpenTelemetry\API\Trace\ParentBased; use OpenTelemetry\API\Trace\AlwaysOnSampler
Namespace
OpenTelemetry\SDK\Trace\SamplerCode
public function __construct(SamplerInterface $root, ?SamplerInterface $remoteParentSampler = null, ?SamplerInterface $remoteParentNotSampler = null, ?SamplerInterface $localParentSampler = null, ?SamplerInterface $localParentNotSampler = null) {
$this->remoteParentSampler = $remoteParentSampler ?? new AlwaysOnSampler();
$this->remoteParentNotSampler = $remoteParentNotSampler ?? new AlwaysOffSampler();
$this->localParentSampler = $localParentSampler ?? new AlwaysOnSampler();
$this->localParentNotSampler = $localParentNotSampler ?? new AlwaysOffSampler();
}