@@ -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();
@@ -443,20 +442,14 @@ impl BatchSpanProcessor {
443
442
}
444
443
445
444
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
452
446
453
447
current_batch_size. fetch_sub ( count_of_spans, Ordering :: Relaxed ) ;
454
448
result
455
449
}
456
450
457
451
#[ allow( clippy:: vec_box) ]
458
- fn export_with_timeout_sync < E > (
459
- _: Duration , // TODO, enforcing timeout in exporter.
452
+ fn export_batch_sync < E > (
460
453
exporter : & mut E ,
461
454
batch : & mut Vec < SpanData > ,
462
455
last_export_time : & mut Instant ,
@@ -740,6 +733,7 @@ impl BatchConfigBuilder {
740
733
/// Set max_export_timeout for [`BatchConfigBuilder`].
741
734
/// It's the maximum duration to export a batch of data.
742
735
/// The The default value is 30000 milliseconds.
736
+ #[ cfg( feature = "experimental_trace_batch_span_processor_with_async_runtime" ) ]
743
737
pub fn with_max_export_timeout ( mut self , max_export_timeout : Duration ) -> Self {
744
738
self . max_export_timeout = max_export_timeout;
745
739
self
@@ -960,10 +954,11 @@ mod tests {
960
954
let batch = BatchConfigBuilder :: default ( )
961
955
. with_max_export_batch_size ( 10 )
962
956
. with_scheduled_delay ( Duration :: from_millis ( 10 ) )
963
- . with_max_export_timeout ( Duration :: from_millis ( 10 ) )
964
957
. with_max_queue_size ( 10 ) ;
965
958
#[ cfg( feature = "experimental_trace_batch_span_processor_with_async_runtime" ) ]
966
959
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 ) ) ;
967
962
let batch = batch. build ( ) ;
968
963
assert_eq ! ( batch. max_export_batch_size, 10 ) ;
969
964
assert_eq ! ( batch. scheduled_delay, Duration :: from_millis( 10 ) ) ;
@@ -1037,7 +1032,6 @@ mod tests {
1037
1032
. with_max_queue_size ( 10 )
1038
1033
. with_max_export_batch_size ( 10 )
1039
1034
. with_scheduled_delay ( Duration :: from_secs ( 5 ) )
1040
- . with_max_export_timeout ( Duration :: from_secs ( 2 ) )
1041
1035
. build ( ) ;
1042
1036
let processor = BatchSpanProcessor :: new ( exporter, config) ;
1043
1037
@@ -1060,7 +1054,6 @@ mod tests {
1060
1054
. with_max_queue_size ( 10 )
1061
1055
. with_max_export_batch_size ( 10 )
1062
1056
. with_scheduled_delay ( Duration :: from_secs ( 5 ) )
1063
- . with_max_export_timeout ( Duration :: from_secs ( 2 ) )
1064
1057
. build ( ) ;
1065
1058
let processor = BatchSpanProcessor :: new ( exporter, config) ;
1066
1059
@@ -1090,7 +1083,6 @@ mod tests {
1090
1083
. with_max_queue_size ( 10 )
1091
1084
. with_max_export_batch_size ( 10 )
1092
1085
. with_scheduled_delay ( Duration :: from_secs ( 5 ) )
1093
- . with_max_export_timeout ( Duration :: from_secs ( 2 ) )
1094
1086
. build ( ) ;
1095
1087
let processor = BatchSpanProcessor :: new ( exporter, config) ;
1096
1088
@@ -1126,7 +1118,6 @@ mod tests {
1126
1118
let config = BatchConfigBuilder :: default ( )
1127
1119
. with_max_queue_size ( 2 ) // Small queue size to test span dropping
1128
1120
. with_scheduled_delay ( Duration :: from_secs ( 5 ) )
1129
- . with_max_export_timeout ( Duration :: from_secs ( 2 ) )
1130
1121
. build ( ) ;
1131
1122
let processor = BatchSpanProcessor :: new ( exporter, config) ;
1132
1123
0 commit comments