diff options
| author | Andrew Dolgov <fox@fakecake.org> | 2024-10-01 16:00:34 +0300 |
|---|---|---|
| committer | Andrew Dolgov <fox@fakecake.org> | 2024-10-01 16:00:34 +0300 |
| commit | 884fd92f1320d17daebb772297da03fb2cfa59b8 (patch) | |
| tree | 3aa80af1df6ffa1d70f21f9fc4411f451c8b6c56 /vendor/open-telemetry/sdk/Trace/TracerSharedState.php | |
| parent | 8fcc68baf5b0ff964a0a4a045353462586e0e316 (diff) | |
drop opentelemetry
Diffstat (limited to 'vendor/open-telemetry/sdk/Trace/TracerSharedState.php')
| -rw-r--r-- | vendor/open-telemetry/sdk/Trace/TracerSharedState.php | 100 |
1 files changed, 0 insertions, 100 deletions
diff --git a/vendor/open-telemetry/sdk/Trace/TracerSharedState.php b/vendor/open-telemetry/sdk/Trace/TracerSharedState.php deleted file mode 100644 index d0540cc1f..000000000 --- a/vendor/open-telemetry/sdk/Trace/TracerSharedState.php +++ /dev/null @@ -1,100 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace OpenTelemetry\SDK\Trace; - -use OpenTelemetry\API\Trace as API; /** @phan-suppress-current-line PhanUnreferencedUseNormal */ -use OpenTelemetry\SDK\Common\Future\CancellationInterface; -use OpenTelemetry\SDK\Resource\ResourceInfo; -use OpenTelemetry\SDK\Trace\SpanProcessor\MultiSpanProcessor; -use OpenTelemetry\SDK\Trace\SpanProcessor\NoopSpanProcessor; - -/** - * Stores shared state/config between all {@see API\TracerInterface} created via the same {@see API\TracerProviderInterface}. - */ -final class TracerSharedState -{ - /** @readonly */ - private IdGeneratorInterface $idGenerator; - - /** @readonly */ - private ResourceInfo $resource; - - /** @readonly */ - private SpanLimits $spanLimits; - - /** @readonly */ - private SamplerInterface $sampler; - - /** @readonly */ - private SpanProcessorInterface $spanProcessor; - - private ?bool $shutdownResult = null; - - public function __construct( - IdGeneratorInterface $idGenerator, - ResourceInfo $resource, - SpanLimits $spanLimits, - SamplerInterface $sampler, - array $spanProcessors - ) { - $this->idGenerator = $idGenerator; - $this->resource = $resource; - $this->spanLimits = $spanLimits; - $this->sampler = $sampler; - - switch (count($spanProcessors)) { - case 0: - $this->spanProcessor = NoopSpanProcessor::getInstance(); - - break; - case 1: - $this->spanProcessor = $spanProcessors[0]; - - break; - default: - $this->spanProcessor = new MultiSpanProcessor(...$spanProcessors); - - break; - } - } - - 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)); - } -} |