Skip to content

Commit 189959e

Browse files
committed
remove unwanted clearing and add doc comment
1 parent a9c1e0d commit 189959e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

opentelemetry-sdk/src/trace/span_processor.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -497,12 +497,15 @@ impl BatchSpanProcessor {
497497
return OTelSdkResult::Ok(());
498498
}
499499

500+
// Splitting off batch clears the existing batch capacity, and is ready
501+
// for re-use in the next export. The newly returned vec! from split_off
502+
// is passed to the exporter.
503+
// TODO: Compared to Logs, this requires new allocation for vec for
504+
// every export. See if this can be optimized by
505+
// *not* requiring ownership in the exporter.
500506
let export = exporter.export(batch.split_off(0));
501507
let export_result = futures_executor::block_on(export);
502508

503-
// Clear the batch vec after exporting
504-
batch.clear();
505-
506509
match export_result {
507510
Ok(_) => OTelSdkResult::Ok(()),
508511
Err(err) => {

0 commit comments

Comments
 (0)