Skip to content

Commit 1174440

Browse files
committed
[hyperactor] telemetry: don't record net i/o loop spans in scuba
Pull Request resolved: #1908 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. ghstack-source-id: 324277121 @exported-using-ghexport Differential Revision: [D87273700](https://our.internmc.facebook.com/intern/diff/D87273700/)
1 parent 36c0579 commit 1174440

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

hyperactor/src/channel/net/client.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,8 @@ where
760760
.as_ref()
761761
.map(|acked_seq| AckedSeqValue(acked_seq.clone()));
762762

763+
use hyperactor_telemetry::skip_record;
764+
763765
tracing::span!(
764766
Level::ERROR,
765767
"net i/o loop",
@@ -769,6 +771,7 @@ where
769771
largest_acked = largest_acked.as_value(),
770772
outbox = QueueValue::from(&deliveries.outbox.deque).as_value(),
771773
unacked = QueueValue::from(&deliveries.unacked.deque).as_value(),
774+
skip_record,
772775
)
773776
}
774777

hyperactor_mesh/examples/dining_philosophers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ impl Waiter {
232232

233233
#[tokio::main]
234234
async fn main() -> Result<ExitCode> {
235-
hyperactor_telemetry::initialize_logging_for_test();
235+
hyperactor::initialize_with_current_runtime();
236236

237237
// Option: run as a local process mesh
238238
// let host_mesh = HostMesh::process(extent!(hosts = 1), BootstrapCommand::current().unwrap())

hyperactor_telemetry/src/lib.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,21 @@ const ENV_VALUE_TEST: &str = "test";
5353
#[allow(dead_code)]
5454
const ENV_VALUE_LOCAL_MAST_SIMULATOR: &str = "local_mast_simulator";
5555

56+
/// A marker field used to indicate that a span should not be recorded as
57+
/// individual start/end span events; rather the span is purely used to
58+
/// provide context for child events.
59+
///
60+
/// Note that the mechanism for skipping span recording uses the precise
61+
/// name "skip_record", thus it must be used as a naked identifier:
62+
/// ```ignore
63+
/// use hyperactor_telemetry::skip_record;
64+
///
65+
/// tracing::span!(..., skip_record);
66+
/// ```
67+
#[allow(non_upper_case_globals)]
68+
// pub const skip_record: tracing::field::Empty = tracing::field::Empty;
69+
pub const skip_record: bool = true;
70+
5671
pub mod in_memory_reader;
5772
#[cfg(fbcode_build)]
5873
mod meta;

0 commit comments

Comments
 (0)