Skip to content

Commit 64163ed

Browse files
fix: batchspanprocessor_handles_dropped_spans test case
1 parent 3bbe32f commit 64163ed

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

opentelemetry-sdk/src/trace/span_processor.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1256,8 +1256,11 @@ mod tests {
12561256
fn batchspanprocessor_handles_dropped_spans() {
12571257
let exporter = MockSpanExporter::new();
12581258
let exporter_shared = exporter.exported_spans.clone(); // Shared access to verify exported spans
1259+
// Note: Explicitly set max_export_batch_size to avoid environment variable override
1260+
// that could cause the test to fail when OTEL_BSP_MAX_EXPORT_BATCH_SIZE is set to 2
12591261
let config = BatchConfigBuilder::default()
12601262
.with_max_queue_size(2) // Small queue size to test span dropping
1263+
.with_max_export_batch_size(512) // Explicitly set to default to avoid env var override
12611264
.with_scheduled_delay(Duration::from_secs(5))
12621265
.build();
12631266
let processor = BatchSpanProcessor::new(exporter, config);
@@ -1272,7 +1275,7 @@ mod tests {
12721275
processor.on_end(span3.clone()); // This span exceeds the queue size
12731276

12741277
// Wait for the scheduled delay to expire
1275-
std::thread::sleep(Duration::from_secs(3));
1278+
std::thread::sleep(Duration::from_secs(6));
12761279

12771280
let exported_spans = exporter_shared.lock().unwrap();
12781281

0 commit comments

Comments
 (0)