-
Notifications
You must be signed in to change notification settings - Fork 1.2k
server: fix NaN metrics for external resources #11302
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
Conversation
CPU and RAM values for external resource metrics was showing NaN values. This fixes the behaviour. Signed-off-by: Abhishek Kumar <[email protected]>
2437763 to
913655f
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #11302 +/- ##
=========================================
Coverage 16.99% 16.99%
- Complexity 14715 14718 +3
=========================================
Files 5832 5832
Lines 517561 517562 +1
Branches 62982 62982
=========================================
+ Hits 87975 87984 +9
+ Misses 419651 419643 -8
Partials 9935 9935
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@blueorangutan package |
|
@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
harikrishna-patnala
left a comment
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.
code LGTM
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.
Pull Request Overview
This PR fixes NaN (Not a Number) values appearing in CPU and RAM metrics for external resources by adding zero-value checks before performing division operations. The fix prevents division by zero scenarios that were causing the NaN values to appear in the UI.
Key changes:
- Added a null/zero check in the
calculateResourceAllocatedPercentagemethod to return "0.00%" when either the resource or resourceWithOverProvision values are zero - Refactored existing inline percentage calculation to use the centralized
calculateResourceAllocatedPercentagemethod for consistency
| return "0.00%"; | ||
| } | ||
| DecimalFormat decimalFormat = new DecimalFormat("#.##"); | ||
| return decimalFormat.format(((float)resource / resourceWithOverProvision * 100.0f)) + "%"; |
Copilot
AI
Jul 28, 2025
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.
The cast to (float) is unnecessary since the parameters are already declared as float. This redundant cast reduces code readability.
| return decimalFormat.format(((float)resource / resourceWithOverProvision * 100.0f)) + "%"; | |
| return decimalFormat.format((resource / resourceWithOverProvision * 100.0f)) + "%"; |
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.
Can be a separate PR/change as not touched here
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 14408 |
DaanHoogland
left a comment
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 think both copilot’s remarks make sense. otherwise clgtm
kiranchavala
left a comment
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.
@shwstppr can check if copilot's commits are relevant? |
|
@sureshanaparti I don't think Copilot's comment are completely relevant. I've added my comments in their reply |
CPU and RAM values for external resource metrics was showing NaN values. This fixes the behaviour. Signed-off-by: Abhishek Kumar <[email protected]>


Description
CPU and RAM values for external resource metrics was showing NaN values. This fixes the behaviour.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
Before:

After:

How Has This Been Tested?
How did you try to break this feature and the system with this change?