Skip to content

feat(health): export NVUE REST per-fan state metric - #4484

Open
nvrzeznik wants to merge 1 commit into
NVIDIA:mainfrom
nvrzeznik:pull-request/4481
Open

feat(health): export NVUE REST per-fan state metric#4484
nvrzeznik wants to merge 1 commit into
NVIDIA:mainfrom
nvrzeznik:pull-request/4481

Conversation

@nvrzeznik

@nvrzeznik nvrzeznik commented Aug 3, 2026

Copy link
Copy Markdown

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

  • Add - New feature or capability
  • Change - Changes in existing functionality
  • Fix - Bug fixes
  • Remove - Removed features or deprecated functionality
  • Internal - Internal changes (refactoring, tests, docs, etc.)

Breaking Changes

  • This PR contains breaking changes

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
  • No testing required (docs, internal refactor, etc.)

Additional Notes

None

@nvrzeznik
nvrzeznik requested review from a team and polarweasel as code owners August 3, 2026 16:25
@copy-pr-bot

copy-pr-bot Bot commented Aug 3, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: d210a5ed-a22f-4716-aa75-922585ea5252

📥 Commits

Reviewing files that changed from the base of the PR and between 1562f77 and e5f3e2d.

📒 Files selected for processing (3)
  • crates/health/src/collectors/nvue/rest/client.rs
  • crates/health/src/collectors/nvue/rest/collector.rs
  • docs/architecture/health_aggregation.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • docs/architecture/health_aggregation.md
  • crates/health/src/collectors/nvue/rest/client.rs

Summary by CodeRabbit

  • New Features

    • Added NVUE fan health monitoring with ok, not_ok, and unknown statuses.
    • Fan state metrics are now reported alongside maximum-speed metrics.
    • Unavailable or unrecognized fan states are handled consistently.
  • Documentation

    • Updated health monitoring documentation to describe fan state metrics and status values.

Walkthrough

The NVUE REST health collector parses optional fan states, maps them to ok, not_ok, or unknown, and emits fan_state StateSets alongside parseable maximum-speed metrics. Tests and architecture documentation cover the new behavior.

Changes

NVUE fan state reporting

Layer / File(s) Summary
Fan state response parsing
crates/health/src/collectors/nvue/rest/client.rs
FanData now exposes the optional NVUE fan state. Parsing tests cover complete responses and responses without max-speed.
Fan state mapping and emission
crates/health/src/collectors/nvue/rest/collector.rs
The collector trims and case-normalizes fan states, maps them to ok, not_ok, or unknown, and emits fan_state StateSets with existing fan_max_speed metrics.
Fan state validation and documentation
crates/health/src/collectors/nvue/rest/collector.rs, docs/architecture/health_aggregation.md
Tests cover healthy, faulty, unavailable, empty, and unrecognized states. Fixture assertions cover emitted fan entities. Documentation describes conditional speed metrics and bounded fan-state output.

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
Loading

Possibly related issues

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the primary change: exporting the per-fan NVUE REST state metric.
Description check ✅ Passed The description directly explains the fan-state parsing, StateSet emission, unknown-state mapping, and test coverage.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
crates/health/src/collectors/nvue/rest/collector.rs (1)

91-109: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use a typed FanState representation.

Replace the raw FAN_STATE_STATES strings and mapper outputs with a FanState enum that implements Display and FromStr. Keep the StateSet output unchanged: ok, not_ok, and unknown.

🤖 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

📥 Commits

Reviewing files that changed from the base of the PR and between 47b4d3a and 1562f77.

📒 Files selected for processing (3)
  • crates/health/src/collectors/nvue/rest/client.rs
  • crates/health/src/collectors/nvue/rest/collector.rs
  • docs/architecture/health_aggregation.md

Comment thread docs/architecture/health_aggregation.md Outdated
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.
@mxh-0xbb

mxh-0xbb commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

/ok to test e5f3e2d

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants