From 5d756c72e7fea57b04801d1dc14db531e5da2b3b Mon Sep 17 00:00:00 2001 From: Marius Eriksen Date: Mon, 17 Nov 2025 14:36:24 -0800 Subject: [PATCH] [hyperactor] telemetry / mesh: display execution ID and a scuba shorturl for the execution This way we don't have to grub around logs to get to the execution id and corresponding trace. With this change, we provide a direct URL that you can click on in your terminal. Differential Revision: [D87273699](https://our.internmc.facebook.com/intern/diff/D87273699/) [ghstack-poisoned] --- .../src/v1/host_mesh/mesh_agent.rs | 10 ++++++++-- hyperactor_telemetry/src/lib.rs | 20 ++++++++++++++++++- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/hyperactor_mesh/src/v1/host_mesh/mesh_agent.rs b/hyperactor_mesh/src/v1/host_mesh/mesh_agent.rs index 9d89d64e0..a2c09ae96 100644 --- a/hyperactor_mesh/src/v1/host_mesh/mesh_agent.rs +++ b/hyperactor_mesh/src/v1/host_mesh/mesh_agent.rs @@ -132,8 +132,14 @@ impl Actor for HostMeshAgent { ) .unwrap(); eprintln!( - "Monarch internal logs are being written to {}/{}.log", - directory, file + "Monarch internal logs are being written to {}/{}.log; execution id {}{}", + directory, + file, + hyperactor_telemetry::env::execution_id(), + hyperactor_telemetry::env::execution_url() + .await + .unwrap_or_else(|e| Some(format!(": ", e))) + .map_or_else(|| "".to_string(), |url| format!(": {}", url)) ); } Ok(Self { diff --git a/hyperactor_telemetry/src/lib.rs b/hyperactor_telemetry/src/lib.rs index 1edc0e618..b4717df59 100644 --- a/hyperactor_telemetry/src/lib.rs +++ b/hyperactor_telemetry/src/lib.rs @@ -12,6 +12,7 @@ #![feature(mpmc_channel)] #![feature(cfg_version)] #![feature(formatting_options)] +#![recursion_limit = "256"] // TODO:ehedeman Remove or replace with better config once telemetry perf issues are solved /// Environment variable to disable the OpenTelemetry logging layer. @@ -79,7 +80,6 @@ mod spool; pub mod sqlite; pub mod task; pub mod trace; -use std::io::IsTerminal; use std::io::Write; use std::str::FromStr; use std::sync::Arc; @@ -718,6 +718,24 @@ pub mod env { id } + /// Returns a URL for the execution trace, if available. + #[cfg(fbcode_build)] + pub async fn execution_url() -> anyhow::Result> { + let fb = if fbinit::was_performed() { + fbinit::expect_init() + } else { + // Safety: This is going to be embedded in a python library, so we can't be sure when fbinit has been called. + unsafe { fbinit::perform_init() } + }; + Ok(Some( + crate::meta::scuba_tracing::url::get_samples_shorturl(fb, &execution_id()).await?, + )) + } + #[cfg(not(fbcode_build))] + pub async fn execution_url() -> anyhow::Result> { + Ok(None) + } + #[derive(PartialEq)] pub enum Env { Local,