From 884fd92f1320d17daebb772297da03fb2cfa59b8 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 1 Oct 2024 16:00:34 +0300 Subject: drop opentelemetry --- .../exporter-otlp/ProtobufSerializer.php | 115 --------------------- 1 file changed, 115 deletions(-) delete mode 100644 vendor/open-telemetry/exporter-otlp/ProtobufSerializer.php (limited to 'vendor/open-telemetry/exporter-otlp/ProtobufSerializer.php') diff --git a/vendor/open-telemetry/exporter-otlp/ProtobufSerializer.php b/vendor/open-telemetry/exporter-otlp/ProtobufSerializer.php deleted file mode 100644 index c244d0066..000000000 --- a/vendor/open-telemetry/exporter-otlp/ProtobufSerializer.php +++ /dev/null @@ -1,115 +0,0 @@ -contentType = $contentType; - } - - public static function getDefault(): ProtobufSerializer - { - return new self(self::PROTOBUF); - } - - /** - * @psalm-param TransportInterface $transport - */ - public static function forTransport(TransportInterface $transport): ProtobufSerializer - { - switch ($contentType = $transport->contentType()) { - case self::PROTOBUF: - case self::JSON: - case self::NDJSON: - return new self($contentType); - default: - throw new InvalidArgumentException(sprintf('Not supported content type "%s"', $contentType)); - } - } - - public function serializeTraceId(string $traceId): string - { - switch ($this->contentType) { - case self::PROTOBUF: - return $traceId; - case self::JSON: - case self::NDJSON: - return base64_decode(bin2hex($traceId)); - default: - throw new AssertionError(); - } - } - - public function serializeSpanId(string $spanId): string - { - switch ($this->contentType) { - case self::PROTOBUF: - return $spanId; - case self::JSON: - case self::NDJSON: - return base64_decode(bin2hex($spanId)); - default: - throw new AssertionError(); - } - } - - public function serialize(Message $message): string - { - switch ($this->contentType) { - case self::PROTOBUF: - return $message->serializeToString(); - case self::JSON: - //@todo https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/otlp.md#json-protobuf-encoding - return $message->serializeToJsonString(); - case self::NDJSON: - return $message->serializeToJsonString() . "\n"; - default: - throw new AssertionError(); - } - } - - /** - * @throws Exception - */ - public function hydrate(Message $message, string $payload): void - { - switch ($this->contentType) { - case self::PROTOBUF: - $message->mergeFromString($payload); - - break; - case self::JSON: - case self::NDJSON: - // @phan-suppress-next-line PhanParamTooManyInternal - $message->mergeFromJsonString($payload, true); - - break; - default: - throw new AssertionError(); - } - } -} -- cgit v1.2.3-54-g00ecf