From b9f223ee9e33b895e55c2e10ba626375e0e95099 Mon Sep 17 00:00:00 2001 From: Daniel Harvey Date: Fri, 29 Sep 2023 10:47:55 +0100 Subject: [PATCH] Set global trace registry --- rust-connector-sdk/src/default_main.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rust-connector-sdk/src/default_main.rs b/rust-connector-sdk/src/default_main.rs index c883bbc8..1cd582c9 100644 --- a/rust-connector-sdk/src/default_main.rs +++ b/rust-connector-sdk/src/default_main.rs @@ -196,7 +196,7 @@ fn init_tracing(serve_command: &ServeCommand) -> Result<(), Box> { ) .install_batch(opentelemetry::runtime::Tokio)?; - tracing_subscriber::registry() + let subscriber = tracing_subscriber::registry() .with( tracing_opentelemetry::layer() .with_exception_field_propagation(true) @@ -207,8 +207,9 @@ fn init_tracing(serve_command: &ServeCommand) -> Result<(), Box> { tracing_subscriber::fmt::layer() .json() .with_timer(tracing_subscriber::fmt::time::time()), - ) - .init(); + ); + + tracing::subscriber::set_global_default(subscriber)?; Ok(()) }