Skip to content

Commit

Permalink
add instance-updater omdb stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkw committed Jul 1, 2024
1 parent 3adbf54 commit f1e7c5d
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 2 deletions.
46 changes: 46 additions & 0 deletions dev-tools/omdb/src/bin/omdb/nexus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
}
match serde_json::from_value::<UpdaterStatus>(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: {:?} \
Expand Down
7 changes: 5 additions & 2 deletions dev-tools/omdb/tests/successes.out
Original file line number Diff line number Diff line change
Expand Up @@ -469,9 +469,12 @@ task: "external_endpoints"
task: "instance_updater"
configured period: every 30s
currently executing: no
last completed activation: <REDACTED ITERATIONS>, triggered by an explicit signal
last completed activation: <REDACTED ITERATIONS>, triggered by a periodic timer firing
started at <REDACTED TIMESTAMP> (<REDACTED DURATION>s ago) and ran for <REDACTED DURATION>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
Expand Down

0 comments on commit f1e7c5d

Please sign in to comment.