fix storage calculation in metrics#252
Merged
mateeullahmalik merged 6 commits intomasterfrom Dec 31, 2025
Merged
Conversation
All issues have been addressed. The PR looks good to merge.
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
a-ok123
previously approved these changes
Dec 31, 2025
Contributor
There was a problem hiding this comment.
Pull request overview
This PR attempts to fix storage calculation in metrics by applying an adjustment factor to the reported disk total size. However, the implementation introduces critical inconsistencies in the metrics calculations.
Key Changes:
- Added math.Floor() and a 1.034 adjustment factor to DiskTotalGb calculation
- Added math package import
Comments suppressed due to low confidence (1)
supernode/supernode_metrics/metrics_collection.go:63
- Fallback calculation uses unadjusted storage.TotalBytes instead of adjusted metrics.DiskTotalGb. When DiskUsagePercent is 0 and needs to be calculated, this fallback divides by storage.TotalBytes (the original unadjusted value) rather than by the adjusted metrics.DiskTotalGb value computed on line 57. This creates an inconsistency where the usage percentage would be calculated against a different total than what's reported in DiskTotalGb, potentially resulting in usage percentages that don't align with the reported total and free GB values.
if metrics.DiskUsagePercent == 0 && storage.TotalBytes > 0 {
used := storage.TotalBytes - storage.AvailableBytes
metrics.DiskUsagePercent = float64(used) / float64(storage.TotalBytes) * 100
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3bcc47e
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.