@@ -217,7 +217,6 @@ use crate::trace::ExportResult;
217
217
/// .with_max_queue_size(1024) // Buffer up to 1024 spans.
218
218
/// .with_max_export_batch_size(256) // Export in batches of up to 256 spans.
219
219
/// .with_scheduled_delay(Duration::from_secs(5)) // Export every 5 seconds.
220
- /// .with_max_export_timeout(Duration::from_secs(10)) // Timeout after 10 seconds.
221
220
/// .build(),
222
221
/// )
223
222
/// .build();
@@ -474,20 +473,14 @@ impl BatchSpanProcessor {
474
473
}
475
474
476
475
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
483
477
484
478
current_batch_size. fetch_sub ( count_of_spans, Ordering :: Relaxed ) ;
485
479
result
486
480
}
487
481
488
482
#[ allow( clippy:: vec_box) ]
489
- fn export_with_timeout_sync < E > (
490
- _: Duration , // TODO, enforcing timeout in exporter.
483
+ fn export_batch_sync < E > (
491
484
exporter : & mut E ,
492
485
batch : & mut Vec < SpanData > ,
493
486
last_export_time : & mut Instant ,
@@ -771,6 +764,7 @@ impl BatchConfigBuilder {
771
764
/// Set max_export_timeout for [`BatchConfigBuilder`].
772
765
/// It's the maximum duration to export a batch of data.
773
766
/// The The default value is 30000 milliseconds.
767
+ #[ cfg( feature = "experimental_trace_batch_span_processor_with_async_runtime" ) ]
774
768
pub fn with_max_export_timeout ( mut self , max_export_timeout : Duration ) -> Self {
775
769
self . max_export_timeout = max_export_timeout;
776
770
self
@@ -991,10 +985,11 @@ mod tests {
991
985
let batch = BatchConfigBuilder :: default ( )
992
986
. with_max_export_batch_size ( 10 )
993
987
. with_scheduled_delay ( Duration :: from_millis ( 10 ) )
994
- . with_max_export_timeout ( Duration :: from_millis ( 10 ) )
995
988
. with_max_queue_size ( 10 ) ;
996
989
#[ cfg( feature = "experimental_trace_batch_span_processor_with_async_runtime" ) ]
997
990
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 ) ) ;
998
993
let batch = batch. build ( ) ;
999
994
assert_eq ! ( batch. max_export_batch_size, 10 ) ;
1000
995
assert_eq ! ( batch. scheduled_delay, Duration :: from_millis( 10 ) ) ;
@@ -1068,7 +1063,6 @@ mod tests {
1068
1063
. with_max_queue_size ( 10 )
1069
1064
. with_max_export_batch_size ( 10 )
1070
1065
. with_scheduled_delay ( Duration :: from_secs ( 5 ) )
1071
- . with_max_export_timeout ( Duration :: from_secs ( 2 ) )
1072
1066
. build ( ) ;
1073
1067
let processor = BatchSpanProcessor :: new ( exporter, config) ;
1074
1068
@@ -1091,7 +1085,6 @@ mod tests {
1091
1085
. with_max_queue_size ( 10 )
1092
1086
. with_max_export_batch_size ( 10 )
1093
1087
. with_scheduled_delay ( Duration :: from_secs ( 5 ) )
1094
- . with_max_export_timeout ( Duration :: from_secs ( 2 ) )
1095
1088
. build ( ) ;
1096
1089
let processor = BatchSpanProcessor :: new ( exporter, config) ;
1097
1090
@@ -1121,7 +1114,6 @@ mod tests {
1121
1114
. with_max_queue_size ( 10 )
1122
1115
. with_max_export_batch_size ( 10 )
1123
1116
. with_scheduled_delay ( Duration :: from_secs ( 5 ) )
1124
- . with_max_export_timeout ( Duration :: from_secs ( 2 ) )
1125
1117
. build ( ) ;
1126
1118
let processor = BatchSpanProcessor :: new ( exporter, config) ;
1127
1119
@@ -1157,7 +1149,6 @@ mod tests {
1157
1149
let config = BatchConfigBuilder :: default ( )
1158
1150
. with_max_queue_size ( 2 ) // Small queue size to test span dropping
1159
1151
. with_scheduled_delay ( Duration :: from_secs ( 5 ) )
1160
- . with_max_export_timeout ( Duration :: from_secs ( 2 ) )
1161
1152
. build ( ) ;
1162
1153
let processor = BatchSpanProcessor :: new ( exporter, config) ;
1163
1154
0 commit comments