mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #3628] [CLOSED] [GUI] Add opt-in GPU energy and electricity cost monitoring to the Power card #4723
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#4723
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/3628
Author: @hash13
Created: 10/21/2026
Status: ❌ Closed
Base:
main← Head:feature/monitor-gpu-electricity-cost📝 Commits (6)
4b8ba58feat(monitor): add opt-in cumulative GPU energy tracking51134b6feat(monitor): show GPU electricity costs in Power card3dbfe9aMerge branch 'main' into feature/monitor-gpu-electricity-costac3f2a2Merge branch 'main' into feature/monitor-gpu-electricity-cost9729bf6Merge branch 'Niko1221:main' into feature/monitor-gpu-electricity-costfdb7e6dMerge branch 'Niko1221:main' into feature/monitor-gpu-electricity-cost📊 Changes
3 files changed (+104 additions, -3 deletions)
View changed files
📝
serve/server.py(+3 -1)📝
serve/telemetry.py(+54 -1)📝
serve/web/app.js(+47 -1)📄 Description
[GUI] Add opt-in GPU energy and electricity cost monitoring to the Power card
Summary
This PR adds optional GPU energy monitoring and electricity cost calculations to Strata's existing Monitor Power card.
The feature reuses Strata's existing GPU telemetry, multi-GPU support, and Monitor refresh infrastructure. No additional services, dependencies, or persistent storage are required.
Energy monitoring is strictly opt-in. Without an
electricityconfiguration block, the existing Power card behavior remains unchanged.The implementation focuses on cumulative GPU energy consumption and total electricity costs. Request-level energy attribution and token cost calculations are intentionally out of scope.
Screenshot
Configuration
Add an
electricityblock to the top level of the active Strata JSON configuration.Energy monitoring only:
Energy monitoring with electricity costs:
price_per_kwh: Optional non-negative electricity price per kWh.currency: Optional ISO currency code, defaulting toEUR.electricityblock, the feature is disabled.Configuration changes take effect after restarting the server.
Power Card
The existing Power card retains its current GPU power reading, power limit, and power history sparkline.
When electricity costs are enabled, the card uses a compact two-column layout:
The layout reuses the existing Speed card styling without additional CSS or increased card height.
When only energy monitoring is enabled, cumulative energy consumption appears alongside the existing power limit.
All values update through the existing Monitor refresh cycle.
Value Formatting
Energy consumption:
Electricity costs:
< 0.001 €Currency symbols use the existing smaller unit styling. Number formatting follows the browser's locale.
Energy Measurement
The implementation prefers NVIDIA's cumulative NVML hardware energy counter (
nvmlDeviceGetTotalEnergyConsumption) when supported.This provides accumulated energy directly in millijoules and avoids estimating consumption solely from periodically sampled power values.
If cumulative counter readings are unavailable during initialization, energy is estimated by integrating the existing GPU power samples over time using the trapezoidal rule.
For multi-GPU configurations:
Energy accumulation begins when the telemetry sampler starts and resets when the sampler is recreated.
Electricity costs are calculated as:
Cost = accumulated GPU energy (kWh) × configured price per kWh
The cost calculation uses the accumulated energy value without requiring additional NVML reads beyond energy monitoring itself.
Measurements cover GPU energy only. CPU, RAM, motherboard, storage, fans, and PSU conversion losses are excluded.
Estimated energy depends on the availability and accuracy of GPU power readings.
Operating Modes
electricityblock"electricity": {}electricitywithprice_per_kwhScope and Compatibility
/metricsendpoint extended withhardware.gpu_energy_kwhwhen enabledhardware_staticRequest-level energy attribution is deferred to a later PR, initially limited to serial requests to avoid double counting energy during overlapping requests.
Changed Files
The complete implementation affects three files:
serve/telemetry.pyserve/server.pyserve/web/app.jsFailed: None observed.
Not run: Automated tests, AMD GPUs.
Validation
Revision: Strata v0.2.2 with PR changes
Environment: Intel i9-14900K, 2× RTX 5060 Ti, CUDA 13.0, Podman
Commands / steps:
Passed:
Failed: None observed.
Not run: Automated tests, AMD GPUs.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.