Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions opentelemetry-sdk/src/logs/batch_log_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -902,8 +902,7 @@ mod tests {
)
.build();

// wait for the batch processor to process the resource.
tokio::time::sleep(Duration::from_millis(100)).await;
provider.force_flush().unwrap();

assert_eq!(exporter.get_resource().unwrap().into_iter().count(), 5);
let _ = provider.shutdown();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -525,8 +525,7 @@ mod tests {
)
.build();

// wait for the batch processor to process the resource.
tokio::time::sleep(Duration::from_millis(100)).await;
provider.force_flush().unwrap();

assert_eq!(exporter.get_resource().unwrap().into_iter().count(), 5);
let _ = provider.shutdown();
Expand Down Expand Up @@ -788,7 +787,7 @@ mod tests {
KeyValue::new("k5", "v5"),
]))
.build();
tokio::time::sleep(Duration::from_millis(500)).await; // set resource in batch log processor is not blocking. Should we make it blocking?
provider.force_flush().unwrap();
assert_eq!(exporter.get_resource().unwrap().into_iter().count(), 5);
let _ = provider.shutdown();
}
Expand Down
10 changes: 3 additions & 7 deletions opentelemetry-sdk/src/trace/span_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1240,7 +1240,6 @@ mod tests {
let config = BatchConfigBuilder::default()
.with_max_queue_size(5)
.with_max_export_batch_size(3)
.with_scheduled_delay(Duration::from_millis(50))
.build();

let processor = BatchSpanProcessor::new(exporter, config);
Expand All @@ -1250,7 +1249,7 @@ mod tests {
processor.on_end(span);
}

tokio::time::sleep(Duration::from_millis(1000)).await;
processor.force_flush().unwrap();

let exported_spans = exporter_shared.lock().unwrap();
assert_eq!(exported_spans.len(), 4);
Expand All @@ -1264,7 +1263,6 @@ mod tests {
let config = BatchConfigBuilder::default()
.with_max_queue_size(5)
.with_max_export_batch_size(3)
.with_scheduled_delay(Duration::from_millis(50))
.build();

let processor = BatchSpanProcessor::new(exporter, config);
Expand All @@ -1274,7 +1272,7 @@ mod tests {
processor.on_end(span);
}

tokio::time::sleep(Duration::from_millis(1000)).await;
processor.force_flush().unwrap();

let exported_spans = exporter_shared.lock().unwrap();
assert_eq!(exported_spans.len(), 4);
Expand All @@ -1288,7 +1286,6 @@ mod tests {
let config = BatchConfigBuilder::default()
.with_max_queue_size(20)
.with_max_export_batch_size(5)
.with_scheduled_delay(Duration::from_millis(50))
.build();

// Create the processor with the thread-safe exporter
Expand All @@ -1308,8 +1305,7 @@ mod tests {
handle.await.unwrap();
}

// Allow time for batching and export
tokio::time::sleep(Duration::from_millis(1000)).await;
processor.force_flush().unwrap();

// Verify exported spans
let exported_spans = exporter_shared.lock().unwrap();
Expand Down
Loading