class AlwaysOnSampler
This implementation of the SamplerInterface always records. Example: ``` use OpenTelemetry\Sdk\Trace\AlwaysOnSampler; $sampler = new AlwaysOnSampler(); ```
Hierarchy
- class \OpenTelemetry\SDK\Trace\Sampler\AlwaysOnSampler implements \OpenTelemetry\SDK\Trace\SamplerInterface
Expanded class hierarchy of AlwaysOnSampler
2 files declare their use of AlwaysOnSampler
- SamplerFactory.php in vendor/
open-telemetry/ sdk/ Trace/ SamplerFactory.php - TracerProvider.php in vendor/
open-telemetry/ sdk/ Trace/ TracerProvider.php
1 string reference to 'AlwaysOnSampler'
- AlwaysOnSampler::getDescription in vendor/
open-telemetry/ sdk/ Trace/ Sampler/ AlwaysOnSampler.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/ AlwaysOnSampler.php, line 21
Namespace
OpenTelemetry\SDK\Trace\SamplerView source
class AlwaysOnSampler implements SamplerInterface {
/**
* Returns true because we always 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::RECORD_AND_SAMPLE, [], $traceState);
}
public function getDescription() : string {
return 'AlwaysOnSampler';
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
AlwaysOnSampler::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 |
AlwaysOnSampler::shouldSample | public | function | Returns true because we always want to sample. | Overrides SamplerInterface::shouldSample |