Skip to content

health: Use opentelemetry crate rather than vendoring our own protos - #4723

Open
kensimon wants to merge 2 commits into
NVIDIA:mainfrom
kensimon:health-use-otel-crate
Open

health: Use opentelemetry crate rather than vendoring our own protos#4723
kensimon wants to merge 2 commits into
NVIDIA:mainfrom
kensimon:health-use-otel-crate

Conversation

@kensimon

@kensimon kensimon commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

There's already a supported upstream crate, opentelemetry_proto, which has the same types we're vendoring with .proto files, so we can just use that. It's a drop-in replacement but has convenience converters for types we need.

Related issues

#4712

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

Note: I had originally thought this was going to be a clearer win... but ultimately it's pretty much identical to what we're doing now, with just slightly less data in this repo (not that vendoring a proto file is a huge deal.) I was hoping to use the richer types from the opentelemetry crate, but they're difficult to mix with opentelemetry_proto (for instance opentelemetry::KeyValue has a lot of friendly stuff but is still a distinct type from the opentelemetry_proto version of it, and opentelemetry_proto doesn't really provide a ton of helpers.)

Ultimately this is only a minor win over what we have now and it's pretty low-priority to merge.

There's already a supported upstream crate, opentelemetry_proto, which
has the same types we're vendoring with .proto files, so we can just use
that. It's a drop-in replacement but has convenience converters for
types we need.
@kensimon
kensimon requested a review from a team as a code owner August 7, 2026 21:03
@coderabbitai

coderabbitai Bot commented Aug 7, 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: eb672470-7080-47a7-af1f-51e8e62b79d8

📥 Commits

Reviewing files that changed from the base of the PR and between 40aa70c and 6c07ff2.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • Cargo.toml
  • crates/health/Cargo.toml
  • crates/health/src/otlp/convert.rs
🚧 Files skipped from review as they are similar to previous changes (3)
  • Cargo.toml
  • crates/health/Cargo.toml
  • crates/health/src/otlp/convert.rs

Summary by CodeRabbit

  • Improvements
    • Updated OpenTelemetry integration to use standardized protocol definitions.
    • Improved conversion of attributes, log bodies, events, alerts, and metrics into OpenTelemetry-compatible values.
    • Added consistent resource metadata handling for exported logs and metrics.
  • Compatibility
    • Replaced locally maintained OpenTelemetry protocol definitions with shared, standardized implementations.
    • Existing health-related log and metric export support is preserved.

Walkthrough

The health crate now uses opentelemetry-proto generated modules instead of vendored OpenTelemetry protobuf definitions. OTLP conversion uses typed opentelemetry values for attributes and bodies.

Changes

OTLP migration

Layer / File(s) Summary
Shared protobuf wiring
Cargo.toml, crates/health/Cargo.toml, crates/health/build.rs, crates/health/src/otlp/mod.rs, crates/health/proto/opentelemetry/proto/...
The workspace and health crate add OpenTelemetry dependencies. The build script stops compiling vendored log and metric service definitions. The local protobuf module is replaced with re-exports from opentelemetry_proto::tonic. The vendored OpenTelemetry schemas are deleted.
Typed OTLP conversion
crates/health/src/otlp/convert.rs
Attributes use KeyValue::new. Log, health-report, and firmware bodies use into_any_value. Conversion helpers bridge Rust values through opentelemetry::Value. Log and metric resources initialize empty entity_refs.

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

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: replacing vendored OpenTelemetry protobufs with upstream crate dependencies.
Description check ✅ Passed The description explains the migration to opentelemetry_proto, the internal refactor, testing, and expected impact.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

🧹 Nitpick comments (1)
Cargo.toml (1)

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

Restrict opentelemetry-proto to the required features.

crates/health/src/otlp uses generated tonic clients for logs and metrics. Set default-features = false and enable ["gen-tonic", "logs", "metrics"]. This avoids the unused trace, zpages, with-serde, and internal-logs features.

🤖 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 `@Cargo.toml` at line 59, Update the opentelemetry-proto dependency declaration
to disable default features and explicitly enable only gen-tonic, logs, and
metrics, preserving the existing version.

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 `@Cargo.toml`:
- Line 59: Update the opentelemetry-proto dependency declaration to disable
default features and explicitly enable only gen-tonic, logs, and metrics,
preserving the existing version.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 4622101c-dd26-4bc2-92c3-3fc0d668eaba

📥 Commits

Reviewing files that changed from the base of the PR and between 355618d and 40aa70c.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (11)
  • Cargo.toml
  • crates/health/Cargo.toml
  • crates/health/build.rs
  • crates/health/proto/opentelemetry/proto/collector/logs/v1/logs_service.proto
  • crates/health/proto/opentelemetry/proto/collector/metrics/v1/metrics_service.proto
  • crates/health/proto/opentelemetry/proto/common/v1/common.proto
  • crates/health/proto/opentelemetry/proto/logs/v1/logs.proto
  • crates/health/proto/opentelemetry/proto/metrics/v1/metrics.proto
  • crates/health/proto/opentelemetry/proto/resource/v1/resource.proto
  • crates/health/src/otlp/convert.rs
  • crates/health/src/otlp/mod.rs
💤 Files with no reviewable changes (7)
  • crates/health/proto/opentelemetry/proto/logs/v1/logs.proto
  • crates/health/proto/opentelemetry/proto/collector/metrics/v1/metrics_service.proto
  • crates/health/proto/opentelemetry/proto/collector/logs/v1/logs_service.proto
  • crates/health/proto/opentelemetry/proto/resource/v1/resource.proto
  • crates/health/proto/opentelemetry/proto/metrics/v1/metrics.proto
  • crates/health/proto/opentelemetry/proto/common/v1/common.proto
  • crates/health/build.rs

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.

Health crate should use the upstream opentelemetry crate rather than vendoring protos

2 participants