From 6317b10949e7a30dcdb44ee309174ea16c187f7a Mon Sep 17 00:00:00 2001 From: jlizen Date: Thu, 12 Mar 2026 18:49:54 +0000 Subject: [PATCH 1/4] fix(test): fix feature flag for test_concurrent_structured_logging_isolation --- lambda-runtime/src/runtime.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lambda-runtime/src/runtime.rs b/lambda-runtime/src/runtime.rs index 755377ae..7272805a 100644 --- a/lambda-runtime/src/runtime.rs +++ b/lambda-runtime/src/runtime.rs @@ -935,10 +935,9 @@ mod endpoint_tests { Ok(()) } - #[tokio::test] #[cfg(feature = "concurrency-tokio")] - #[traced_test] - #[cfg(feature = "tokio-concurrent-runtime")] + #[tracing_test::traced_test] + #[tokio::test] async fn test_concurrent_structured_logging_isolation() -> Result<(), Error> { use std::collections::HashSet; use tracing::info; From 27a5e2340a3f17b798585509cdd3cbb812fce820 Mon Sep 17 00:00:00 2001 From: jlizen Date: Thu, 12 Mar 2026 18:54:23 +0000 Subject: [PATCH 2/4] fix: remove traced_test --- lambda-runtime/src/runtime.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/lambda-runtime/src/runtime.rs b/lambda-runtime/src/runtime.rs index 7272805a..4677f3b0 100644 --- a/lambda-runtime/src/runtime.rs +++ b/lambda-runtime/src/runtime.rs @@ -936,7 +936,6 @@ mod endpoint_tests { } #[cfg(feature = "concurrency-tokio")] - #[tracing_test::traced_test] #[tokio::test] async fn test_concurrent_structured_logging_isolation() -> Result<(), Error> { use std::collections::HashSet; From 99d45b8a6e3933e26c71b156277a3590b3f68c40 Mon Sep 17 00:00:00 2001 From: jlizen Date: Thu, 12 Mar 2026 19:05:24 +0000 Subject: [PATCH 3/4] fix: use thread-local subscriber in logging isolation test Replace set_global_default with set_default to avoid "global default trace dispatcher has already been set" errors when tests run in the same process. --- lambda-runtime/src/runtime.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lambda-runtime/src/runtime.rs b/lambda-runtime/src/runtime.rs index 4677f3b0..85fbc17a 100644 --- a/lambda-runtime/src/runtime.rs +++ b/lambda-runtime/src/runtime.rs @@ -945,7 +945,7 @@ mod endpoint_tests { let storage = SharedStorage::default(); let subscriber = tracing_subscriber::registry().with(CaptureLayer::new(&storage)); - tracing::subscriber::set_global_default(subscriber).unwrap(); + let _guard = tracing::subscriber::set_default(subscriber); let request_count = Arc::new(AtomicUsize::new(0)); let done = Arc::new(tokio::sync::Notify::new()); From a09082fc852ac9b33a307f0529c006b8741cf4b9 Mon Sep 17 00:00:00 2001 From: jlizen Date: Thu, 12 Mar 2026 19:06:55 +0000 Subject: [PATCH 4/4] docs: note current-thread requirement for logging isolation test --- lambda-runtime/src/runtime.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lambda-runtime/src/runtime.rs b/lambda-runtime/src/runtime.rs index 85fbc17a..94efeca4 100644 --- a/lambda-runtime/src/runtime.rs +++ b/lambda-runtime/src/runtime.rs @@ -936,6 +936,8 @@ mod endpoint_tests { } #[cfg(feature = "concurrency-tokio")] + // Must be current-thread (the default) so the thread-local tracing + // subscriber set via `set_default` propagates to spawned tasks. #[tokio::test] async fn test_concurrent_structured_logging_isolation() -> Result<(), Error> { use std::collections::HashSet;