about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbit-aloo <sshourya17@gmail.com>2025-07-12 14:55:30 +0530
committerbit-aloo <sshourya17@gmail.com>2025-07-12 14:55:30 +0530
commit57ee3f206ce78a5f361efbca54e58dcc799d13f0 (patch)
tree799313b4e25c0a12602e1d8d5267b0aa26e8e186
parentacbbc18599e5b14abb9ec1226b611fcfe4f85bb3 (diff)
downloadrust-57ee3f206ce78a5f361efbca54e58dcc799d13f0.tar.gz
rust-57ee3f206ce78a5f361efbca54e58dcc799d13f0.zip
add span to streaming command execution flow
-rw-r--r--src/bootstrap/src/utils/exec.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/bootstrap/src/utils/exec.rs b/src/bootstrap/src/utils/exec.rs
index 453a4b056b2..1568c6f1524 100644
--- a/src/bootstrap/src/utils/exec.rs
+++ b/src/bootstrap/src/utils/exec.rs
@@ -604,6 +604,8 @@ pub struct StreamingCommand {
     pub stderr: Option<ChildStderr>,
     fingerprint: CommandFingerprint,
     start_time: Instant,
+    #[cfg(feature = "tracing")]
+    _span_guard: tracing::span::EnteredSpan,
 }
 
 #[must_use]
@@ -800,6 +802,10 @@ impl ExecutionContext {
         if !command.run_in_dry_run && self.dry_run() {
             return None;
         }
+
+        #[cfg(feature = "tracing")]
+        let span_guard = trace_cmd!(command);
+
         let start_time = Instant::now();
         let fingerprint = command.fingerprint();
         let cmd = &mut command.command;
@@ -813,7 +819,15 @@ impl ExecutionContext {
 
         let stdout = child.stdout.take();
         let stderr = child.stderr.take();
-        Some(StreamingCommand { child, stdout, stderr, fingerprint, start_time })
+        Some(StreamingCommand {
+            child,
+            stdout,
+            stderr,
+            fingerprint,
+            start_time,
+            #[cfg(feature = "tracing")]
+            _span_guard: span_guard,
+        })
     }
 }