@@ -217,7 +217,6 @@ use crate::trace::ExportResult;
217217/// .with_max_queue_size(1024) // Buffer up to 1024 spans.
218218/// .with_max_export_batch_size(256) // Export in batches of up to 256 spans.
219219/// .with_scheduled_delay(Duration::from_secs(5)) // Export every 5 seconds.
220- /// .with_max_export_timeout(Duration::from_secs(10)) // Timeout after 10 seconds.
221220/// .build(),
222221/// )
223222/// .build();
@@ -443,20 +442,14 @@ impl BatchSpanProcessor {
443442 }
444443
445444 let count_of_spans = spans. len ( ) ; // Count of spans that will be exported
446- let result = Self :: export_with_timeout_sync (
447- config. max_export_timeout ,
448- exporter,
449- spans,
450- last_export_time,
451- ) ; // This method clears the spans vec after exporting
445+ let result = Self :: export_batch_sync ( exporter, spans, last_export_time) ; // This method clears the spans vec after exporting
452446
453447 current_batch_size. fetch_sub ( count_of_spans, Ordering :: Relaxed ) ;
454448 result
455449 }
456450
457451 #[ allow( clippy:: vec_box) ]
458- fn export_with_timeout_sync < E > (
459- _: Duration , // TODO, enforcing timeout in exporter.
452+ fn export_batch_sync < E > (
460453 exporter : & mut E ,
461454 batch : & mut Vec < SpanData > ,
462455 last_export_time : & mut Instant ,
@@ -740,6 +733,7 @@ impl BatchConfigBuilder {
740733 /// Set max_export_timeout for [`BatchConfigBuilder`].
741734 /// It's the maximum duration to export a batch of data.
742735 /// The The default value is 30000 milliseconds.
736+ #[ cfg( feature = "experimental_trace_batch_span_processor_with_async_runtime" ) ]
743737 pub fn with_max_export_timeout ( mut self , max_export_timeout : Duration ) -> Self {
744738 self . max_export_timeout = max_export_timeout;
745739 self
@@ -960,10 +954,11 @@ mod tests {
960954 let batch = BatchConfigBuilder :: default ( )
961955 . with_max_export_batch_size ( 10 )
962956 . with_scheduled_delay ( Duration :: from_millis ( 10 ) )
963- . with_max_export_timeout ( Duration :: from_millis ( 10 ) )
964957 . with_max_queue_size ( 10 ) ;
965958 #[ cfg( feature = "experimental_trace_batch_span_processor_with_async_runtime" ) ]
966959 let batch = batch. with_max_concurrent_exports ( 10 ) ;
960+ #[ cfg( feature = "experimental_trace_batch_span_processor_with_async_runtime" ) ]
961+ let batch = batch. with_max_export_timeout ( Duration :: from_millis ( 10 ) ) ;
967962 let batch = batch. build ( ) ;
968963 assert_eq ! ( batch. max_export_batch_size, 10 ) ;
969964 assert_eq ! ( batch. scheduled_delay, Duration :: from_millis( 10 ) ) ;
@@ -1037,7 +1032,6 @@ mod tests {
10371032 . with_max_queue_size ( 10 )
10381033 . with_max_export_batch_size ( 10 )
10391034 . with_scheduled_delay ( Duration :: from_secs ( 5 ) )
1040- . with_max_export_timeout ( Duration :: from_secs ( 2 ) )
10411035 . build ( ) ;
10421036 let processor = BatchSpanProcessor :: new ( exporter, config) ;
10431037
@@ -1060,7 +1054,6 @@ mod tests {
10601054 . with_max_queue_size ( 10 )
10611055 . with_max_export_batch_size ( 10 )
10621056 . with_scheduled_delay ( Duration :: from_secs ( 5 ) )
1063- . with_max_export_timeout ( Duration :: from_secs ( 2 ) )
10641057 . build ( ) ;
10651058 let processor = BatchSpanProcessor :: new ( exporter, config) ;
10661059
@@ -1090,7 +1083,6 @@ mod tests {
10901083 . with_max_queue_size ( 10 )
10911084 . with_max_export_batch_size ( 10 )
10921085 . with_scheduled_delay ( Duration :: from_secs ( 5 ) )
1093- . with_max_export_timeout ( Duration :: from_secs ( 2 ) )
10941086 . build ( ) ;
10951087 let processor = BatchSpanProcessor :: new ( exporter, config) ;
10961088
@@ -1126,7 +1118,6 @@ mod tests {
11261118 let config = BatchConfigBuilder :: default ( )
11271119 . with_max_queue_size ( 2 ) // Small queue size to test span dropping
11281120 . with_scheduled_delay ( Duration :: from_secs ( 5 ) )
1129- . with_max_export_timeout ( Duration :: from_secs ( 2 ) )
11301121 . build ( ) ;
11311122 let processor = BatchSpanProcessor :: new ( exporter, config) ;
11321123
0 commit comments