class AlwaysOffSampler
This implementation of the SamplerInterface always skips record. Example: ``` use OpenTelemetry\Sdk\Trace\AlwaysOffSampler; $sampler = new AlwaysOffSampler(); ```
Hierarchy
- class \OpenTelemetry\SDK\Trace\Sampler\AlwaysOffSampler implements \OpenTelemetry\SDK\Trace\SamplerInterface
Expanded class hierarchy of AlwaysOffSampler
1 file declares its use of AlwaysOffSampler
- SamplerFactory.php in vendor/
open-telemetry/ sdk/ Trace/ SamplerFactory.php
1 string reference to 'AlwaysOffSampler'
- AlwaysOffSampler::getDescription in vendor/
open-telemetry/ sdk/ Trace/ Sampler/ AlwaysOffSampler.php - Returns the sampler name or short description with the configuration. This may be displayed on debug pages or in the logs. Example: "TraceIdRatioBasedSampler{0.000100}"
File
-
vendor/
open-telemetry/ sdk/ Trace/ Sampler/ AlwaysOffSampler.php, line 21
Namespace
OpenTelemetry\SDK\Trace\SamplerView source
class AlwaysOffSampler implements SamplerInterface {
/**
* Returns false because we never want to sample.
* {@inheritdoc}
*/
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::DROP, [], $traceState);
}
public function getDescription() : string {
return 'AlwaysOffSampler';
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
AlwaysOffSampler::getDescription | public | function | Returns the sampler name or short description with the configuration. This may be displayed on debug pages or in the logs. Example: "TraceIdRatioBasedSampler{0.000100}" |
Overrides SamplerInterface::getDescription |
AlwaysOffSampler::shouldSample | public | function | Returns false because we never want to sample. | Overrides SamplerInterface::shouldSample |