transport = $transport; $this->setSpanConverter($converter ?? new FriendlySpanConverter()); } public function export(iterable $batch, ?CancellationInterface $cancellation = null): FutureInterface { $payload = ''; foreach ($batch as $span) { try { $payload .= json_encode( $this->getSpanConverter()->convert([$span]), JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT ) . PHP_EOL; } catch (JsonException $e) { self::logWarning('Error converting span: ' . $e->getMessage()); } } return $this->transport->send($payload) ->map(fn () => true) ->catch(fn () => false); } public function shutdown(?CancellationInterface $cancellation = null): bool { return $this->transport->shutdown(); } public function forceFlush(?CancellationInterface $cancellation = null): bool { return $this->transport->forceFlush(); } }