Skip to content

feat(health): add structured OTLP health-report attributes - #4510

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

feat(health): add structured OTLP health-report attributes#4510
nvrzeznik wants to merge 1 commit into
NVIDIA:mainfrom
nvrzeznik:pull-request/4508

Conversation

@nvrzeznik

@nvrzeznik nvrzeznik commented Aug 3, 2026

Copy link
Copy Markdown

Health reports reached OTLP as a prose summary body and a single event.type attribute, so consumers had to parse free text to recover the source, probe results, and alert classifications behind a report.

Emit a versioned health_report.* attribute contract alongside the unchanged summary body: scalar routing fields plus nested successes and alerts that preserve probe IDs, targets, messages, and classifications. The record now carries the report's own observation time when it has one, leaving observed_time_unix_nano as the export time.

Related issues

#4508

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

AI generated PR with tweaks and reading by a human

@nvrzeznik
nvrzeznik requested review from a team and polarweasel as code owners August 3, 2026 22:41
@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

Summary by CodeRabbit

  • New Features

    • Health-report telemetry now includes structured source, target, timestamps, counts, successes, alerts, and classifications.
    • Events use their observed timestamp when available, with export time as a fallback.
    • Health-report targets now use consistent labels across machines, power shelves, racks, and switches.
    • Monitoring receives routing, count, and success details by default, with optional alert details limited to 64 entries.
  • Documentation

    • Added documentation for the versioned structured health-report log format and decoding requirements.

Walkthrough

Health-report OTLP logs now include versioned structured attributes for report metadata, successes, alerts, counts, classifications, and timestamps. Target identifiers use stable serialized strings. Documentation defines the attribute contract.

Changes

Health report OTLP serialization

Layer / File(s) Summary
Stable health report target identifiers
crates/health/src/sink/events.rs
HealthReportTarget::as_str maps all target variants to lowercase identifiers. Scenario coverage verifies the mappings.
Structured OTLP health report conversion
crates/health/src/otlp/convert.rs
The converter emits structured scalar, array, and key-value-list attributes for health reports. It uses valid observed_at values and the export timestamp for absent or pre-epoch observations. Tests validate timestamps, metadata, counts, successes, alerts, and classifications.
Documented OTLP health report contract
docs/architecture/health_aggregation.md, docs/operations/monitoring-health.md, crates/health/example/config.example.toml
The documentation and configuration example define the v1 schema, structured health-report attributes, routing metadata, alert-detail rules, and timestamp semantics.

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

Sequence Diagram(s)

sequenceDiagram
  participant HealthReport
  participant OtlpConverter
  participant OtlpLogRecord
  HealthReport->>OtlpConverter: provide report metadata and evidence
  OtlpConverter->>OtlpConverter: serialize structured AnyValue attributes
  OtlpConverter->>OtlpLogRecord: emit attributes and selected timestamp
Loading

Suggested labels: rack health

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 45.16% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly and concisely identifies the main change: structured OTLP health-report attributes.
Description check ✅ Passed The description directly explains the structured OTLP health-report attributes, timestamp behavior, testing, and related changes.
✨ 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: 2

🤖 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/otlp/convert.rs`:
- Around line 880-965: Extend health report conversion coverage around
health_report_event_time or convert_event with table-driven cases for both a
supplied observed_at and an absent observed_at. Use a deterministic export
timestamp, assert the event timestamp uses observed_at when present and the
export time as fallback when absent, and verify observed_time_unix_nano remains
the supplied export timestamp in both cases.

In `@docs/architecture/health_aggregation.md`:
- Around line 287-295: Expand the OTLP health-report contract section to specify
requiredness, OTLP types, accepted values, and fallback behavior for every
attribute, including event.type="health_report", valid
source/target/classification values, and matching success_count/alert_count with
their nested arrays. Mark health_report.target and health_report.observed_at
optional, and document nested entry fields and schema_version="v1" gating. Add
timestamp semantics: time_unix_nano uses the valid observation time when
available, observed_time_unix_nano uses export time, and observed_at is RFC 3339
nanosecond UTC.
🪄 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: 28e2049c-c6c5-42cc-95d2-7793edce4345

📥 Commits

Reviewing files that changed from the base of the PR and between a64028c and 020d5fa.

📒 Files selected for processing (3)
  • crates/health/src/otlp/convert.rs
  • crates/health/src/sink/events.rs
  • docs/architecture/health_aggregation.md

Comment thread crates/health/src/otlp/convert.rs
Comment thread docs/architecture/health_aggregation.md
@nvrzeznik
nvrzeznik force-pushed the pull-request/4508 branch 2 times, most recently from a9343ce to 0344d33 Compare August 7, 2026 16:08
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@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 `@docs/architecture/health_aggregation.md`:
- Around line 289-291: Document the consumer behavior for missing or unsupported
health_report.schema_version values in the OTLP health-report contract: retain
the existing human-readable summary body, ignore the structured health_report
attributes, and specify whether any warning is emitted; do not reject the
record.
- Around line 295-312: Update the health report attribute documentation for
health_report.success_count and health_report.alert_count to specify OTLP
int_value signed 64-bit integers bounded to 0..=i64::MAX. Document that the
exporter retains the first 64 alerts in report order when describing
health_report.alerts and its dropped count.
- Around line 292-293: Document that include_alert_details defaults to false, so
health_report.alerts and health_report.alerts.dropped are absent unless enabled;
clarify that health_report.alerts.dropped appears only when enabled details
exceed 64 alerts. Update docs/architecture/health_aggregation.md lines 292-293
and repeat or link the same guidance in docs/operations/monitoring-health.md
lines 277-283.
🪄 Autofix

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: 0316a17d-8461-4c7a-ad19-c08d1b8d4549

📥 Commits

Reviewing files that changed from the base of the PR and between 1a34f8d and 0344d33.

📒 Files selected for processing (4)
  • crates/health/src/otlp/convert.rs
  • crates/health/src/sink/events.rs
  • docs/architecture/health_aggregation.md
  • docs/operations/monitoring-health.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • crates/health/src/otlp/convert.rs
  • crates/health/src/sink/events.rs

Comment thread docs/architecture/health_aggregation.md
Comment thread docs/architecture/health_aggregation.md Outdated
Comment thread docs/architecture/health_aggregation.md Outdated
@mkoci

mkoci commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

@nvrzeznik you should check the DCO requirements. Guidance lives in CONTRIBUTING.md

Health reports reached OTLP as a prose summary body and a single
event.type attribute, so consumers had to parse free text to recover the
source, probe results, and alert classifications behind a report.

Emit a versioned health_report.* attribute contract alongside the
unchanged summary body: scalar routing fields plus nested successes and
alerts that preserve probe IDs, targets, messages, and classifications.
The record now carries the report's own observation time when it has
one, leaving observed_time_unix_nano as the export time.

Signed-off-by: Andrew Rzeznik <arzeznik@nvidia.com>
@kensimon

kensimon commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

/ok to test 5c9176d

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

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

Haven't reviewed the whole thing yet but it's starting to stand out that vendoring our own copy of the otlp protos was the wrong choice... I filed #4712 to address this. (Feel free to ignore this feedback, since even if we made our own From impls it's still not the right approach, we need to just use the opentelemetry crate instead.)


fn string_value(s: String) -> Option<AnyValue> {
Some(AnyValue {
fn string_any_value(s: String) -> AnyValue {

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.

This and all these little one-off conversion functions should be removed and replaced with proper From impls on the AnyValue/etc types. We're code-generating them in this crate, so they're owned by this crate: we can add any impl we want to them.

For instance:

impl From<String> for AnyValue {
    fn from(value: String) -> Self {
        Self {
            value: Some(any_value::Value::StringValue(value)),
        }
    }
}

impl From<i64> for AnyValue {
    fn from(value: i64) -> Self {
        Self {
            value: Some(any_value::Value::IntValue(value)),
        }
    }
}

impl From<Vec<AnyValue>> for AnyValue {
    fn from(values: Vec<AnyValue>) -> Self {
        Self {
            value: Some(any_value::Value::ArrayValue(ArrayValue { values })),
        }
    }
}

impl From<Vec<KeyValue>> for AnyValue {
    fn from(values: Vec<KeyValue>) -> Self {
        Self {
            value: Some(any_value::Value::KvlistValue(KeyValueList { values })),
        }
    }
}

Then building a key/value can be done from a real new function:

impl KeyValue {
    pub fn new(key: impl Into<String>, value: impl Into<AnyValue>) -> Self {
        Self {
            key: key.into(),
            value: Some(value.into()),
        }
    }
}

Then you don't need special int_kv vs kv functions, building a KeyValue becomes KeyValue::new(some_string, some_int) or KeyValue::new(some_string, some_vec), etc.

But to be honest (and this is a bigger issue) I have no idea why we're vendoring in the opentelemetry protobufs right into our own crate here. There's already an opentelemetry crate, and it already has its own KeyValue type, and it already has all these conversion impls... we're doing things that way all over the rest of the codebase, only the health crate seems to be doing things this weird way.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants