Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 18 additions & 39 deletions dev-tools/omdb/src/bin/omdb/nexus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,9 @@ use nexus_types::internal_api::background::ServiceFirewallRuleStatus;
use nexus_types::internal_api::background::SessionCleanupStatus;
use nexus_types::internal_api::background::SitrepGcStatus;
use nexus_types::internal_api::background::SitrepLoadStatus;
use nexus_types::internal_api::background::SupportBundleActivationReport;
use nexus_types::internal_api::background::SupportBundleCleanupReport;
use nexus_types::internal_api::background::SupportBundleCollectionReport;
use nexus_types::internal_api::background::SupportBundleCollectionStepStatus;
use nexus_types::internal_api::background::SupportBundleEreportStatus;
use nexus_types::internal_api::background::SwitchPortPopulatorStatus;
use nexus_types::internal_api::background::SwitchPortPopulatorStatusKind;
use nexus_types::internal_api::background::TrustQuorumManagerStatus;
Expand Down Expand Up @@ -2848,7 +2847,7 @@ fn print_task_support_bundle_collector(details: &serde_json::Value) {
struct SupportBundleCollectionStatus {
cleanup_report: Option<SupportBundleCleanupReport>,
cleanup_err: Option<String>,
collection_report: Option<SupportBundleCollectionReport>,
collection_report: Option<SupportBundleActivationReport>,
collection_err: Option<String>,
}

Expand Down Expand Up @@ -2898,15 +2897,13 @@ fn print_task_support_bundle_collector(details: &serde_json::Value) {
println!(" failed to perform collection: {collection_err}");
}

if let Some(SupportBundleCollectionReport {
bundle,
if let Some(SupportBundleActivationReport {
collection,
activated_in_db_ok,
mut steps,
ereports,
}) = collection_report
{
println!(" Support Bundle Collection Report:");
println!(" Bundle ID: {bundle}");
println!(" Bundle ID: {}", collection.bundle);

#[derive(Tabled)]
#[tabled(rename_all = "SCREAMING_SNAKE_CASE")]
Expand All @@ -2917,57 +2914,39 @@ fn print_task_support_bundle_collector(details: &serde_json::Value) {
status: SupportBundleCollectionStepStatus,
}

let mut steps = collection.steps;
steps.sort_unstable_by_key(|s| s.start);
let rows: Vec<StepRow> = steps
.into_iter()
.iter()
.map(|step| {
let duration = (step.end - step.start)
.to_std()
.unwrap_or(Duration::from_millis(0));
StepRow {
step_name: step.name,
step_name: step.name.clone(),
start_time: step.start,
duration: format!("{:.3}s", duration.as_secs_f64()),
status: step.status,
status: step.status.clone(),
}
})
.collect();

if !rows.is_empty() {
println!("\n{}", tabled::Table::new(rows));
}
println!(
" Bundle was activated in the database: {activated_in_db_ok}"
);
match ereports {
None => {
println!(" ereport collection was not requested");
}
Some(SupportBundleEreportStatus {
errors,
n_collected,
n_found,
}) if !errors.is_empty() => {
println!(" ereport collection failed:");
println!(
" total matching ereports found: {n_found}"
);
for step in &steps {
if let Some(details) = &step.details {
println!(" {} details:", step.name);
println!(
" ereports collected successfully: {n_collected}"
"{}",
erebor::Displayer::new(details)
.with_initial_indent_spaces(8)
);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

n.b. that this will display all integers in hex, which may not be what you want here --- maybe use the other indented JSON display thingy we have lying around?

println!(" errors:");
for error in errors {
println!(" {error}");
}
}
Some(SupportBundleEreportStatus {
n_collected, ..
}) => {
// If ereport collection succeeded, n_found should be
// equal to n_collected.
println!(" ereports collected: {n_collected}");
}
}
println!(
" Bundle was activated in the database: {activated_in_db_ok}"
);
}
}
}
Expand Down
15 changes: 7 additions & 8 deletions dev-tools/omdb/src/bin/omdb/support_bundle_collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,13 @@ impl CollectArgs {
step.status,
step.name,
);
}
if let Some(ereports) = &report.ereports {
eprintln!(
"ereports: {} found, {} collected, {} errors",
ereports.n_found,
ereports.n_collected,
ereports.errors.len(),
);
if let Some(details) = &step.details {
eprintln!(
"{}",
erebor::Displayer::new(details)
.with_initial_indent_spaces(6)
);
}
}
Ok(())
}
Expand Down
Loading
Loading