function BatchSpanProcessor::onEnd
Overrides SpanProcessorInterface::onEnd
File
-
vendor/
open-telemetry/ sdk/ Trace/ SpanProcessor/ BatchSpanProcessor.php, line 146
Class
Namespace
OpenTelemetry\SDK\Trace\SpanProcessorCode
public function onEnd(ReadableSpanInterface $span) : void {
if ($this->closed) {
return;
}
if (!$span->getContext()
->isSampled()) {
return;
}
if ($this->queueSize === $this->maxQueueSize) {
$this->dropped++;
return;
}
$this->queueSize++;
$this->batch[] = $span->toSpanData();
$this->nextScheduledRun ??= $this->clock
->now() + $this->scheduledDelayNanos;
if (count($this->batch) === $this->maxExportBatchSize) {
$this->enqueueBatch();
}
if ($this->autoFlush) {
$this->flush();
}
}