From f1e7c5da5f13c4d229bc86f63d4b1bc47353f8b8 Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Mon, 1 Jul 2024 13:03:33 -0700 Subject: [PATCH] add instance-updater omdb stuff --- dev-tools/omdb/src/bin/omdb/nexus.rs | 46 ++++++++++++++++++++++++++++ dev-tools/omdb/tests/successes.out | 7 +++-- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/dev-tools/omdb/src/bin/omdb/nexus.rs b/dev-tools/omdb/src/bin/omdb/nexus.rs index fe13ca797bc..aa3b7151f7f 100644 --- a/dev-tools/omdb/src/bin/omdb/nexus.rs +++ b/dev-tools/omdb/src/bin/omdb/nexus.rs @@ -1086,6 +1086,52 @@ fn print_task_details(bgtask: &BackgroundTask, details: &serde_json::Value) { } } }; + } else if name == "instance_updater" { + #[derive(Deserialize)] + struct UpdaterStatus { + /// number of instances found with destroyed active VMMs + destroyed_active_vmms: usize, + + /// number of instances found with terminated active migrations + terminated_active_migrations: usize, + + /// number of update sagas queued. + update_sagas_queued: usize, + + /// the last error that occurred during execution. + error: Option, + } + match serde_json::from_value::(details.clone()) { + Err(error) => eprintln!( + "warning: failed to interpret task details: {:?}: {:?}", + error, details + ), + Ok(UpdaterStatus { + destroyed_active_vmms, + terminated_active_migrations, + update_sagas_queued, + error, + }) => { + if let Some(error) = error { + println!(" task did not complete successfully!"); + println!(" most recent error: {error}"); + } + + println!( + " total instances in need of updates: {}", + destroyed_active_vmms + terminated_active_migrations + ); + println!( + " instances with destroyed active VMMs: {}", + destroyed_active_vmms, + ); + println!( + " instances with terminated active migrations: {}", + terminated_active_migrations, + ); + println!(" update sagas queued: {update_sagas_queued}"); + } + }; } else { println!( "warning: unknown background task: {:?} \ diff --git a/dev-tools/omdb/tests/successes.out b/dev-tools/omdb/tests/successes.out index 8018dfe66f2..7c239ae0074 100644 --- a/dev-tools/omdb/tests/successes.out +++ b/dev-tools/omdb/tests/successes.out @@ -469,9 +469,12 @@ task: "external_endpoints" task: "instance_updater" configured period: every 30s currently executing: no - last completed activation: , triggered by an explicit signal + last completed activation: , triggered by a periodic timer firing started at (s ago) and ran for ms -warning: unknown background task: "instance_updater" (don't know how to interpret details: Object {"destroyed_active_vmms": Number(0), "error": Null, "sagas_started": Number(0)}) + total instances in need of updates: 0 + instances with destroyed active VMMs: 0 + instances with terminated active migrations: 0 + update sagas queued: 0 task: "instance_watcher" configured period: every 30s