Skip to content

Commit

Permalink
Add information about workunit when failing to backtrack (#21632)
Browse files Browse the repository at this point in the history
I don't think there's much information to be had here, fundamentally,
but on the off-chance there is it would be interesting.

Relates to: #19748, which
we've started seeing quite regularly at work.
  • Loading branch information
tgolsson authored Nov 14, 2024
1 parent c24b407 commit bdb72c8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/rust/engine/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -871,8 +871,14 @@ impl SessionCore {
} else {
// There are no live or invalidated sources of this Digest. Directly fail.
return result.map_err(|e| {
let suffix = if let Some(workunit_data) = workunit.workunit() {
&format!(", with workunit: {:?}", workunit_data)
} else {
""
};

throw(format!(
"Could not identify a process to backtrack to for: {e}"
"Could not identify a process to backtrack to for: {e}{suffix}"
))
});
}
Expand Down
4 changes: 4 additions & 0 deletions src/rust/engine/workunit_store/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,10 @@ impl RunningWorkunit {
}
}

pub fn workunit(&self) -> Option<&Workunit> {
self.workunit.as_ref()
}

pub fn record_observation(&self, metric: ObservationMetric, value: u64) {
self.store.record_observation(metric, value);
}
Expand Down

0 comments on commit bdb72c8

Please sign in to comment.