Skip to content

feat(health): add NVLink domain UUID to switch telemetry - #4476

Merged
jayzhudev merged 2 commits into
NVIDIA:mainfrom
jayzhudev:health/nvl-domain-uuid
Aug 4, 2026
Merged

feat(health): add NVLink domain UUID to switch telemetry#4476
jayzhudev merged 2 commits into
NVIDIA:mainfrom
jayzhudev:health/nvl-domain-uuid

Conversation

@jayzhudev

Copy link
Copy Markdown
Contributor

Switch health metrics and logs need the NVLink domain UUID to correlate failures. This PR reads the UUID from NICo API switch inventory or static endpoint configuration and includes it in metric and log sink output.

Collectors restart when the UUID changes so telemetry does not retain stale domain metadata. Missing, invalid, and nil UUIDs are omitted.

Related issues

Supports #4397

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 Aug 1, 2026
@jayzhudev
jayzhudev requested review from a team and polarweasel as code owners August 1, 2026 18:30
@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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: 42604f2d-7da5-40b3-b452-16c03a188c48

📥 Commits

Reviewing files that changed from the base of the PR and between 3224623 and 076c5e1.

📒 Files selected for processing (16)
  • crates/health/example/config.example.toml
  • crates/health/src/api_client.rs
  • crates/health/src/collectors/nvue/gnmi/on_change_processor.rs
  • crates/health/src/collectors/nvue/gnmi/sample_processor.rs
  • crates/health/src/config.rs
  • crates/health/src/discovery/cleanup.rs
  • crates/health/src/discovery/context.rs
  • crates/health/src/discovery/iteration.rs
  • crates/health/src/discovery/spawn.rs
  • crates/health/src/endpoint/model.rs
  • crates/health/src/endpoint/sources.rs
  • crates/health/src/otlp/convert.rs
  • crates/health/src/sink/events.rs
  • crates/health/src/sink/log_file.rs
  • crates/health/src/sink/prometheus.rs
  • docs/architecture/health_aggregation.md
🚧 Files skipped from review as they are similar to previous changes (16)
  • crates/health/src/collectors/nvue/gnmi/on_change_processor.rs
  • crates/health/src/endpoint/model.rs
  • crates/health/example/config.example.toml
  • crates/health/src/api_client.rs
  • crates/health/src/collectors/nvue/gnmi/sample_processor.rs
  • crates/health/src/sink/prometheus.rs
  • crates/health/src/sink/log_file.rs
  • crates/health/src/config.rs
  • crates/health/src/sink/events.rs
  • crates/health/src/endpoint/sources.rs
  • crates/health/src/discovery/iteration.rs
  • crates/health/src/discovery/cleanup.rs
  • docs/architecture/health_aggregation.md
  • crates/health/src/discovery/context.rs
  • crates/health/src/discovery/spawn.rs
  • crates/health/src/otlp/convert.rs

Summary by CodeRabbit

  • New Features

    • Added optional NVLink domain UUID metadata for switch endpoints and static switch configurations.
    • NVLink domain UUIDs now appear in supported Prometheus labels, OTLP resource attributes, events, and JSONL logs.
    • Invalid or nil UUID values are omitted from telemetry.
  • Bug Fixes

    • Switch collectors now restart automatically when an endpoint’s NVLink domain changes, preventing stale monitoring data.
  • Documentation

    • Updated configuration and telemetry documentation with NVLink domain metadata details.

Walkthrough

The health service now accepts optional NVLink domain UUIDs for switch endpoints, tracks domain changes during discovery, restarts affected collectors, and exports the metadata through events, JSONL, Prometheus, and OTLP sinks.

Changes

NVLink domain metadata

Layer / File(s) Summary
Switch metadata ingestion
crates/health/src/endpoint/model.rs, crates/health/src/endpoint/sources.rs, crates/health/src/config.rs, crates/health/src/api_client.rs, crates/health/example/config.example.toml, crates/health/src/collectors/nvue/gnmi/*, crates/health/src/discovery/spawn.rs
Switch metadata and static configuration now support optional NVLink domain UUIDs. Parsers reject invalid and nil values. API responses preserve non-nil UUIDs. Test fixtures initialize absent UUIDs explicitly.
Discovery domain-change restarts
crates/health/src/discovery/context.rs, crates/health/src/discovery/cleanup.rs, crates/health/src/discovery/iteration.rs
Discovery records the first domain observation for each endpoint key. Domain changes remove and stop all affected collectors before respawn. Stale observations are removed, and duplicate sources retain first-source precedence.
Telemetry metadata propagation
crates/health/src/sink/events.rs, crates/health/src/sink/log_file.rs, crates/health/src/sink/prometheus.rs, crates/health/src/otlp/convert.rs, docs/architecture/health_aggregation.md
Switch domain UUIDs are exposed through event context, JSONL fields, Prometheus labels, and the OTLP nvlink.domain.uuid resource attribute. Documentation describes the mappings.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant DiscoveryIteration
  participant CollectorState
  participant stop_stale_switch_collectors
  participant SwitchEndpointCollectors
  DiscoveryIteration->>CollectorState: observe_switch_domain
  CollectorState-->>DiscoveryIteration: report domain change
  DiscoveryIteration->>stop_stale_switch_collectors: remove stale collectors
  stop_stale_switch_collectors->>SwitchEndpointCollectors: await collector shutdown
  DiscoveryIteration->>SwitchEndpointCollectors: respawn collectors with current metadata
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: adding NVLink domain UUIDs to switch telemetry.
Description check ✅ Passed The description directly explains UUID sources, telemetry outputs, collector restarts, omission rules, and testing for the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 85.37% 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.

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

@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: 3

🤖 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/discovery/cleanup.rs`:
- Around line 51-106: Add a bounded shutdown helper around Collector::stop so
each stale collector is given a deadline, then its task is aborted and joined if
it does not finish; update the final join_all in stop_stale_switch_collectors to
use this behavior. Ensure shutdown does not detach old collectors before
replacements are spawned, and preserve cleanup completion for every collector.

In `@crates/health/src/sink/events.rs`:
- Line 673: Update the switch accessor fixtures at the changed
`nvlink_domain_uuid` assignments to use a fixed non-nil UUID instead of
`nvlink_domain_id()`, so they verify propagation of a valid switch UUID.
Preserve nil UUID omission coverage in a separate test case.

In `@docs/architecture/health_aggregation.md`:
- Line 284: Update the OTLP resource-attribute documentation in the
`[sinks.otlp]` section to include machine.serial, driver.version,
component.type, switch.serial_number, switch.endpoint_role, and
switch.is_primary, matching the attributes emitted by the conversion logic. Keep
the existing attribute names and type annotations accurate, and ensure the list
is presented as complete rather than omitting emitted attributes.
🪄 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: 608e4956-418f-408e-8c87-e8a7f38e0c29

📥 Commits

Reviewing files that changed from the base of the PR and between ef4fffb and 5865518.

📒 Files selected for processing (16)
  • crates/health/example/config.example.toml
  • crates/health/src/api_client.rs
  • crates/health/src/collectors/nvue/gnmi/on_change_processor.rs
  • crates/health/src/collectors/nvue/gnmi/sample_processor.rs
  • crates/health/src/config.rs
  • crates/health/src/discovery/cleanup.rs
  • crates/health/src/discovery/context.rs
  • crates/health/src/discovery/iteration.rs
  • crates/health/src/discovery/spawn.rs
  • crates/health/src/endpoint/model.rs
  • crates/health/src/endpoint/sources.rs
  • crates/health/src/otlp/convert.rs
  • crates/health/src/sink/events.rs
  • crates/health/src/sink/log_file.rs
  • crates/health/src/sink/prometheus.rs
  • docs/architecture/health_aggregation.md

Comment thread crates/health/src/discovery/cleanup.rs
Comment thread crates/health/src/sink/events.rs
Comment thread docs/architecture/health_aggregation.md Outdated
Comment thread crates/health/src/endpoint/sources.rs Outdated
Comment thread crates/health/src/discovery/iteration.rs
Comment thread crates/health/src/discovery/cleanup.rs Outdated
@jayzhudev
jayzhudev force-pushed the health/nvl-domain-uuid branch from 9a1b40b to dac5a96 Compare August 4, 2026 00:02

@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/discovery/cleanup.rs (1)

309-397: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Cover UUID rotation and UUID removal transitions.

The tests cover None -> Some(uuid) but not Some(uuid_a) -> Some(uuid_b) or Some(uuid) -> None.

Add table-driven cases for both transitions. Assert that each transition removes the collector. This verifies that a rotated UUID replaces stale metadata and that an unavailable UUID removes the old telemetry label.

🤖 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/discovery/cleanup.rs` around lines 309 - 397, Extend the
tests around stop_stale_switch_collectors to cover both Some(uuid_a) to
Some(uuid_b) rotation and Some(uuid) to None removal, using table-driven cases.
For each transition, initialize the endpoint with the first UUID, register its
NvueRest collector, apply the second UUID, invoke stop_stale_switch_collectors,
and assert that the collector for the endpoint key is removed.

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.

Nitpick comments:
In `@crates/health/src/discovery/cleanup.rs`:
- Around line 309-397: Extend the tests around stop_stale_switch_collectors to
cover both Some(uuid_a) to Some(uuid_b) rotation and Some(uuid) to None removal,
using table-driven cases. For each transition, initialize the endpoint with the
first UUID, register its NvueRest collector, apply the second UUID, invoke
stop_stale_switch_collectors, and assert that the collector for the endpoint key
is removed.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 3ae693fa-4786-410b-9918-ff5f17580164

📥 Commits

Reviewing files that changed from the base of the PR and between 9a1b40b and dac5a96.

📒 Files selected for processing (16)
  • crates/health/example/config.example.toml
  • crates/health/src/api_client.rs
  • crates/health/src/collectors/nvue/gnmi/on_change_processor.rs
  • crates/health/src/collectors/nvue/gnmi/sample_processor.rs
  • crates/health/src/config.rs
  • crates/health/src/discovery/cleanup.rs
  • crates/health/src/discovery/context.rs
  • crates/health/src/discovery/iteration.rs
  • crates/health/src/discovery/spawn.rs
  • crates/health/src/endpoint/model.rs
  • crates/health/src/endpoint/sources.rs
  • crates/health/src/otlp/convert.rs
  • crates/health/src/sink/events.rs
  • crates/health/src/sink/log_file.rs
  • crates/health/src/sink/prometheus.rs
  • docs/architecture/health_aggregation.md
🚧 Files skipped from review as they are similar to previous changes (15)
  • docs/architecture/health_aggregation.md
  • crates/health/src/endpoint/model.rs
  • crates/health/src/collectors/nvue/gnmi/sample_processor.rs
  • crates/health/src/collectors/nvue/gnmi/on_change_processor.rs
  • crates/health/src/sink/log_file.rs
  • crates/health/example/config.example.toml
  • crates/health/src/discovery/iteration.rs
  • crates/health/src/otlp/convert.rs
  • crates/health/src/api_client.rs
  • crates/health/src/sink/events.rs
  • crates/health/src/discovery/spawn.rs
  • crates/health/src/sink/prometheus.rs
  • crates/health/src/endpoint/sources.rs
  • crates/health/src/discovery/context.rs
  • crates/health/src/config.rs

@jayzhudev
jayzhudev force-pushed the health/nvl-domain-uuid branch from dac5a96 to 3224623 Compare August 4, 2026 00:22
Read switch domain UUIDs from Carbide API and propagate them to metrics,
OTLP attributes, events, and structured logs.

Restart collectors when a switch changes domains so cached metadata and
registered metric labels are replaced before collection resumes.

Signed-off-by: Jay Zhu <jayzhu@nvidia.com>
Allow static switch endpoints to provide NVLink domain UUID metadata.
Ignore invalid and nil values so telemetry never publishes unusable labels.

Preserve first-source precedence when duplicate endpoint keys are discovered,
preventing false domain changes and unnecessary collector restarts.

Signed-off-by: Jay Zhu <jayzhu@nvidia.com>
@jayzhudev
jayzhudev enabled auto-merge (squash) August 4, 2026 16:35
@jayzhudev
jayzhudev merged commit d395afa into NVIDIA:main Aug 4, 2026
65 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.

4 participants