From 952fcdb2b33c7e75621efe6475ccddafba13578b Mon Sep 17 00:00:00 2001 From: mfahampshire Date: Tue, 5 Aug 2025 11:21:31 +0200 Subject: [PATCH] added tracing command for testing + extra logging --- .../websocket/connection_handler/fresh.rs | 1 + nym-node/src/cli/mod.rs | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/gateway/src/node/client_handling/websocket/connection_handler/fresh.rs b/gateway/src/node/client_handling/websocket/connection_handler/fresh.rs index b2344087d7..a018164657 100644 --- a/gateway/src/node/client_handling/websocket/connection_handler/fresh.rs +++ b/gateway/src/node/client_handling/websocket/connection_handler/fresh.rs @@ -896,6 +896,7 @@ impl FreshHandler { { let trace_id = opentelemetry::trace::TraceId::from_hex(trace_id).expect("Invalid trace ID format"); + warn!("🫂TraceID: {trace_id}🫂"); // We don't need to try and preserve the SpanID, just the TraceID (right?) so // just making a new SpanID for the moment diff --git a/nym-node/src/cli/mod.rs b/nym-node/src/cli/mod.rs index ba11ba1b78..6bc3ef0ddd 100644 --- a/nym-node/src/cli/mod.rs +++ b/nym-node/src/cli/mod.rs @@ -12,6 +12,7 @@ use clap::{Parser, Subcommand}; use nym_bin_common::bin_info; use std::future::Future; use std::sync::OnceLock; +use tracing::instrument; pub(crate) mod commands; mod helpers; @@ -54,6 +55,7 @@ impl Cli { .block_on(fut)) } + #[instrument] pub(crate) fn execute(self) -> anyhow::Result<()> { match self.command { // Sync commands get logger w. no OTEL @@ -90,6 +92,10 @@ impl Cli { setup_tracing_logger().map_err(NymNodeError::TracingSetupFailure)?; reset_sphinx_keys::execute(args).await })??, + Commands::TestTracing => Self::execute_async(async move { + setup_tracing_logger().map_err(NymNodeError::TracingSetupFailure)?; + Ok::<(), crate::error::NymNodeError>(()) + })??, } Ok(()) } @@ -145,6 +151,10 @@ pub(crate) enum Commands { /// was running on this machine in mixnet mode #[clap(hide = true)] TestThroughput(test_throughput::Args), + + /// Test local tracing for instrumentation and + /// TraceID aligmnet + TestTracing, } #[cfg(test)]