Skip to content

refactor: energy data structs #2134

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

Merged

Conversation

sthaha
Copy link
Collaborator

@sthaha sthaha commented Jun 9, 2025

This commit refactors monitor's Energy Usage struct for clarity and accuracy.

Key changes include:

  • Replaced Absolute, Delta, ActiveEnergy, and IdleEnergy with
    EnergyTotal, ActiveEnergyTotal, IdleEnergyTotal, and activeEnergy in NodeUsage.
  • Updated Usage struct to use EnergyTotal, removing Delta.
  • Enhanced energy attribution in calculateNodePower, calculateProcessPower calculateContainerPower, and calculateVMPower.
  • Adjusted Prometheus metrics and stdout exporter to align with new metrics.
  • Renamed CPUTimeDelta to ProcessTotalCPUTimeDelta for clarity.
  • Updated tests and added new ones for active energy behavior.

Fixes:

@github-actions github-actions bot added the chore Routine tasks or maintenance label Jun 9, 2025
@sthaha sthaha force-pushed the fix-active-energy-joules branch from 89944d7 to 7a7b2a2 Compare June 9, 2025 09:32
@github-actions github-actions bot added feat A new feature or enhancement and removed chore Routine tasks or maintenance labels Jun 9, 2025
Copy link

codecov bot commented Jun 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.74%. Comparing base (c3b4722) to head (356c2d7).
Report is 8 commits behind head on reboot.

Additional details and impacted files
@@            Coverage Diff             @@
##           reboot    #2134      +/-   ##
==========================================
+ Coverage   86.22%   91.74%   +5.51%     
==========================================
  Files          34       34              
  Lines        2991     2991              
==========================================
+ Hits         2579     2744     +165     
+ Misses        369      193     -176     
- Partials       43       54      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sthaha sthaha marked this pull request as ready for review June 9, 2025 09:38
@sthaha sthaha requested a review from vprashar2929 June 9, 2025 09:38
@sthaha sthaha changed the title Fix active energy joules refactor: energy data structs Jun 9, 2025
…curacy

Refactor includes:
  * Replace Absolute, Delta, ActiveEnergy, and IdleEnergy with EnergyTotal, ActiveEnergyTotal, IdleEnergyTotal, and activeEnergy in NodeUsage.
  * Update Usage struct to use EnergyTotal and remove Delta.
  * Adjust Prometheus metrics, stdout exporter, and power calculations to use new fields.
  * Rename CPUTimeDelta to ProcessTotalCPUTimeDelta.
  * Update tests and add new tests for active energy behavior.

* Fixes: inaccurate energy attribution in initial node readings

Signed-off-by: Sunil Thaha <[email protected]>
@sthaha sthaha force-pushed the fix-active-energy-joules branch from 7a7b2a2 to 356c2d7 Compare June 9, 2025 23:48
@vimalk78 vimalk78 merged commit 2d33e25 into sustainable-computing-io:reboot Jun 10, 2025
19 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat A new feature or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants