Skip to content

fix: report dropped OpenTelemetry spans - #686

Merged
rapids-bot[bot] merged 2 commits into
NVIDIA:release/0.7from
willkill07:fix/otel-spans-dropped-diagnostic
Aug 4, 2026
Merged

fix: report dropped OpenTelemetry spans#686
rapids-bot[bot] merged 2 commits into
NVIDIA:release/0.7from
willkill07:fix/otel-spans-dropped-diagnostic

Conversation

@willkill07

@willkill07 willkill07 commented Aug 4, 2026

Copy link
Copy Markdown
Member

Overview

Report OpenTelemetry batch-queue span loss through plugin runtime diagnostics instead of relying only on SDK warning logs that language bindings do not configure or expose consistently.

  • I confirm this contribution is my own work, or I have the right to submit it under this project's license.
  • I searched existing issues and open pull requests, and this does not duplicate existing work.

Details

  • Wrap each plugin-managed OpenTelemetry batch processor with counters for completed and exporter-accepted spans.
  • Emit otel.spans_dropped with the exact dropped count, the indexed endpoint configuration field, and the configured endpoint URL during graceful shutdown.
  • Treat the diagnostic as a recoverable runtime delivery failure so teardown retains the plugin report without disabling later configuration.
  • Aggregate every OpenTelemetry provider shutdown result and permit reconfiguration only when every failure is a dropped-span delivery failure.
  • Add a deterministic saturated-queue regression test and document the runtime diagnostic behavior.

Validation:

  • cargo fmt --all passed.
  • cargo clippy --workspace --all-targets -- -D warnings passed.
  • Focused dropped-span, provider-shutdown aggregation, and teardown-classification tests passed.
  • uv run pre-commit run --all-files passed.
  • just docs passed; the redirects check was skipped after the remote FDR service returned 403.
  • just test-rust: the core and non-FFI workspace passed. The FFI phase inherited /Users/wkillian/.nemo-relay/plugins.toml, failed its first empty-diagnostics assertion, and then reported 10 poisoned-lock cascades.
  • just test-python: 603 tests passed; 11 failures came from the same discovered user configuration and its active-plugin cascade.
  • just test-go passed.
  • just test-node: 339 tests passed; 10 failures came from the same discovered user configuration and its active-plugin cascade.

Where should the reviewer start?

Start with DiagnosticBatchSpanProcessor in crates/core/src/observability/otel.rs, then review dropped_spans_are_recorded_in_the_active_plugin_report and the recoverable teardown marker handling in crates/core/src/plugin.rs.

Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)

  • Closes RELAY-602

Summary by CodeRabbit

  • New Features

    • Added runtime diagnostics for OpenTelemetry spans dropped during batching, including the drop count and affected endpoint.
    • Delivery failures are now reported consistently during OpenTelemetry and ATIF plugin shutdowns.
    • Shutdown now preserves diagnostics and reports failures across multiple endpoints, supporting safer reconfiguration.
  • Documentation

    • Updated OpenTelemetry guidance with details about drop diagnostics and graceful shutdown.
    • Clarified that clearing the plugin enables final queued spans to be exported and records remaining delivery failures.

Signed-off-by: Will Killian <wkillian@nvidia.com>
@willkill07
willkill07 requested review from a team as code owners August 4, 2026 13:52
@github-actions github-actions Bot added size:M PR is medium Bug issue describes bug; PR fixes bug lang:rust PR changes/introduces Rust code labels Aug 4, 2026
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

OpenTelemetry exporters now accept endpoint diagnostic context. A diagnostic batch processor reports dropped spans and returns a delivery-failure marker during shutdown. Plugin teardown aggregates failures and recognizes OpenTelemetry delivery failures. Tests and documentation cover the behavior.

Changes

OpenTelemetry drop diagnostics

Layer / File(s) Summary
Diagnostic exporter pipeline
crates/core/src/observability/otel.rs
OpenTelemetrySubscriber::new_for_plugin passes endpoint context to DiagnosticBatchSpanProcessor. The processor counts spans, reports dropped spans once, and returns the OpenTelemetry delivery-failure marker during shutdown.
Plugin lifecycle integration
crates/core/src/observability/plugin_component.rs, crates/core/src/plugin.rs
Plugin construction supplies endpoint indexes. Shutdown preserves all errors. Teardown recognizes ATIF and OpenTelemetry delivery-failure markers.
Drop handling validation and guidance
crates/core/tests/unit/observability/otel_tests.rs, crates/core/tests/unit/observability/plugin_component_tests.rs, crates/core/tests/unit/plugin_tests.rs, docs/configure-plugins/observability/opentelemetry.mdx
Tests cover dropped-span counts, endpoint diagnostics, multiple shutdown failures, and teardown behavior. Documentation describes runtime diagnostics and plugin clearing during shutdown.

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

Sequence Diagram(s)

sequenceDiagram
  participant PluginEndpoint
  participant OpenTelemetrySubscriber
  participant DiagnosticBatchSpanProcessor
  participant RuntimeDiagnostics
  participant PluginTeardown
  PluginEndpoint->>OpenTelemetrySubscriber: create subscriber with endpoint index
  OpenTelemetrySubscriber->>DiagnosticBatchSpanProcessor: configure exporter and diagnostic context
  DiagnosticBatchSpanProcessor->>RuntimeDiagnostics: record otel.spans_dropped
  PluginTeardown->>OpenTelemetrySubscriber: flush and shut down providers
  DiagnosticBatchSpanProcessor-->>PluginTeardown: return delivery-failure marker
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title follows Conventional Commits format, uses an allowed lowercase type, states the main change, and is under 72 characters.
Description check ✅ Passed The description includes all required sections, explains the implementation and validation, identifies review starting points, and links the related issue.
✨ 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 4, 2026

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
crates/core/tests/unit/plugin_tests.rs (1)

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

Add a mirrored teardown test for the OpenTelemetry marker.

This test proves that an ATIF_RUNTIME_DELIVERY_FAILURE_MARKER error keeps callbacks_cleared true. The new OTEL_RUNTIME_DELIVERY_FAILURE_MARKER branch in clear_plugin_configuration_inner has no equivalent assertion here. Add a second fixture registration that returns OTEL_RUNTIME_DELIVERY_FAILURE_MARKER and assert outcome.callbacks_cleared is true and outcome.result is an error. That protects the branch against a future marker rename, which substring matching would otherwise fail silently.

Based on path instructions: "Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant."

🤖 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/core/tests/unit/plugin_tests.rs` around lines 1509 - 1550, Add a
mirrored teardown test for the OTEL marker near
test_teardown_runtime_diagnostics_remain_in_the_plugin_report, registering a
fixture whose callback returns an error containing
OTEL_RUNTIME_DELIVERY_FAILURE_MARKER. Invoke clear_plugin_configuration_inner
and assert callbacks_cleared is true and result is an error, preserving the
existing setup and cleanup conventions.

Source: 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.

Inline comments:
In `@crates/core/src/observability/otel.rs`:
- Around line 868-891: Update record_dropped_spans and the corresponding merge
behavior in record_active_plugin_runtime_diagnostic so repeated reports for the
same (code, component, field) preserve the absolute dropped-span total instead
of incrementing by one. Ensure count remains dropped, or otherwise use the
latest exact count, when the diagnostic is merged.
- Around line 790-792: Update the batch processor configuration used by
DiagnosticBatchSpanProcessor::new so it is created with
BatchConfigBuilder::default().build() rather than BatchConfig::default(),
ensuring the documented OTEL_BSP_* environment variables are applied while
preserving the existing exporter, endpoint, and diagnostic_field flow.

In `@crates/core/tests/unit/observability/otel_tests.rs`:
- Around line 3159-3184: Make the test cleanup panic-safe by registering a drop
guard immediately after acquiring the test setup around the affected
observability test, with the guard invoking
crate::plugin::clear_plugin_configuration(). Remove the trailing explicit
cleanup call after the diagnostic assertions, while preserving the existing
assertions and mutex guard behavior.
- Around line 3137-3157: Relax the diagnostic count assertion in the
dropped-span test to require only count >= 1, while retaining the existing field
and message assertions for contract coverage. Update the assertion associated
with the diagnostic produced by “dropped-1” and “dropped-2” without changing the
exporter, processor, or queue setup.

In `@docs/configure-plugins/observability/opentelemetry.mdx`:
- Around line 125-136: Update the plugin-managed exporter shutdown guidance to
state that clearing the plugin returns an OpenTelemetry runtime delivery-failure
error when spans were dropped, while callbacks are removed and later
configuration remains permitted. Replace the inconsistent “Relay” references in
this section with “NeMo Relay,” and run `just docs` to validate the
documentation change.

---

Outside diff comments:
In `@crates/core/tests/unit/plugin_tests.rs`:
- Around line 1509-1550: Add a mirrored teardown test for the OTEL marker near
test_teardown_runtime_diagnostics_remain_in_the_plugin_report, registering a
fixture whose callback returns an error containing
OTEL_RUNTIME_DELIVERY_FAILURE_MARKER. Invoke clear_plugin_configuration_inner
and assert callbacks_cleared is true and result is an error, preserving the
existing setup and cleanup conventions.
🪄 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: ASSERTIVE

Plan: Enterprise

Run ID: c7c6012f-f57c-4fe3-8c02-9f134f04e0f9

📥 Commits

Reviewing files that changed from the base of the PR and between 0ef068f and 8f38144.

📒 Files selected for processing (6)
  • crates/core/src/observability/otel.rs
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/plugin.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • crates/core/tests/unit/plugin_tests.rs
  • docs/configure-plugins/observability/opentelemetry.mdx
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: Check / Run
  • GitHub Check: Preview docs
🧰 Additional context used
📓 Path-based instructions (28)
**/*.rs

📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)

**/*.rs: Any Rust change must run just test-rust
Any Rust change must run cargo fmt --all
Any Rust change must run cargo clippy --workspace --all-targets -- -D warnings

**/*.rs: Run cargo fmt --all for all FFI work since it is Rust work
Run just test-rust to validate FFI changes
Run cargo clippy --workspace --all-targets -- -D warnings to enforce strict linting on FFI work

When Rust files changed as part of Go work, also run cargo fmt --all, just test-rust, and cargo clippy --workspace --all-targets -- -D warnings

**/*.rs: Run cargo fmt --all when Rust files are changed as part of Node work
Run cargo clippy --workspace --all-targets -- -D warnings when Rust files are changed as part of Node work
Run just test-rust when Rust files are changed as part of Node work

**/*.rs: If any Rust code changed, always run just test-rust.
If any Rust code changed, also run cargo fmt --all.
If any Rust code changed, also run cargo clippy --workspace --all-targets -- -D warnings.
For Rust changes headed for review, run cargo fmt --all and cargo clippy --workspace --all-targets -- -D warnings even if relying on pre-commit.

**/*.rs: Format Rust code with rustfmt defaults using cargo fmt.
Run cargo clippy -- -D warnings; all Rust warnings must be treated as errors.
Use Rust snake_case naming conventions.

Files:

  • crates/core/tests/unit/plugin_tests.rs
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/plugin.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • crates/core/src/observability/otel.rs
{crates/core,crates/adaptive}/**/*

📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)

Changes to crates/core or crates/adaptive must run the full language matrix

Files:

  • crates/core/tests/unit/plugin_tests.rs
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/plugin.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • crates/core/src/observability/otel.rs
crates/core/**/*.rs

📄 CodeRabbit inference engine (.agents/skills/test-go-binding/SKILL.md)

If the change touched crates/core or shared runtime semantics, also use validate-change for broader validation

Use Result<T> with FlowError in core runtime paths, keeping wrapper-layer errors explicit and binding-appropriate.

Files:

  • crates/core/tests/unit/plugin_tests.rs
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/plugin.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • crates/core/src/observability/otel.rs
**/*

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

**/*: Format changed files with the language-native formatter before the final lint/test pass.
If dynamic plugin behavior changed, use maintain-dynamic-plugins and include the native SDK, worker protocol, Python SDK, docs, packaging, and Codecov surfaces in the validation plan.
If code changes alter APIs, bindings, commands, paths, packaging behavior, observability/adaptive semantics, or documented best practices, update any dependent maintainer or consumer skills in the same branch.
During iteration, prefer uv run pre-commit run --files <changed files...>.
Before review or handoff, run uv run pre-commit run --all-files.

**/*: Use release tags in raw Rust-compatible SemVer without a leading v; tags such as v0.1.0 are prohibited.
Use branch prefixes feat/, fix/, docs/, test/, or refactor/ according to the change purpose.
Every commit in a pull request must include a DCO Signed-off-by: sign-off.
Before submitting a pull request, ensure pre-commit hooks, relevant tests, target-specific builds, documentation updates, and a rebase on the latest main are complete.
Use commit messages in the form type: short description, with a valid type and a first line under 72 characters.

Files:

  • crates/core/tests/unit/plugin_tests.rs
  • docs/configure-plugins/observability/opentelemetry.mdx
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/plugin.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • crates/core/src/observability/otel.rs
crates/{core,adaptive}/**/*

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If crates/core or crates/adaptive changed, run the full validation matrix across Rust, Python, Go, and Node.js.

Files:

  • crates/core/tests/unit/plugin_tests.rs
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/plugin.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • crates/core/src/observability/otel.rs
**/*.{rs,py,go,js,ts}

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If a language surface changed, always run that language's test target even when Rust core did not change.

**/*.{rs,py,go,js,ts}: When observability configuration or lifecycle is exposed, keep FFI and Python, Go, and Node.js binding-native config objects and subscriber/exporter methods aligned in logical knobs and semantics.
Require every OpenTelemetry endpoint to have a type and nonblank destination; resolve header_env values at activation and reject missing, blank, or duplicate headers.
Concatenate layered ATOF sink, ATIF storage, and OpenTelemetry endpoint lists with higher-precedence entries first.
Preserve correct handling of mark events, start/end events, orphan cases, and span or trajectory fields derived from intended event data.
Run affected Rust tests and just test-rust when event fields change; run just test-python, just test-go, and just test-node when binding-native configuration or lifecycle changes.

Files:

  • crates/core/tests/unit/plugin_tests.rs
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/plugin.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • crates/core/src/observability/otel.rs
**/*.{rs,py,js,ts,tsx,go,java,kt,swift}

📄 CodeRabbit inference engine (.agents/skills/add-middleware/SKILL.md)

Add tests covering registration and duplicate names, deregistration and missing names, priority ordering, callback failure policy, scope-local inheritance and cleanup, event payload semantics, immutable mark and scope fields, and parity across affected bindings.

Files:

  • crates/core/tests/unit/plugin_tests.rs
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/plugin.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • crates/core/src/observability/otel.rs
**/*.{rs,py,js,jsx,ts,tsx,go,c,h,cc,cpp,md,toml,yml,yaml,sh}

📄 CodeRabbit inference engine (AGENTS.md)

Keep SPDX headers on source, documentation, scripts, and configuration files; the project is Apache-2.0.

Files:

  • crates/core/tests/unit/plugin_tests.rs
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/plugin.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • crates/core/src/observability/otel.rs
**/*.{rs,py}

📄 CodeRabbit inference engine (AGENTS.md)

Use snake_case naming in Rust and Python.

Files:

  • crates/core/tests/unit/plugin_tests.rs
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/plugin.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • crates/core/src/observability/otel.rs
crates/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

crates/**/*.rs: Use Json = serde_json::Value in Rust-facing runtime APIs where existing code expects JSON payloads.
Treat Rust as the source of truth for runtime behavior; binding APIs should mirror Rust semantics unless a language-specific wrapper intentionally improves ergonomics.

Files:

  • crates/core/tests/unit/plugin_tests.rs
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/plugin.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • crates/core/src/observability/otel.rs
**/*.{rs,py,js,mjs,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Preserve the existing Tokio-based asynchronous model and callback/future lifetimes; do not unexpectedly block or hide async work in bindings.

Files:

  • crates/core/tests/unit/plugin_tests.rs
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/plugin.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • crates/core/src/observability/otel.rs
**/*.{rs,py,go,js,jsx,ts,tsx,c,h}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.{rs,py,go,js,jsx,ts,tsx,c,h}: Run tests for every language affected by a change; changes to the core Rust crate require tests across all bindings.
Use SONAR_IGNORE_START / SONAR_IGNORE_END only for documented false positives, keep ignored blocks minimal, explain them with a comment, and obtain reviewer sign-off.
Preserve the layered architecture in which Rust provides the core runtime and C FFI, PyO3, and NAPI provide bindings that mirror the full API surface.

Files:

  • crates/core/tests/unit/plugin_tests.rs
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/plugin.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • crates/core/src/observability/otel.rs
**/{test,tests}/**/*

📄 CodeRabbit inference engine (CONTRIBUTING.md)

When adding functionality, include tests in the appropriate test files for each affected language binding.

Files:

  • crates/core/tests/unit/plugin_tests.rs
  • crates/core/tests/unit/observability/otel_tests.rs
**/*.{rs,py,go,js,jsx,ts,tsx,c,h,html,md,mdx,toml}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Include the appropriate SPDX copyright and Apache-2.0 license header in every source file.

Files:

  • crates/core/tests/unit/plugin_tests.rs
  • docs/configure-plugins/observability/opentelemetry.mdx
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/plugin.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • crates/core/src/observability/otel.rs
crates/{core,adaptive}/**/*.rs

⚙️ CodeRabbit configuration file

crates/{core,adaptive}/**/*.rs: Review the Rust runtime for async correctness, scope isolation, middleware ordering, and event lifecycle regressions.
Pay close attention to task-local/thread-local scope propagation, callback lifetimes, stream finalization, and root_uuid isolation.
Public API changes should preserve existing behavior unless tests and docs show the intended migration path.

Files:

  • crates/core/tests/unit/plugin_tests.rs
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/plugin.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • crates/core/src/observability/otel.rs
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}

⚙️ CodeRabbit configuration file

{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}: Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant.
Prefer assertions on lifecycle events, scope stacks, middleware ordering, and binding parity over shallow smoke tests.

Files:

  • crates/core/tests/unit/plugin_tests.rs
  • crates/core/tests/unit/observability/otel_tests.rs
**/*.mdx

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/SKILL.md)

MDX top-of-file SPDX comments must use {/* ... */} delimiters instead of HTML comment delimiters (Must-Fix)

**/*.mdx: In MDX files, top-of-file comments must use JSX comment delimiters ({/* and */}); do not use HTML comments for MDX SPDX headers.
New or regenerated MDX files must use {/* ... */} for top-of-file SPDX comments.

Files:

  • docs/configure-plugins/observability/opentelemetry.mdx
{docs,examples}/**/*

📄 CodeRabbit inference engine (.agents/skills/rename-surfaces/SKILL.md)

Update docs and examples.

Files:

  • docs/configure-plugins/observability/opentelemetry.mdx
docs/**/*

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If documentation examples or commands under docs/ change, run the targeted docs checks appropriate to the change.

Files:

  • docs/configure-plugins/observability/opentelemetry.mdx
**/*.{md,mdx}

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If links in documentation change, run just docs-linkcheck.

Use documented public APIs and stable wrapper commands in examples and user-facing documentation; do not rely on internal helpers.

**/*.{md,mdx}: Prefer the documented public API over internal shortcuts in documentation and examples.
Keep package names, repository references, and build commands current.
Contribution workflow documentation must require an issue before external contribution pull requests and note that NVIDIA contributors may use a GitHub or Linear issue.
Update entry-point documentation when examples or reading paths change.
Keep release-process and release-notes guidance in maintainer documentation such as RELEASING.md, rather than user-facing documentation pages or CHANGELOG.md.
Use stable user-facing wrappers at the scripts/ root in documentation and examples; reference namespaced helper paths only for internal maintenance documentation.
When detailed dynamic plugin guides exist, keep Rust native plugin examples, Python worker plugin examples, and grpc-v1 protocol details on separate pages.
Dynamic plugin manifests in documentation and examples should use compat.relay = ">=0.5,<1.0" unless deliberately narrower.
Render images, diagrams, tables, and other visual content at representative page widths, ensuring legibility and complete access without clipping; use responsive scaling, reflow, or overflow as appropriate and scope visual styling narrowly.
Dynamic plugin entry pages should link to native, worker, Rust example, Python example, and protocol pages when those pages exist.
Images, diagrams, tables, and custom visual content must remain legible and fully accessible at representative desktop and narrow page widths.
Release-policy documentation must point to GitHub Releases as the only release-history source of truth.
Run just docs when the documentation site changes; retain ./scripts/build-docs.sh html as the compatibility wrapper.

Files:

  • docs/configure-plugins/observability/opentelemetry.mdx
**/*.{md,mdx,py,go,js,ts}

📄 CodeRabbit inference engine (.agents/skills/maintain-observability/SKILL.md)

Examples and documentation must use each exporter's documented flush/deregister order before shutdown.

Files:

  • docs/configure-plugins/observability/opentelemetry.mdx
docs/{about-nemo-relay/concepts/subscribers.mdx,configure-plugins/observability/**/*.mdx}

📄 CodeRabbit inference engine (.agents/skills/maintain-observability/SKILL.md)

Update observability documentation and examples alongside implementation changes, including configuration version 3 with one opentelemetry section containing typed endpoints and no standalone public OpenInference surface.

Files:

  • docs/configure-plugins/observability/opentelemetry.mdx
docs/**/*.{md,mdx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Update relevant reference documentation when public behavior or APIs change.

Files:

  • docs/configure-plugins/observability/opentelemetry.mdx
**/*.{md,mdx,rst}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-technical-docs.md)

**/*.{md,mdx,rst}: Use title case consistently for technical documentation headings and table headers; avoid quotation marks, ampersands, and exclamation marks in headings, while preserving official product, event, research, and whitepaper title case.
Format code elements, commands, parameters, package names, expressions, directories, file names, and paths in monospace; represent path placeholders with angle brackets inside monospace.
Format UI buttons, menus, fields, and labels in bold, and separate consecutive UI navigation labels with >.
Use quotation marks for error messages and strings when appropriate, italics for newly introduced terms and publication titles, and plain text for keyboard shortcuts.
Represent GitHub repositories with owner/repository link text, such as [NVIDIA/NeMo](link), rather than generic repository wording.
Introduce every code block with a complete sentence; do not let a code block complete or interrupt the grammar of surrounding prose; use syntax highlighting when supported.
Keep inline method, function, and class references consistent with nearby documentation; omit empty parentheses in prose when no call is shown.
Use descriptive link text matching the destination title when possible; avoid raw URLs, generic anchors, long-sentence links, and unnecessary links that distract from procedures.
Ensure lists have a complete lead-in sentence, more than one item, no more than two levels, parallel construction, one idea or action per item, and appropriate punctuation; use bullets for unordered items and numbers for ordered tasks.
Format definition lists with a bold term followed by a complete, parallel, punctuated definition.
Use tables for reference information, decision support, compatibility matrices, and comparable choices; flag one-row tables, missing captions or lead-ins, sentence-case headers where title case is expected, unexplained empty cells, and code or links that would be clearer as prose.
Write procedure steps as imperative ...

Files:

  • docs/configure-plugins/observability/opentelemetry.mdx
{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}

⚙️ CodeRabbit configuration file

{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}: Review documentation for technical accuracy against the current API, command correctness, and consistency across language bindings.
Flag stale examples, missing SPDX headers where required, and instructions that no longer match CI or pre-commit behavior.

Files:

  • docs/configure-plugins/observability/opentelemetry.mdx
{crates/**/src/**/*.rs,python/**/*.py}

📄 CodeRabbit inference engine (.agents/skills/maintain-dynamic-plugins/SKILL.md)

Do not add tests under src; Rust tests belong in crate tests/ trees, and Python SDK tests belong under python/tests.

Files:

  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/plugin.rs
  • crates/core/src/observability/otel.rs
**/crates/core/src/observability/{atif,otel,openinference}.rs

📄 CodeRabbit inference engine (.agents/skills/maintain-observability/SKILL.md)

Keep ATIF, OpenTelemetry, and OpenInference observability projections synchronized with the core event model and emitted fields.

Files:

  • crates/core/src/observability/otel.rs
**/crates/core/src/observability/otel.rs

📄 CodeRabbit inference engine (.agents/skills/maintain-observability/SKILL.md)

**/crates/core/src/observability/otel.rs: The gen_ai OpenTelemetry projection must omit nemo_relay.* and content-capture attributes while preserving descendants through omitted scopes.
Derive compliant trace and span IDs consistently across typed OpenTelemetry endpoints while preserving lifecycle parentage.

Files:

  • crates/core/src/observability/otel.rs
🧠 Learnings (3)
📚 Learning: 2026-08-03T19:55:03.931Z
Learnt from: afourniernv
Repo: NVIDIA/NeMo-Relay PR: 558
File: crates/pii-redaction/src/rampart/mod.rs:265-274
Timestamp: 2026-08-03T19:55:03.931Z
Learning: In NeMo Relay first-party plugin registration helpers, treat the documented duplicate-registration `PluginError::RegistrationFailed` result from `register_plugin` as success when registration is intended to be idempotent. Do not locally reclassify this as `PluginError::Conflict`; changing the classification requires a core-wide review of the public API and FFI behavior.

Applied to files:

  • crates/core/tests/unit/plugin_tests.rs
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/plugin.rs
  • crates/core/tests/unit/observability/otel_tests.rs
  • crates/core/src/observability/otel.rs
📚 Learning: 2026-07-14T02:53:59.997Z
Learnt from: willkill07
Repo: NVIDIA/NeMo-Relay PR: 415
File: docs/configure-plugins/observability/opentelemetry.mdx:98-113
Timestamp: 2026-07-14T02:53:59.997Z
Learning: In NeMo-Relay’s OpenTelemetry/OpenInference observability projection docs under docs/configure-plugins/observability/, document the projected-attribute contract as follows: (1) emit scalar top-level `data`/`metadata` fields as typed dotted OTLP attributes (for example, `nemo_relay.start.metadata.tenant`); (2) keep nested objects/arrays as JSON strings at their top-level OTLP attribute (rather than expanding them into nested OTLP attributes); and (3) do not reference the legacy `*_json` payload attributes (e.g., `data_json`, `metadata_json`, `input_json`) because they were intentionally removed as a breaking change.

Applied to files:

  • docs/configure-plugins/observability/opentelemetry.mdx
📚 Learning: 2026-07-28T20:07:29.880Z
Learnt from: willkill07
Repo: NVIDIA/NeMo-Relay PR: 571
File: crates/core/src/api/runtime/state.rs:996-1020
Timestamp: 2026-07-28T20:07:29.880Z
Learning: In NeMo Relay (RELAY-509), sanitizer callback failures must be treated as intentional fail-open behavior. When an event/tool (request/response) or LLM (request/response) sanitizer callback fails, the sanitizer chain should retain and publish the last valid event/payload snapshot (rather than dropping/invalidating the data) and log the failure including callback context (e.g., which sanitizer/callback failed and relevant identifiers). Apply this consistently across all sanitizer chains mentioned in the RELAY-509 documentation/migration guide.

Applied to files:

  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/plugin.rs
  • crates/core/src/observability/otel.rs
🔇 Additional comments (8)
crates/core/src/observability/otel.rs (3)

413-423: LGTM!


801-819: 📐 Maintainability & Code Quality

The SpanExporter trait implementation is correct for the pinned opentelemetry_sdk version 0.32.1. The trait signature in that version uses fn export(&self, ...) -> impl Future<Output = OTelSdkResult> + Send, which the code implements correctly with async fn export(&self, ...). The set_resource method correctly uses &mut self as required by the trait. All other methods match the expected signatures.


908-919: 🎯 Functional Correctness | ⚡ Quick win

Confirm inner BatchSpanProcessor.shutdown_with_timeout semantics before relying on drop accounting.

record_dropped_spans computes completed_spans - accepted_spans. The accepted_spans counter increments in CountingSpanExporter::export before the export task completes. If the inner SDK's shutdown returns Ok after in-flight batches are abandoned or if spans reach on_end after the processor stops accepting spans, the drop count will be inaccurate. Verify that the pinned OpenTelemetry SDK version (0.32.1) ensures BatchSpanProcessor::shutdown_with_timeout joins all batch-worker tasks and awaits all in-flight exports before returning Ok.

Also, the condition at line 912 is redundant: record_dropped_spans already returns early when diagnostic_field.is_none(). Return Option<u64> from record_dropped_spans to eliminate the duplicate check.

crates/core/src/observability/plugin_component.rs (2)

63-66: LGTM!


1031-1040: 🩺 Stability & Availability

Verify that the error message with the OpenTelemetry marker survives through shutdown_provider() to observability_registration_error.

The marker "OpenTelemetry runtime delivery failures" is generated in otel.rs (line 914) when the processor drops spans during shutdown. This marker is embedded in an OTelSdkError::InternalFailure message and must survive the error chain to reach the marker check in plugin.rs (line 2146). If any intermediate error wrapper calls Display or converts the error message without preserving the marker text, the callbacks_cleared check will fail and permanently disable plugin mutations.

The error flows through: shutdown_provider()observability_registration_error() (which calls .to_string()) → PluginError::RegistrationFailed. Confirm that the shutdown_provider() implementation preserves the OTel error message when wrapping it as an OpenTelemetryError, and that all Display trait implementations in the chain retain the marker substring.

crates/core/src/plugin.rs (2)

129-134: LGTM!


2144-2147: 📐 Maintainability & Code Quality | ⚡ Quick win

Run the full language matrix for this crates/core change.

This change alters plugin teardown classification, which every binding observes through clear. The PR notes state that the Go and Node suites were not rerun and that some FFI and Python tests failed because of a local plugins.toml. Run just test-rust, just test-python, just test-go, and just test-node in a clean environment before merge, and confirm the earlier failures were environmental.

Based on coding guidelines: "If crates/core or crates/adaptive changed, run the full validation matrix across Rust, Python, Go, and Node.js."

Source: Coding guidelines

crates/core/tests/unit/observability/otel_tests.rs (1)

28-35: LGTM!

Also applies to: 55-100

Comment thread crates/core/src/observability/otel.rs
Comment thread crates/core/src/observability/otel.rs
Comment thread crates/core/tests/unit/observability/otel_tests.rs
Comment thread crates/core/tests/unit/observability/otel_tests.rs
Comment thread docs/configure-plugins/observability/opentelemetry.mdx Outdated
Comment thread crates/core/src/plugin.rs Outdated
@willkill07 willkill07 added this to the 0.7 milestone Aug 4, 2026
@willkill07 willkill07 self-assigned this Aug 4, 2026
Signed-off-by: Will Killian <wkillian@nvidia.com>
@willkill07

Copy link
Copy Markdown
Member Author

Addressed the outside-diff teardown-test request in follow-up commit 302f54b. test_opentelemetry_delivery_failure_allows_later_plugin_configuration mirrors the ATIF marker coverage by asserting that an OpenTelemetry delivery failure keeps callbacks_cleared true while returning an error. The commit also adds mixed-failure coverage that keeps callbacks_cleared false when a non-delivery shutdown error is present.

@github-actions github-actions Bot added size:L PR is large and removed size:M PR is medium labels Aug 4, 2026
Comment thread crates/core/src/plugin.rs
@willkill07

Copy link
Copy Markdown
Member Author

/merge

@rapids-bot
rapids-bot Bot merged commit 42f68fa into NVIDIA:release/0.7 Aug 4, 2026
80 of 82 checks passed
@willkill07
willkill07 deleted the fix/otel-spans-dropped-diagnostic branch August 4, 2026 23:49
@coderabbitai coderabbitai Bot mentioned this pull request Aug 4, 2026
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug issue describes bug; PR fixes bug lang:rust PR changes/introduces Rust code size:L PR is large

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants