Skip to content

Commit

Permalink
Merge pull request #31 from jukylin/reuse_udpclient
Browse files Browse the repository at this point in the history
reuse udp client
  • Loading branch information
jky-yy authored Mar 21, 2019
2 parents df97620 + 7e75e3d commit b31a98b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Jaeger/Transport/TransportUdp.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,16 @@ public function flush(){
}

$spanNum = 0;
$udp = new UdpClient(self::$hostPort);

foreach (self::$batchs as $batch){
$spanNum += count($batch['thriftSpans']);
$udp = new UdpClient(self::$hostPort);
$udp->emitBatch($batch);
$udp->close();
}

$udp->close();
$this->resetBuffer();

return $spanNum;
}
}

0 comments on commit b31a98b

Please sign in to comment.