Skip to content

Commit

Permalink
Add SUCCESS Scuba events for each supertd subcommand
Browse files Browse the repository at this point in the history
Summary: Log SUCCESS events for each subcommand. Include the duration in milliseconds and any summary information that happens to currently be conveniently at hand (for instance: in btd, the counts of immediate and total changes; in verse, the entire VerseExecutionLog).

Reviewed By: aniketmathur

Differential Revision: D53788472

fbshipit-source-id: 4c81748f72c5251ba824575d648609418aa5b5a7
  • Loading branch information
rjbailey authored and facebook-github-bot committed Feb 16, 2024
1 parent ed847af commit 805f86f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
14 changes: 11 additions & 3 deletions btd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,19 @@ pub fn main(args: Args) -> anyhow::Result<()> {

write_errors_to_file(&errors, error_file, output_format)?;
}
let immediate_changes = immediate.len();
let total_changes = recursive.iter().map(|x| x.len()).sum::<usize>();
step(&format!(
"finish with {} immediate changes, {} total changes",
immediate.len(),
recursive.iter().map(|x| x.len()).sum::<usize>()
"finish with {immediate_changes} immediate changes, {total_changes} total changes"
));
td_util::scuba!(
event: "BTD_SUCCESS",
duration_ms: t.elapsed().as_millis() as u64,
data: json!({
"immediate_changes": immediate_changes,
"total_changes": total_changes,
})
);
Ok(())
}

Expand Down
5 changes: 5 additions & 0 deletions targets/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ pub fn run(
dry_run: bool,
arguments: &[String],
) -> anyhow::Result<()> {
let t = std::time::Instant::now();
let mut command = Command::new(buck);
command.args(targets_arguments());
if let Some(x) = &output_file {
Expand All @@ -99,6 +100,10 @@ pub fn run(

let status = command.status()?;
if status.success() {
td_util::scuba!(
event: "TARGETS_SUCCESS",
duration_ms: t.elapsed().as_millis() as u64,
);
Ok(())
} else {
process::exit(status.code().unwrap_or(1));
Expand Down

0 comments on commit 805f86f

Please sign in to comment.