diff --git a/opentelemetry-sdk/src/logs/log_processor.rs b/opentelemetry-sdk/src/logs/log_processor.rs index bfcd9e80fd..61823ab854 100644 --- a/opentelemetry-sdk/src/logs/log_processor.rs +++ b/opentelemetry-sdk/src/logs/log_processor.rs @@ -419,7 +419,7 @@ impl BatchLogProcessor { let _ = export_with_timeout_sync( config.max_export_timeout, &mut exporter, - logs.split_off(0), + &mut logs, &mut last_export_time, ); } @@ -429,7 +429,7 @@ impl BatchLogProcessor { let result = export_with_timeout_sync( config.max_export_timeout, &mut exporter, - logs.split_off(0), + &mut logs, &mut last_export_time, ); let _ = sender.send(result); @@ -439,7 +439,7 @@ impl BatchLogProcessor { let result = export_with_timeout_sync( config.max_export_timeout, &mut exporter, - logs.split_off(0), + &mut logs, &mut last_export_time, ); let _ = sender.send(result); @@ -463,7 +463,7 @@ impl BatchLogProcessor { let _ = export_with_timeout_sync( config.max_export_timeout, &mut exporter, - logs.split_off(0), + &mut logs, &mut last_export_time, ); } @@ -512,7 +512,7 @@ impl BatchLogProcessor { fn export_with_timeout_sync( _: Duration, // TODO, enforcing timeout in exporter. exporter: &mut E, - batch: Vec>, + batch: &mut Vec>, last_export_time: &mut Instant, ) -> ExportResult where @@ -528,9 +528,13 @@ where .iter() .map(|log_data| (&log_data.0, &log_data.1)) .collect(); + let export = exporter.export(LogBatch::new(log_vec.as_slice())); let export_result = futures_executor::block_on(export); + // Clear the batch vec after exporting + batch.clear(); + match export_result { Ok(_) => LogResult::Ok(()), Err(err) => {