in src/shippers/elastic_v3/server/src/server_shipper.ts [312:326]
private getEventsToSend(shouldFlush: boolean): Event[] {
// If the internal queue is already smaller than the minimum batch size, or it's a flush action, do a direct assignment.
if (shouldFlush || this.getQueueByteSize(this.internalQueue) < 10 * KIB) {
return this.internalQueue.splice(0, this.internalQueue.length);
}
// Otherwise, we'll feed the events to the leaky bucket queue until we reach 10kB.
const queue: Event[] = [];
let queueByteSize = 0;
while (queueByteSize < 10 * KIB) {
const event = this.internalQueue.shift()!;
queueByteSize += this.getEventSize(event);
queue.push(event);
}
return queue;
}