@@ -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();
@@ -474,20 +473,14 @@ impl BatchSpanProcessor {
474473 }
475474
476475 let count_of_spans = spans. len ( ) ; // Count of spans that will be exported
477- let result = Self :: export_with_timeout_sync (
478- config. max_export_timeout ,
479- exporter,
480- spans,
481- last_export_time,
482- ) ; // This method clears the spans vec after exporting
476+ let result = Self :: export_batch_sync ( exporter, spans, last_export_time) ; // This method clears the spans vec after exporting
483477
484478 current_batch_size. fetch_sub ( count_of_spans, Ordering :: Relaxed ) ;
485479 result
486480 }
487481
488482 #[ allow( clippy:: vec_box) ]
489- fn export_with_timeout_sync < E > (
490- _: Duration , // TODO, enforcing timeout in exporter.
483+ fn export_batch_sync < E > (
491484 exporter : & mut E ,
492485 batch : & mut Vec < SpanData > ,
493486 last_export_time : & mut Instant ,
@@ -771,6 +764,7 @@ impl BatchConfigBuilder {
771764 /// Set max_export_timeout for [`BatchConfigBuilder`].
772765 /// It's the maximum duration to export a batch of data.
773766 /// The The default value is 30000 milliseconds.
767+ #[ cfg( feature = "experimental_trace_batch_span_processor_with_async_runtime" ) ]
774768 pub fn with_max_export_timeout ( mut self , max_export_timeout : Duration ) -> Self {
775769 self . max_export_timeout = max_export_timeout;
776770 self
@@ -991,10 +985,11 @@ mod tests {
991985 let batch = BatchConfigBuilder :: default ( )
992986 . with_max_export_batch_size ( 10 )
993987 . with_scheduled_delay ( Duration :: from_millis ( 10 ) )
994- . with_max_export_timeout ( Duration :: from_millis ( 10 ) )
995988 . with_max_queue_size ( 10 ) ;
996989 #[ cfg( feature = "experimental_trace_batch_span_processor_with_async_runtime" ) ]
997990 let batch = batch. with_max_concurrent_exports ( 10 ) ;
991+ #[ cfg( feature = "experimental_trace_batch_span_processor_with_async_runtime" ) ]
992+ let batch = batch. with_max_export_timeout ( Duration :: from_millis ( 10 ) ) ;
998993 let batch = batch. build ( ) ;
999994 assert_eq ! ( batch. max_export_batch_size, 10 ) ;
1000995 assert_eq ! ( batch. scheduled_delay, Duration :: from_millis( 10 ) ) ;
@@ -1068,7 +1063,6 @@ mod tests {
10681063 . with_max_queue_size ( 10 )
10691064 . with_max_export_batch_size ( 10 )
10701065 . with_scheduled_delay ( Duration :: from_secs ( 5 ) )
1071- . with_max_export_timeout ( Duration :: from_secs ( 2 ) )
10721066 . build ( ) ;
10731067 let processor = BatchSpanProcessor :: new ( exporter, config) ;
10741068
@@ -1091,7 +1085,6 @@ mod tests {
10911085 . with_max_queue_size ( 10 )
10921086 . with_max_export_batch_size ( 10 )
10931087 . with_scheduled_delay ( Duration :: from_secs ( 5 ) )
1094- . with_max_export_timeout ( Duration :: from_secs ( 2 ) )
10951088 . build ( ) ;
10961089 let processor = BatchSpanProcessor :: new ( exporter, config) ;
10971090
@@ -1121,7 +1114,6 @@ mod tests {
11211114 . with_max_queue_size ( 10 )
11221115 . with_max_export_batch_size ( 10 )
11231116 . with_scheduled_delay ( Duration :: from_secs ( 5 ) )
1124- . with_max_export_timeout ( Duration :: from_secs ( 2 ) )
11251117 . build ( ) ;
11261118 let processor = BatchSpanProcessor :: new ( exporter, config) ;
11271119
@@ -1157,7 +1149,6 @@ mod tests {
11571149 let config = BatchConfigBuilder :: default ( )
11581150 . with_max_queue_size ( 2 ) // Small queue size to test span dropping
11591151 . with_scheduled_delay ( Duration :: from_secs ( 5 ) )
1160- . with_max_export_timeout ( Duration :: from_secs ( 2 ) )
11611152 . build ( ) ;
11621153 let processor = BatchSpanProcessor :: new ( exporter, config) ;
11631154
0 commit comments