in prod/php/OpenTelemetry/Contrib/Otlp/SpanExporter.php [52:85]
public function export(iterable $batch, ?CancellationInterface $cancellation = null): FutureInterface
{
return $this->transport
->send(convert_spans($batch), $cancellation)
->map(
static function (mixed $payload): bool {
if ($payload === null) {
return true;
}
$serviceResponse = new ExportTraceServiceResponse();
$partialSuccess = $serviceResponse->getPartialSuccess();
if ($partialSuccess !== null && $partialSuccess->getRejectedSpans()) {
self::logError('Export partial success', [
'rejected_spans' => $partialSuccess->getRejectedSpans(),
'error_message' => $partialSuccess->getErrorMessage(),
]);
return false;
}
if ($partialSuccess !== null && $partialSuccess->getErrorMessage()) {
self::logWarning('Export success with warnings/suggestions', ['error_message' => $partialSuccess->getErrorMessage()]);
}
return true;
}
)->catch(
static function (Throwable $throwable): bool {
self::logError('Export failure', ['exception' => $throwable]);
return false;
}
);
}