Skip to content

Commit acbbc18

Browse files
committed
fix span for deferred command execution
1 parent 855e0fe commit acbbc18

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/bootstrap/src/utils/exec.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,8 @@ enum CommandState<'a> {
593593
executed_at: &'a Location<'a>,
594594
fingerprint: CommandFingerprint,
595595
start_time: Instant,
596+
#[cfg(feature = "tracing")]
597+
_span_guard: tracing::span::EnteredSpan,
596598
},
597599
}
598600

@@ -693,6 +695,9 @@ impl ExecutionContext {
693695
) -> DeferredCommand<'a> {
694696
let fingerprint = command.fingerprint();
695697

698+
#[cfg(feature = "tracing")]
699+
let span_guard = trace_cmd!(command);
700+
696701
if let Some(cached_output) = self.command_cache.get(&fingerprint) {
697702
command.mark_as_executed();
698703
self.verbose(|| println!("Cache hit: {command:?}"));
@@ -713,13 +718,12 @@ impl ExecutionContext {
713718
executed_at,
714719
fingerprint,
715720
start_time: Instant::now(),
721+
#[cfg(feature = "tracing")]
722+
_span_guard: span_guard,
716723
},
717724
};
718725
}
719726

720-
#[cfg(feature = "tracing")]
721-
let _run_span = trace_cmd!(command);
722-
723727
self.verbose(|| {
724728
println!("running: {command:?} (created at {created_at}, executed at {executed_at})")
725729
});
@@ -741,6 +745,8 @@ impl ExecutionContext {
741745
executed_at,
742746
fingerprint,
743747
start_time,
748+
#[cfg(feature = "tracing")]
749+
_span_guard: span_guard,
744750
},
745751
}
746752
}
@@ -841,6 +847,7 @@ impl<'a> DeferredCommand<'a> {
841847
executed_at,
842848
fingerprint,
843849
start_time,
850+
..
844851
} => {
845852
let exec_ctx = exec_ctx.as_ref();
846853

0 commit comments

Comments
 (0)