fix(collector): avoid double-counting shelf power#4116
Merged
cgrinds merged 3 commits intoNetApp:mainfrom Feb 6, 2026
Merged
Conversation
Collaborator
|
Thanks for the great problem description and PR @rmilkowski We'll take a look and get back to you |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where Harvest double-counts disk shelf power by summing both input and output power rails, resulting in approximately double the actual power consumption (e.g., reporting ~699W instead of ~360W for shelf 1.1).
Changes:
- Introduces rail classification logic to distinguish between input and output power rails based on sensor labels
- Updates shelf power calculation to prioritize input rails, fall back to output rails, and only sum all pairs when rail type cannot be determined
- Adds comprehensive test coverage for the new rail classification functions
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/power/rail.go | Implements rail classification logic to identify input/output power rails from sensor labels |
| pkg/power/rail_test.go | Provides test coverage for rail classification and resolution functions |
| cmd/collectors/zapiperf/plugins/disk/disk.go | Updates ZAPI collector to classify rails and use input-only pairs for power calculation |
| cmd/collectors/restperf/plugins/disk/disk.go | Updates REST collector to classify rails and use input-only pairs for power calculation |
| docs/resources/power-algorithm.md | Documents the new rail-based power calculation behavior |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collaborator
|
hi @rmilkowski I addressed the lint issues in rmilkowski#1 Once you get a chance to review and approve those changes we can merge this. Nice job! 🎊 |
rahulguptajss
previously approved these changes
Feb 5, 2026
refactor: disk lint errors
cgrinds
approved these changes
Feb 6, 2026
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.
Harvest is reporting 699W fot a disk shelf which seems to be much more than what it actually is.
Here are the exact ONTAP CLI commands and the evidence (from your output) showing how Harvest is double‑counting shelf power:
Commands to run
1) Authoritative shelf power draw
storage shelf show -fields shelf,psu-power-drawn,psu-power-rating
2) Per‑shelf voltage/current rails (what Harvest is effectively summing)
storage shelf show -instance
What the output shows (shelf 1.1)
From storage shelf show -fields …:
From storage shelf show -instance (Voltage/Current sensors):
Total (summing both rails):
324.8 W + 370.8 W = 695.6 W → this matches Harvest’s ~699 W.
So Harvest is effectively adding both input and output rails. That doubles the true draw, because input (243 V, ~0.7–0.82 A) already represents the PSU’s power draw and matches the psu-power-drawn values (~171/189 W). The 12 V rail is the output to the shelf and should not be added on top of input.