Skip to content

Commit 4d59114

Browse files
committed
Better table output, step labels
1 parent 92415e1 commit 4d59114

File tree

3 files changed

+50
-12
lines changed

3 files changed

+50
-12
lines changed

dev-tools/omdb/src/bin/omdb/nexus.rs

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2626,17 +2626,33 @@ fn print_task_support_bundle_collector(details: &serde_json::Value) {
26262626
" Bundle was able to list service processors: {listed_sps}"
26272627
);
26282628

2629+
#[derive(Tabled)]
2630+
#[tabled(rename_all = "SCREAMING_SNAKE_CASE")]
2631+
struct StepRow {
2632+
step_name: String,
2633+
start_time: String,
2634+
duration: String,
2635+
status: String,
2636+
}
2637+
26292638
steps.sort_unstable_by_key(|s| s.start);
2630-
for step in steps {
2631-
let duration = (step.end - step.start)
2632-
.to_std()
2633-
.unwrap_or(Duration::from_millis(0));
2634-
println!(
2635-
" Step {} ({}ms): {}",
2636-
step.name,
2637-
duration.as_millis(),
2638-
step.status
2639-
);
2639+
let rows: Vec<StepRow> = steps
2640+
.into_iter()
2641+
.map(|step| {
2642+
let duration = (step.end - step.start)
2643+
.to_std()
2644+
.unwrap_or(Duration::from_millis(0));
2645+
StepRow {
2646+
step_name: step.name,
2647+
start_time: step.start.to_rfc3339(),
2648+
duration: format!("{:.3}s", duration.as_secs_f64()),
2649+
status: step.status.to_string(),
2650+
}
2651+
})
2652+
.collect();
2653+
2654+
if !rows.is_empty() {
2655+
println!("\n{}", tabled::Table::new(rows));
26402656
}
26412657
println!(
26422658
" Bundle was activated in the database: {activated_in_db_ok}"

nexus/src/app/background/tasks/support_bundle_collector.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,7 +1117,7 @@ impl BundleCollection {
11171117
let mut extra_steps: Vec<CollectionStep> = vec![];
11181118
for sp in get_available_sps(&mgs_client).await? {
11191119
extra_steps.push(CollectionStep::new(
1120-
"SP dump",
1120+
format!("SP dump for {:?}", sp),
11211121
Box::new({
11221122
let mgs_client = mgs_client.clone();
11231123
move |collection, dir| {
@@ -1273,7 +1273,7 @@ impl BundleCollection {
12731273
}
12741274

12751275
extra_steps.push(CollectionStep::new(
1276-
"sled data",
1276+
format!("sled data for sled {}", sled.id()),
12771277
Box::new({
12781278
let sled = sled.clone();
12791279
move |collection, dir| {

nexus/tests/integration_tests/support_bundles.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,17 @@ async fn test_support_bundle_lifecycle(cptestctx: &ControlPlaneTestContext) {
500500
errors: Vec::new()
501501
})
502502
);
503+
504+
// Verify that steps were recorded with reasonable timing data
505+
assert!(!report.steps.is_empty(), "Should have recorded some steps");
506+
for step in &report.steps {
507+
assert!(
508+
step.end >= step.start,
509+
"Step '{}' end time should be >= start time",
510+
step.name
511+
);
512+
}
513+
503514
let bundle = bundle_get(&client, bundle.id).await.unwrap();
504515
assert_eq!(bundle.state, SupportBundleState::Active);
505516

@@ -601,6 +612,17 @@ async fn test_support_bundle_range_requests(
601612
errors: Vec::new()
602613
})
603614
);
615+
616+
// Verify that steps were recorded with reasonable timing data
617+
assert!(!report.steps.is_empty(), "Should have recorded some steps");
618+
for step in &report.steps {
619+
assert!(
620+
step.end >= step.start,
621+
"Step '{}' end time should be >= start time",
622+
step.name
623+
);
624+
}
625+
604626
let bundle = bundle_get(&client, bundle.id).await.unwrap();
605627
assert_eq!(bundle.state, SupportBundleState::Active);
606628

0 commit comments

Comments
 (0)