-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use a status struct for RegionReplacementDetector #6564
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me overall! I suggested some very unimportant improvements, but none of them really matter --- if you don't care that much, feel free to ignore me! :)
dev-tools/omdb/src/bin/omdb/nexus.rs
Outdated
println!( | ||
" number of region replacements started ok: {}", | ||
success.region_replacement_started_ok | ||
" number of region replacement requests created ok: \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe this line shouldn't begin with "number of" anymore, since it's now serving double-duty as showing the count and also as the header for the list of requests created?
" number of region replacement requests created ok: \ | |
" region replacement requests created ok: \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this, done in 831848c
dev-tools/omdb/src/bin/omdb/nexus.rs
Outdated
println!( | ||
" number of region replacement start errors: {}", | ||
success.region_replacement_started_err | ||
" number of region replacement start sagas started \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
similarly, maybe:
" number of region replacement start sagas started \ | |
" region replacement start sagas started \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also 831848c
dev-tools/omdb/src/bin/omdb/nexus.rs
Outdated
println!(" > {line}"); | ||
} | ||
|
||
println!(" number of errors: {}", status.errors.len()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and again:
println!(" number of errors: {}", status.errors.len()); | |
println!(" errors: {}", status.errors.len()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also 831848c
dev-tools/omdb/src/bin/omdb/nexus.rs
Outdated
" number of region replacement drive sagas started ok: \ | ||
{}", | ||
status.drive_invoked_ok.len() | ||
); | ||
for line in &status.drive_invoked_ok { | ||
println!(" > {line}"); | ||
} | ||
|
||
println!( | ||
" number of region replacement finish sagas started ok: {}", | ||
" number of region replacement finish sagas started \ | ||
ok: {}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
similarly, these lines now serve as the header for the list of entries invoked OK/errored, I wonder if we should remove the "number of"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also 831848c
dev-tools/omdb/tests/successes.out
Outdated
number of region replacement requests created ok: 0 | ||
number of region replacement start sagas started ok: 0 | ||
number of errors: 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
take it or leave it: if you want to be super-duper extra fancy and align the number columns programmatically, you could use the approach I took in #6541, using const_max_len
to calculate the longest line to align to:
omicron/dev-tools/omdb/src/bin/omdb/nexus.rs
Lines 1193 to 1225 in a3917ea
const VMMS_FOUND: &'static str = "total abandoned VMMs found:"; | |
const VMMS_DELETED: &'static str = " VMM records deleted:"; | |
const VMMS_ALREADY_DELETED: &'static str = | |
" VMMs already deleted by another Nexus:"; | |
const SLED_RESERVATIONS_DELETED: &'static str = | |
"sled resource reservations deleted:"; | |
// To align the number column, figure out the length of the | |
// longest line of text and add one (so that there's a space). | |
// | |
// Yes, I *could* just count the number of characters in each | |
// line myself, but why do something by hand when you could make | |
// the computer do it for you? And, this way, if we change the | |
// text, we won't need to figure it out again. | |
const WIDTH: usize = const_max_len(&[ | |
VMMS_FOUND, | |
VMMS_DELETED, | |
VMMS_ALREADY_DELETED, | |
SLED_RESERVATIONS_DELETED, | |
]) + 1; | |
const NUM_WIDTH: usize = 3; | |
println!(" {VMMS_FOUND:<WIDTH$}{vmms_found:>NUM_WIDTH$}"); | |
println!( | |
" {VMMS_DELETED:<WIDTH$}{vmms_deleted:>NUM_WIDTH$}" | |
); | |
println!( | |
" {VMMS_ALREADY_DELETED:<WIDTH$}{:>NUM_WIDTH$}", | |
vmms_already_deleted | |
); | |
println!( | |
" {SLED_RESERVATIONS_DELETED:<WIDTH$}{:>NUM_WIDTH$}", | |
sled_reservations_deleted, | |
); |
totally up to you, though --- this is probably just me being a perfectionist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in this case, I'm going to leave it the way it is
&log, | ||
let s = format!( | ||
"find_regions_on_expunged_physical_disks failed: {e}" | ||
); | ||
err += 1; | ||
error!(&log, "{s}"); | ||
status.errors.push(s); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
take it or leave it: it might be worth making the error be a structured field on the log entry, so that it can be easily searched with looker
. maybe consider something like:
let message = "find_regions_on_expunged_physical_disks failed";
error!(&log, "{message}"; "error" => e);
status.errors.push(format!("{message}: {e}");
but, it's not a huge deal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in this case, I'm also going to leave it the way it is - I noodled a bit with this suggestion but didn't like the repetition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool, fine with me!
let s = format!( | ||
"error looking for existing region replacement \ | ||
requests for {}: {e}", | ||
region.id(), | ||
); | ||
error!(&log, "{s}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
similarly, it might be nice to make the IDs be structured fields in the log entry and only interpolate them into the error message when formatting the string for the status? not a big deal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(similar feedback applies to the other log messages here, of course)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above, going to skip this suggestion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Like the other replacement related background tasks, use a struct for the return value of the RegionReplacementDetector background task.
Like the other replacement related background tasks, use a struct for the return value of the RegionReplacementDetector background task.