feat(health): export NVUE REST per-fan state metric - #4484
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (2)
Summary by CodeRabbit
WalkthroughThe NVUE REST health collector parses optional fan states, maps them to ChangesNVUE fan state reporting
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant NVUEFanEndpoint
participant FanData
participant NVUERestCollector
NVUERestCollector->>NVUEFanEndpoint: request fan response
NVUEFanEndpoint-->>FanData: return fan state and max-speed
FanData-->>NVUERestCollector: provide parsed fan data
NVUERestCollector->>NVUERestCollector: map state to ok, not_ok, or unknown
NVUERestCollector-->>NVUERestCollector: emit fan_state and fan_max_speed
Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
crates/health/src/collectors/nvue/rest/collector.rs (1)
91-109: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse a typed
FanStaterepresentation.Replace the raw
FAN_STATE_STATESstrings and mapper outputs with aFanStateenum that implementsDisplayandFromStr. Keep the StateSet output unchanged:ok,not_ok, andunknown.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@crates/health/src/collectors/nvue/rest/collector.rs` around lines 91 - 109, The fan-state mapping currently uses raw strings instead of a typed representation. Introduce a FanState enum with ok, not_ok, and unknown variants, implement Display to preserve the existing StateSet strings and FromStr for case-insensitive NVUE values including unavailable and n/a, then update fan_state_to_state and FAN_STATE_STATES to use the enum while keeping their serialized output unchanged.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/architecture/health_aggregation.md`:
- Around line 287-290: Update the NVUE REST fan endpoint documentation to state
that fan_max_speed is emitted only for finite, non-negative, parseable max-speed
values, while fan_state is emitted even when speed is absent or invalid.
Document fan_name and state labels, rpm and state units, one 0/1 series per
StateSet value, and the trimmed case-insensitive mapping: ok remains ok;
missing, empty, unknown, unavailable, and n/a map to unknown; all other values
map to not_ok.
---
Nitpick comments:
In `@crates/health/src/collectors/nvue/rest/collector.rs`:
- Around line 91-109: The fan-state mapping currently uses raw strings instead
of a typed representation. Introduce a FanState enum with ok, not_ok, and
unknown variants, implement Display to preserve the existing StateSet strings
and FromStr for case-insensitive NVUE values including unavailable and n/a, then
update fan_state_to_state and FAN_STATE_STATES to use the enum while keeping
their serialized output unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 80ca566b-aace-47f1-b714-f920b9946eb5
📒 Files selected for processing (3)
crates/health/src/collectors/nvue/rest/client.rscrates/health/src/collectors/nvue/rest/collector.rsdocs/architecture/health_aggregation.md
The NVUE REST collector parsed the fan environment endpoint only for max-speed, so a fan reporting a non-OK state produced no signal at all and a fan missing its speed produced no series to notice it by. Parse the per-fan state field and emit it as a bounded StateSet next to the existing speed metric. Absent and explicitly unavailable values map to unknown so they stay distinguishable from a reported fault, and the state series is emitted per fan regardless of whether its speed parses.
1562f77 to
e5f3e2d
Compare
|
/ok to test e5f3e2d |
|
🌿 Preview your docs: https://nvidia-preview-pull-request-4484.docs.buildwithfern.com/infra-controller |
The NVUE REST collector parsed the fan environment endpoint only for max-speed, so a fan reporting a non-OK state produced no signal at all and a fan missing its speed produced no series to notice it by.
Parse the per-fan state field and emit it as a bounded StateSet next to the existing speed metric. Absent and explicitly unavailable values map to unknown so they stay distinguishable from a reported fault, and the state series is emitted per fan regardless of whether its speed parses.
Related issues
Issue 4481
Type of Change
Breaking Changes
Testing
Additional Notes
None