-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Fix Diagnose Formatting In Disk Usage Checks #12229
Conversation
vault/diagnose/os_common.go
Outdated
@@ -31,11 +31,11 @@ partLoop: | |||
Warn(ctx, fmt.Sprintf("Could not obtain partition usage for %s: %v.", partition.Mountpoint, err)) | |||
} else { | |||
if usage.UsedPercent > 95 { | |||
SpotWarn(ctx, testName, fmt.Sprintf(partition.Mountpoint+" is %d percent full.", usage.UsedPercent), | |||
Advice("It is recommended to have more than five percent of the partition free.")) | |||
SpotWarn(ctx, testName, fmt.Sprintf(partition.Mountpoint+" is %f percent full.", usage.UsedPercent)) |
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 usually like to limit the number of digits of precision for float printfs, e.g. %.2f
. Otherwise it can look ungainly.
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.
Ah, didn't realize there was a simple way to make that nicer. Thanks, will do!
vault/diagnose/os_common.go
Outdated
} else if usage.Free < 2<<30 { | ||
SpotWarn(ctx, testName, partition.Mountpoint+" has %d bytes full.", | ||
Advice("It is recommended to have at least 1 GB of space free per partition.")) | ||
SpotWarn(ctx, testName, fmt.Sprintf(partition.Mountpoint+" has %d bytes free.", usage.Free)) |
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.
Bytes can be hard to read when we're talking about 8-9 digits. Maybe show as MBs or MiBs instead?
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.
Will do!
No description provided.