Skip to content

feat(health): preserve NVUE reboot reason metadata#3712

Merged
jayzhudev merged 1 commit into
NVIDIA:mainfrom
jayzhudev:health/nvue-reboot-data
Jul 20, 2026
Merged

feat(health): preserve NVUE reboot reason metadata#3712
jayzhudev merged 1 commit into
NVIDIA:mainfrom
jayzhudev:health/nvue-reboot-data

Conversation

@jayzhudev

Copy link
Copy Markdown
Contributor

Route NVUE reboot metadata through log sinks, including OTLP.

Related issues

Closes #3711

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.)

@jayzhudev jayzhudev self-assigned this Jul 20, 2026
@jayzhudev
jayzhudev requested a review from a team as a code owner July 20, 2026 01:48
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Summary by CodeRabbit

  • New Features
    • Added structured reboot-reason log events with details such as switch, reason, timestamp, and user.
    • Added configuration to enable or disable reboot-reason log events.
  • Bug Fixes
    • Preserved structured log attributes even when diagnostic details are excluded.
  • Testing
    • Added coverage for enabled and disabled log-event behavior and attribute preservation.

Walkthrough

NVUE reboot data now emits structured log records containing reboot metadata while retaining the existing metric. Discovery propagates the log setting, tests cover enabled and disabled emission, and TracingSink preserves standard attributes when diagnostics are disabled.

Changes

Reboot reason logging

Layer / File(s) Summary
Structured reboot event emission
crates/health/src/collectors/nvue/rest/collector.rs, crates/health/src/discovery/spawn.rs
The collector configuration and discovery wiring control structured reboot logs containing message_id, switch_id, reason, gentime, and user; tests validate log and metric output.
Tracing attribute preservation
crates/health/src/sink/tracing.rs
TracingSink emits processed log records consistently and preserves attributes without diagnostics; a unit test verifies the serialized output.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant NVUECollector
  participant TracingSink
  participant TracingSubscriber
  NVUECollector->>TracingSink: emit structured reboot LogRecord
  TracingSink->>TracingSink: process record with diagnostics setting
  TracingSink->>TracingSubscriber: emit tracing info event with attributes
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately reflects the main change: preserving NVUE reboot metadata.
Description check ✅ Passed The description matches the implemented NVUE reboot metadata routing and OTLP logging changes.
Linked Issues check ✅ Passed The changes cover structured reboot logs, OTLP attribute preservation, diagnostics-safe logging, and reason-only metrics.
Out of Scope Changes check ✅ Passed All visible edits are tightly scoped to NVUE reboot metadata logging and its tests.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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)

1356-1406: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Cover the required unknown fallbacks.

Add missing-field cases and assert reason, gentime, and user become unknown; the current test only protects the fully populated response. Use a table with the populated case and missing-value variants. As per coding guidelines, “Use a table whenever two or more tests call the same operation with different inputs.”

🤖 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 1356 -
1406, Expand
test_reboot_reason_emits_log_metadata_and_limits_metric_labels_to_reason into a
table-driven test covering the fully populated response plus cases where reason,
gentime, or user is missing. For each case, call emit_reboot_reason_data and
assert the corresponding log attributes use "unknown", while preserving the
existing metric and populated-value assertions.

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 `@crates/health/src/sink/tracing.rs`:
- Around line 83-95: Update the tracing::info! call in the log-record export
path to emit each entry from record.attributes as an individual tracing field
instead of the aggregated attributes = ?record.attributes field, preserving keys
such as message_id, switch_id, reason, gentime, and user for OpenTelemetry
queries. Update the associated test assertions to verify each attribute key is
exported separately.

---

Nitpick comments:
In `@crates/health/src/collectors/nvue/rest/collector.rs`:
- Around line 1356-1406: Expand
test_reboot_reason_emits_log_metadata_and_limits_metric_labels_to_reason into a
table-driven test covering the fully populated response plus cases where reason,
gentime, or user is missing. For each case, call emit_reboot_reason_data and
assert the corresponding log attributes use "unknown", while preserving the
existing metric and populated-value assertions.
🪄 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: da134857-aff7-4d17-918f-74a33686ca46

📥 Commits

Reviewing files that changed from the base of the PR and between 5002c1c and a986d89.

📒 Files selected for processing (2)
  • crates/health/src/collectors/nvue/rest/collector.rs
  • crates/health/src/sink/tracing.rs

Comment thread crates/health/src/sink/tracing.rs
@jayzhudev jayzhudev changed the title feat(health): preserve NVUE reboot log metadata feat(health): preserve NVUE reboot reason metadata Jul 20, 2026
Signed-off-by: Jay Zhu <jayzhu@nvidia.com>
@jayzhudev
jayzhudev force-pushed the health/nvue-reboot-data branch from a986d89 to a5f8f90 Compare July 20, 2026 02:29

@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.

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

1364-1437: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Make reboot-reason coverage table-driven and cover unknown fallbacks.

The tests cover only a fully populated payload and the logging toggle. Add cases for missing reason, gentime, and user, asserting the required unknown values in both the metric and structured log output. These variants should be consolidated into one table-driven test rather than separate tests.

As per coding guidelines and path instructions, use table-driven coverage for this missing-field contract; the PR objective requires unknown for missing reboot fields.

🤖 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 1364 -
1437, Replace the separate reboot-reason tests with one table-driven test
covering fully populated data and each missing reason, gentime, or user variant.
In the test around emit_reboot_reason_data, assert that missing fields produce
"unknown" in both the structured log attributes and metric reason label, while
preserving the existing assertions for log metadata, sample values, and the
log-disabled metric-only behavior.

Sources: Coding guidelines, Path instructions

🤖 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.

Nitpick comments:
In `@crates/health/src/collectors/nvue/rest/collector.rs`:
- Around line 1364-1437: Replace the separate reboot-reason tests with one
table-driven test covering fully populated data and each missing reason,
gentime, or user variant. In the test around emit_reboot_reason_data, assert
that missing fields produce "unknown" in both the structured log attributes and
metric reason label, while preserving the existing assertions for log metadata,
sample values, and the log-disabled metric-only behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: ef37031d-1a96-4a20-ac6f-4d39be30ebeb

📥 Commits

Reviewing files that changed from the base of the PR and between a986d89 and a5f8f90.

📒 Files selected for processing (3)
  • crates/health/src/collectors/nvue/rest/collector.rs
  • crates/health/src/discovery/spawn.rs
  • crates/health/src/sink/tracing.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/health/src/sink/tracing.rs

@jayzhudev
jayzhudev merged commit a400f7f into NVIDIA:main Jul 20, 2026
61 checks passed
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.

feat: include user and gentime for NVUE reboot reason in health

2 participants