From fa6cb3e529b005b46680486f98589f4cd9bcaf6e Mon Sep 17 00:00:00 2001 From: Marius Eriksen Date: Mon, 17 Nov 2025 14:36:20 -0800 Subject: [PATCH] [hyperactor] telemetry: don't record net i/o loop spans in scuba These are used primarily to provide context for any logged events, and should not be recorded as separate spans in scuba. We introduce a general mechanism, exposing the key `hyperactor_telemetry::skip_record` which, if included in a span, causes the downstream scuba subscribe to skip recording the span as its own discrete event. This also prevents us from entering and exiting the spans accordingly. We do maintain the recorded fields, which provide important context; they continue to propagate to the individually recorded entries. Differential Revision: [D87273700](https://our.internmc.facebook.com/intern/diff/D87273700/) [ghstack-poisoned] --- hyperactor/src/channel/net/client.rs | 3 +++ hyperactor_mesh/examples/dining_philosophers.rs | 2 +- hyperactor_telemetry/src/lib.rs | 15 +++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/hyperactor/src/channel/net/client.rs b/hyperactor/src/channel/net/client.rs index f162714cb..fdc1c6623 100644 --- a/hyperactor/src/channel/net/client.rs +++ b/hyperactor/src/channel/net/client.rs @@ -760,6 +760,8 @@ where .as_ref() .map(|acked_seq| AckedSeqValue(acked_seq.clone())); + use hyperactor_telemetry::skip_record; + tracing::span!( Level::ERROR, "net i/o loop", @@ -769,6 +771,7 @@ where largest_acked = largest_acked.as_value(), outbox = QueueValue::from(&deliveries.outbox.deque).as_value(), unacked = QueueValue::from(&deliveries.unacked.deque).as_value(), + skip_record, ) } diff --git a/hyperactor_mesh/examples/dining_philosophers.rs b/hyperactor_mesh/examples/dining_philosophers.rs index 2106d6b68..7e30c3321 100644 --- a/hyperactor_mesh/examples/dining_philosophers.rs +++ b/hyperactor_mesh/examples/dining_philosophers.rs @@ -232,7 +232,7 @@ impl Waiter { #[tokio::main] async fn main() -> Result { - hyperactor_telemetry::initialize_logging_for_test(); + hyperactor::initialize_with_current_runtime(); // Option: run as a local process mesh // let host_mesh = HostMesh::process(extent!(hosts = 1), BootstrapCommand::current().unwrap()) diff --git a/hyperactor_telemetry/src/lib.rs b/hyperactor_telemetry/src/lib.rs index a3ef6c785..1edc0e618 100644 --- a/hyperactor_telemetry/src/lib.rs +++ b/hyperactor_telemetry/src/lib.rs @@ -54,6 +54,21 @@ const ENV_VALUE_TEST: &str = "test"; #[allow(dead_code)] const ENV_VALUE_LOCAL_MAST_SIMULATOR: &str = "local_mast_simulator"; +/// A marker field used to indicate that a span should not be recorded as +/// individual start/end span events; rather the span is purely used to +/// provide context for child events. +/// +/// Note that the mechanism for skipping span recording uses the precise +/// name "skip_record", thus it must be used as a naked identifier: +/// ```ignore +/// use hyperactor_telemetry::skip_record; +/// +/// tracing::span!(..., skip_record); +/// ``` +#[allow(non_upper_case_globals)] +// pub const skip_record: tracing::field::Empty = tracing::field::Empty; +pub const skip_record: bool = true; + pub mod in_memory_reader; #[cfg(fbcode_build)] mod meta;