Skip to content
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

Merged
merged 8 commits into from Aug 2, 2021
Merged

Conversation

HridoyRoy
Copy link
Contributor

No description provided.

@@ -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
Contributor

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!

} 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
Contributor

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!

@vercel vercel bot temporarily deployed to Preview – vault August 2, 2021 15:24 Inactive
@vercel vercel bot temporarily deployed to Preview – vault-storybook August 2, 2021 15:24 Inactive
@vercel vercel bot temporarily deployed to Preview – vault-storybook August 2, 2021 15:28 Inactive
@vercel vercel bot temporarily deployed to Preview – vault August 2, 2021 15:28 Inactive
@vercel vercel bot temporarily deployed to Preview – vault August 2, 2021 15:44 Inactive
@vercel vercel bot temporarily deployed to Preview – vault-storybook August 2, 2021 15:44 Inactive
@HridoyRoy HridoyRoy linked an issue Aug 2, 2021 that may be closed by this pull request
@vercel vercel bot temporarily deployed to Preview – vault August 2, 2021 16:31 Inactive
@vercel vercel bot temporarily deployed to Preview – vault-storybook August 2, 2021 16:31 Inactive
@HridoyRoy HridoyRoy merged commit 6c234cc into main Aug 2, 2021
@HridoyRoy HridoyRoy deleted the diagnose-print-fix branch August 2, 2021 17:06
jartek pushed a commit to jartek/vault that referenced this pull request Sep 11, 2021
* save

* fix diagnose formatting errors

* fix diagnose formatting errors

* change powers

* change powers

* use humanize instead of doing the conversion to mb manually

* cl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Vault Operator Diagnose improperly formats Disk Usage output
2 participants