From cdd7ad020e165fe680703b6d3319b908b682fb7a Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 20 Oct 2023 17:12:29 +0300 Subject: jaeger-client -> opentelemetry --- vendor/open-telemetry/api/Trace/SpanContext.php | 127 ++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 vendor/open-telemetry/api/Trace/SpanContext.php (limited to 'vendor/open-telemetry/api/Trace/SpanContext.php') diff --git a/vendor/open-telemetry/api/Trace/SpanContext.php b/vendor/open-telemetry/api/Trace/SpanContext.php new file mode 100644 index 000000000..7da7c0701 --- /dev/null +++ b/vendor/open-telemetry/api/Trace/SpanContext.php @@ -0,0 +1,127 @@ +isValid=false; + } + + $this->traceId = $traceId; + $this->spanId = $spanId; + $this->traceState = $traceState; + $this->isRemote = $isRemote; + $this->isSampled = ($traceFlags & TraceFlags::SAMPLED) === TraceFlags::SAMPLED; + $this->traceFlags = $traceFlags; + } + + public function getTraceId(): string + { + return $this->traceId; + } + + public function getTraceIdBinary(): string + { + return hex2bin($this->traceId); + } + + public function getSpanId(): string + { + return $this->spanId; + } + + public function getSpanIdBinary(): string + { + return hex2bin($this->spanId); + } + + public function getTraceState(): ?TraceStateInterface + { + return $this->traceState; + } + + public function isSampled(): bool + { + return $this->isSampled; + } + + public function isValid(): bool + { + return $this->isValid; + } + + public function isRemote(): bool + { + return $this->isRemote; + } + + public function getTraceFlags(): int + { + return $this->traceFlags; + } + + /** @inheritDoc */ + public static function createFromRemoteParent(string $traceId, string $spanId, int $traceFlags = TraceFlags::DEFAULT, ?TraceStateInterface $traceState = null): SpanContextInterface + { + return new self( + $traceId, + $spanId, + $traceFlags, + true, + $traceState, + ); + } + + /** @inheritDoc */ + public static function create(string $traceId, string $spanId, int $traceFlags = TraceFlags::DEFAULT, ?TraceStateInterface $traceState = null): SpanContextInterface + { + return new self( + $traceId, + $spanId, + $traceFlags, + false, + $traceState, + ); + } + + /** @inheritDoc */ + public static function getInvalid(): SpanContextInterface + { + if (null === self::$invalidContext) { + self::$invalidContext = self::create(SpanContextValidator::INVALID_TRACE, SpanContextValidator::INVALID_SPAN, 0); + } + + return self::$invalidContext; + } +} -- cgit v1.2.3-54-g00ecf