class TracerSharedState
Stores shared state/config between all {
Hierarchy
- class \OpenTelemetry\SDK\Trace\TracerSharedState
Expanded class hierarchy of TracerSharedState
See also
API\TracerInterface} created via the same {@see API\TracerProviderInterface}.
File
-
vendor/
open-telemetry/ sdk/ Trace/ TracerSharedState.php, line 16
Namespace
OpenTelemetry\SDK\TraceView source
final class TracerSharedState {
private readonly SpanProcessorInterface $spanProcessor;
private ?bool $shutdownResult = null;
public function __construct(IdGeneratorInterface $idGenerator, ResourceInfo $resource, SpanLimits $spanLimits, SamplerInterface $sampler, array $spanProcessors) {
$this->spanProcessor = match (count($spanProcessors)) { 0 => NoopSpanProcessor::getInstance(),
1 => $spanProcessors[0],
default => new MultiSpanProcessor(...$spanProcessors),
};
}
public function hasShutdown() : bool {
return null !== $this->shutdownResult;
}
public function getIdGenerator() : IdGeneratorInterface {
return $this->idGenerator;
}
public function getResource() : ResourceInfo {
return $this->resource;
}
public function getSpanLimits() : SpanLimits {
return $this->spanLimits;
}
public function getSampler() : SamplerInterface {
return $this->sampler;
}
public function getSpanProcessor() : SpanProcessorInterface {
return $this->spanProcessor;
}
/**
* Returns `false` is the provider is already shutdown, otherwise `true`.
*/
public function shutdown(?CancellationInterface $cancellation = null) : bool {
return $this->shutdownResult ?? ($this->shutdownResult = $this->spanProcessor
->shutdown($cancellation));
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
TracerSharedState::$shutdownResult | private | property | |
TracerSharedState::$spanProcessor | private | property | |
TracerSharedState::getIdGenerator | public | function | |
TracerSharedState::getResource | public | function | |
TracerSharedState::getSampler | public | function | |
TracerSharedState::getSpanLimits | public | function | |
TracerSharedState::getSpanProcessor | public | function | |
TracerSharedState::hasShutdown | public | function | |
TracerSharedState::shutdown | public | function | Returns `false` is the provider is already shutdown, otherwise `true`. |
TracerSharedState::__construct | public | function |