Skip to content
Merged
Changes from 4 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
8 changes: 4 additions & 4 deletions vault/diagnose/os_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Copy link
Collaborator

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.

Copy link
Contributor Author

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!

Advise(ctx, "It is recommended to have more than five percent of the partition free.")
} 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))
Copy link
Collaborator

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do!

Advise(ctx, "It is recommended to have at least 1 GB of space free per partition.")
} else {
SpotOk(ctx, testName, partition.Mountpoint+" usage ok.")
}
Expand Down