From b826a68e40ae9fd32aa183642e4b1294a6bfcd68 Mon Sep 17 00:00:00 2001 From: AleksSem Date: Tue, 4 Jun 2024 09:25:54 +0300 Subject: [PATCH] - fix UDP batching error errno=90 Message too large --- src/Jaeger/Transport/TransportUdp.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Jaeger/Transport/TransportUdp.php b/src/Jaeger/Transport/TransportUdp.php index 3d667ae..173d3ae 100644 --- a/src/Jaeger/Transport/TransportUdp.php +++ b/src/Jaeger/Transport/TransportUdp.php @@ -110,21 +110,21 @@ public function append(Jaeger $jaeger): bool $spanThrift = $this->jaegerThrift->buildSpanThrift($span); $spanSize = $this->getAndCalcSizeOfSerializedThrift($spanThrift); if ($spanSize > self::$maxSpanBytes) { - //throw new \Exception("Span is too large"); continue; } - $thriftSpansBuffer[] = $spanThrift; - $this->bufferSize += $spanSize; - - if ($this->bufferSize >= self::$maxSpanBytes) { + if ($this->bufferSize + $spanSize >= self::$maxSpanBytes) { self::$batch = new Batch([ 'process' => $this->process, 'spans' => $thriftSpansBuffer, ]); $this->flush(); $thriftSpansBuffer = []; // Empty the temp buffer + $this->bufferSize = 0; } + + $thriftSpansBuffer[] = $spanThrift; + $this->bufferSize += $spanSize; } if (count($thriftSpansBuffer) > 0) {