function AlwaysOnSampler::shouldSample
Returns true because we always want to sample.
Overrides SamplerInterface::shouldSample
File
-
vendor/
open-telemetry/ sdk/ Trace/ Sampler/ AlwaysOnSampler.php, line 27
Class
- AlwaysOnSampler
- This implementation of the SamplerInterface always records. Example: ``` use OpenTelemetry\Sdk\Trace\AlwaysOnSampler; $sampler = new AlwaysOnSampler(); ```
Namespace
OpenTelemetry\SDK\Trace\SamplerCode
public function shouldSample(ContextInterface $parentContext, string $traceId, string $spanName, int $spanKind, AttributesInterface $attributes, array $links) : SamplingResult {
$parentSpan = Span::fromContext($parentContext);
$parentSpanContext = $parentSpan->getContext();
$traceState = $parentSpanContext->getTraceState();
return new SamplingResult(SamplingResult::RECORD_AND_SAMPLE, [], $traceState);
}