From 5efcc2af8696a452ef7e69a01c0fab93c308491d Mon Sep 17 00:00:00 2001 From: Ross Sullivan Date: Sun, 5 Oct 2025 21:33:25 +0900 Subject: [PATCH] chore: Added tracing span for build script execution --- src/cargo/core/compiler/custom_build.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/cargo/core/compiler/custom_build.rs b/src/cargo/core/compiler/custom_build.rs index 0cec4660de3..5393196106f 100644 --- a/src/cargo/core/compiler/custom_build.rs +++ b/src/cargo/core/compiler/custom_build.rs @@ -564,8 +564,9 @@ fn build_work(build_runner: &mut BuildRunner<'_, '_>, unit: &Unit) -> CargoResul let timestamp = paths::set_invocation_time(&script_run_dir)?; let prefix = format!("[{} {}] ", id.name(), id.version()); let mut log_messages_in_case_of_panic = Vec::new(); - let output = cmd - .exec_with_streaming( + let span = tracing::debug_span!("build_script", process = cmd.to_string()); + let output = span.in_scope(|| { + cmd.exec_with_streaming( &mut |stdout| { if let Some(error) = stdout.strip_prefix(CARGO_ERROR_SYNTAX) { log_messages_in_case_of_panic.push((Severity::Error, error.to_owned())); @@ -612,7 +613,8 @@ fn build_work(build_runner: &mut BuildRunner<'_, '_>, unit: &Unit) -> CargoResul } build_error_context - }); + }) + }); // If the build failed if let Err(error) = output {