@@ -419,7 +419,7 @@ impl BatchLogProcessor {
419419 let _ = export_with_timeout_sync (
420420 config. max_export_timeout ,
421421 & mut exporter,
422- logs. split_off ( 0 ) ,
422+ & mut logs,
423423 & mut last_export_time,
424424 ) ;
425425 }
@@ -429,7 +429,7 @@ impl BatchLogProcessor {
429429 let result = export_with_timeout_sync (
430430 config. max_export_timeout ,
431431 & mut exporter,
432- logs. split_off ( 0 ) ,
432+ & mut logs,
433433 & mut last_export_time,
434434 ) ;
435435 let _ = sender. send ( result) ;
@@ -439,7 +439,7 @@ impl BatchLogProcessor {
439439 let result = export_with_timeout_sync (
440440 config. max_export_timeout ,
441441 & mut exporter,
442- logs. split_off ( 0 ) ,
442+ & mut logs,
443443 & mut last_export_time,
444444 ) ;
445445 let _ = sender. send ( result) ;
@@ -463,7 +463,7 @@ impl BatchLogProcessor {
463463 let _ = export_with_timeout_sync (
464464 config. max_export_timeout ,
465465 & mut exporter,
466- logs. split_off ( 0 ) ,
466+ & mut logs,
467467 & mut last_export_time,
468468 ) ;
469469 }
@@ -512,7 +512,7 @@ impl BatchLogProcessor {
512512fn export_with_timeout_sync < E > (
513513 _: Duration , // TODO, enforcing timeout in exporter.
514514 exporter : & mut E ,
515- batch : Vec < Box < ( LogRecord , InstrumentationScope ) > > ,
515+ batch : & mut Vec < Box < ( LogRecord , InstrumentationScope ) > > ,
516516 last_export_time : & mut Instant ,
517517) -> ExportResult
518518where
@@ -528,9 +528,13 @@ where
528528 . iter ( )
529529 . map ( |log_data| ( & log_data. 0 , & log_data. 1 ) )
530530 . collect ( ) ;
531+
531532 let export = exporter. export ( LogBatch :: new ( log_vec. as_slice ( ) ) ) ;
532533 let export_result = futures_executor:: block_on ( export) ;
533534
535+ // Clear the batch vec after exporting
536+ batch. clear ( ) ;
537+
534538 match export_result {
535539 Ok ( _) => LogResult :: Ok ( ( ) ) ,
536540 Err ( err) => {
0 commit comments