Skip to content

telemetry: remove redundant category field from events - #1649

Merged
brminich merged 11 commits into
ai-dynamo:mainfrom
e-eygin:telemetry-remove-category-field
Jun 1, 2026
Merged

brminich merged 11 commits into
ai-dynamo:mainfrom
e-eygin:telemetry-remove-category-field

Conversation

@e-eygin

@e-eygin e-eygin commented May 17, 2026 •

Copy link
Copy Markdown
Contributor

What?

This PR removes the redundant telemetry category field from nixlTelemetryEvent.

The event now carries only:

  • eventType_
  • value_

It also removes category-related runtime surfaces:

  • Removes nixl_telemetry_category_t.
  • Removes nixlEnumStrings::telemetryCategoryStr.
  • Drops the category label from Prometheus and DOCA telemetry metrics.
  • Updates C++ and Python telemetry readers.
  • Updates telemetry unit tests.
  • Updates docs/telemetry.md and telemetry exporter READMEs.
  • Bumps TELEMETRY_VERSION from 2 to 3.

This also resolves the separate nixlTelemetry::updateData argument-order cleanup request: once category is removed, both nixlTelemetryEvent construction and updateData use (event_type, value).

Depends on #1640. Please review only commit a330177 for now. After #1640 merges, this branch will be rebased onto ai-dynamo/main so the PR diff contains only the category-removal change.

Why?

category_ is fully derivable from eventType_.

For example:

  • AGENT_TX_BYTES is always a transfer metric.
  • AGENT_MEMORY_REGISTERED is always a memory metric.
  • AGENT_XFER_TIME is always a timing metric.

Because of that, storing category in every telemetry event and exporting it as a metric label is redundant. The metric/event name already carries the meaning.

Removing it also deletes the category string conversion path and avoids emitting an extra category=... label on every Prometheus / DOCA metric sample.

TELEMETRY_VERSION is bumped because nixlTelemetryEvent is serialized into the shared-memory cyclic buffer by binary layout. Removing category_ changes field offsets, so readers must reject old buffer files instead of silently decoding them incorrectly. This follows the existing precedent from the timestamp-field removal, which bumped the version from 1 to 2.

How?

Core telemetry changes:

  • nixlTelemetryEvent now stores only eventType_ and value_.
  • nixlTelemetry::updateData now takes only (event_type, value).
  • Event producer call sites no longer pass category.
  • Backend telemetry plumbing now constructs events with (event_type, value).

Exporter changes:

  • Prometheus registers metric instances with only hostname and agent_name labels.
  • DOCA registers only the per-event agent_name label; hostname remains a constant source label.
  • Exporters dispatch based on the event type / registered metric maps instead of event.category_.

Reader/docs/test changes:

  • C++ and Python telemetry readers no longer print category.
  • Python reader layout now matches the C++ event layout (uint32_t event_type, padding, uint64_t value).
  • Tests were updated to assert the new layout, including TELEMETRY_VERSION == 3 and sizeof(nixlTelemetryEvent) == 16.
  • Documentation no longer lists categories as part of the telemetry event model.
  • docs/telemetry.md now documents the TELEMETRY_VERSION policy.

Validation:

  • ninja -C build install
  • build/test/gtest/gtest --gtest_filter='telemetryTest.*:prometheusTelemetryTest.*'
    • 15/15 passed
  • Prometheus smoke test:
    • agent metrics appeared with agent_name and hostname
    • no category= label was present

Summary by CodeRabbit

  • Refactor

    • Telemetry events simplified: category removed, event-type-focused schema and version bump; exporters and metric registration updated to operate without category labels.
  • Documentation

    • Telemetry docs and exporter READMEs updated to reflect new schema, event-type naming, sample output, and environment-variable/table formatting.
  • Examples

    • Example readers updated to expect the new format and stop emitting event category.
  • Tests

    • Unit and integration tests adjusted to validate the streamlined event structure.

Review Change Stack

e-eygin added 2 commits May 14, 2026 12:29
Since e539a11 ("UTILS/CONFIG: Add config file reading.")
src/utils/common/configuration.h includes <toml++/toml.hpp> directly,
so any consumer needs tomlplusplus on its include path.

doca_exporter.cpp includes common/configuration.h, so the DOCA
telemetry plugin now fails to compile with:

    fatal error: toml++/toml.hpp: No such file or directory

Adding nixl_common_dep mirrors what the Prometheus plugin already
does in src/plugins/telemetry/prometheus/meson.build, which has
carried this dependency since it was first introduced.

This is currently invisible to CI because contrib/Dockerfile installs
only doca-sdk-gpunetio / -verbs and not libdoca-sdk-telemetry-exporter-dev,
so the cpp.has_header() guard in this file skips the entire DOCA
plugin build. Anyone with the DOCA telemetry-exporter SDK installed
hits this immediately on a clean rebuild.

Verified: ninja -C build install + telemetryTest.* + prometheusTelemetryTest.*
all pass (16/16).

Signed-off-by: Efraim Eygin <eeygin@nvidia.com>
Drop nixlTelemetryEvent::category_ and derive exporter behavior from the
telemetry event type instead. The category value was redundant with the
metric/event name, and both Prometheus and DOCA were exporting it as an
extra label on every metric sample.

This removes the category enum/string conversion path, drops the category
label from Prometheus and DOCA metrics, and updates the telemetry readers,
tests, and documentation to the new two-field event shape. The updateData
argument-order cleanup is resolved as part of this change because both the
event constructor and updateData now use (event_type, value).

Bump TELEMETRY_VERSION to 3 because removing category_ changes the binary
layout of nixlTelemetryEvent in the shared-memory cyclic buffer. The Python
reader layout is updated at the same time to use the event type's uint32_t
width.

Verified:
- ninja -C build install
- build/test/gtest/gtest --gtest_filter='telemetryTest.*:prometheusTelemetryTest.*'
- Prometheus smoke confirmed agent metrics without category labels

Signed-off-by: Efraim Eygin <eeygin@nvidia.com>
@e-eygin
e-eygin requested a review from a team as a code owner May 17, 2026 14:20
@copy-pr-bot

copy-pr-bot Bot commented May 17, 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.

@github-actions

Copy link
Copy Markdown

👋 Hi e-eygin! Thank you for contributing to ai-dynamo/nixl.

Your PR reviewers will review your contribution then trigger the CI to test your changes.

🚀

@dpressle

Copy link
Copy Markdown
Contributor

👀 Investigating Clang Format Check…

@dpressle

Copy link
Copy Markdown
Contributor

🤖 CI Triage Agent — Clang Format Check · commit a3301772

I have all the evidence I need. Here is the complete diagnosis:


Summary: Clang Format Check failed on PR #1649 — two function definitions in prometheus_exporter.cpp have parameter lists manually wrapped across two lines in a style that clang-format-19 reformats onto a single line.

Root cause: The PR (telemetry-remove-category-field, commit a3301772) removed the category parameter from registerCounter and registerGauge. After removal, the two remaining parameters (name and help) fit comfortably on one line within the column limit, so clang-format-19 collapses the manually broken two-line signatures into one. The committed code still has them split across two lines, which disagrees with what clang-format produces:

--- src/plugins/telemetry/prometheus/prometheus_exporter.cpp  (before formatting)
+++ src/plugins/telemetry/prometheus/prometheus_exporter.cpp  (after formatting)
@@ -131,8 +131,7 @@
 void
-nixlTelemetryPrometheusExporter::registerCounter(const std::string &name,
-                                                 const std::string &help) {
+nixlTelemetryPrometheusExporter::registerCounter(const std::string &name, const std::string &help) {

-nixlTelemetryPrometheusExporter::registerGauge(const std::string &name,
-                                               const std::string &help) {
+nixlTelemetryPrometheusExporter::registerGauge(const std::string &name, const std::string &help) {

The old three-parameter signatures were wide enough to require wrapping; now that category is gone the shorter two-parameter signatures must be on one line per the project's .clang-format rules.

Implicated commit: a3301772961f66c18e5e75d5aeaeeebdb89acfd8 (branch telemetry-remove-category-field, PR #1649)

File: src/plugins/telemetry/prometheus/prometheus_exporter.cpp — lines ~153–154 and ~156–157 (the registerCounter and registerGauge function definitions)

Suggested fix: Run clang-format-19 locally on the file (or just apply the diff above) to collapse those two split signatures onto single lines:

// Change from:
nixlTelemetryPrometheusExporter::registerCounter(const std::string &name,
                                                 const std::string &help) {
// To:
nixlTelemetryPrometheusExporter::registerCounter(const std::string &name, const std::string &help) {

// Change from:
nixlTelemetryPrometheusExporter::registerGauge(const std::string &name,
                                               const std::string &help) {
// To:
nixlTelemetryPrometheusExporter::registerGauge(const std::string &name, const std::string &help) {

The quickest way to fix it is to run clang-format-19 -i -style=file src/plugins/telemetry/prometheus/prometheus_exporter.cpp and amend/push the commit.

Related: none

@coderabbitai

coderabbitai Bot commented May 17, 2026 •

Copy link
Copy Markdown
Contributor

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
📝 Walkthrough

Walkthrough

This PR removes the telemetry category field and related APIs from the event structure, exporters, and readers. The protocol version increments from 2 to 3. All exporters are refactored to classify events by type rather than a separate category dimension.

Changes

Remove telemetry category field and API

Layer / File(s) Summary
Event schema and protocol version
src/core/telemetry/telemetry_event.h, examples/python/telemetry_reader.py, docs/telemetry.md
nixlTelemetryEvent removes category_ field, constructor changes to (event_type, value) signature, and TELEMETRY_VERSION increments from 2 to 3. Python reader struct layout and version updated to match.
Core telemetry API refactoring
src/core/telemetry/telemetry.h, src/core/telemetry/telemetry.cpp, src/api/cpp/backend/backend_engine.h
updateData method drops the category parameter; all callers (updateTxBytes, updateRxBytes, updateErrorCount, updateMemoryRegistered, addXferTime, addPostTime) updated to use the new signature. Backend engine integration adjusted accordingly.
Prometheus exporter refactoring
src/plugins/telemetry/prometheus/prometheus_exporter.h, src/plugins/telemetry/prometheus/prometheus_exporter.cpp, src/plugins/telemetry/prometheus/README.md, test/gtest/telemetry_prometheus_test.cpp
registerCounter and registerGauge drop category parameter; exportEvent stops switching on category and instead unconditionally looks up metrics by event name; metric labels reduced to hostname and agent_name only; tests updated to assert category label absence.
DOCA exporter refactoring
src/plugins/telemetry/doca/doca_exporter.cpp, src/plugins/telemetry/doca/README.md, src/plugins/telemetry/doca/meson.build
Category label constants removed; new isCounterEvent and isGaugeEvent helpers classify events by type; shared context label set reduced to agent_name; exportEvent branches on event type instead of category; build dependency (nixl_common_dep) added.
Example readers update
examples/cpp/telemetry_reader.cpp, examples/python/telemetry_reader.py
C++ reader print_telemetry_event removes category output line; Python reader removes _CATEGORY_STRINGS mapping and get_telemetry_category_string function, updates print_telemetry_event to log only event type name and value.
Plugin README and CSV examples
src/plugins/telemetry/README.md
CSV exporter example header and rows updated to emit event_type,value and omit category.
Core telemetry tests
test/gtest/telemetry_test.cpp
TelemetryEventStructure constructs events with (event_type, value), asserts version and struct size; category field assertions removed; TelemetryCategoryStringConversion test removed.
Documentation updates
docs/telemetry.md, src/plugins/telemetry/README.md
Event schema description adds explicit "Event type" and "Value" fields; built-in metrics table removes category column; example output removes "Category: …" lines; TELEMETRY_VERSION behavior documented (exact-match reader requirement, unlink on mismatch).

🎯 3 (Moderate) | ⏱️ ~20 minutes

🐰 A category field hops away,
Event types now lead the fray,
Version three takes the stage,
Exporters turn a brighter page,
Simpler schemas win the day!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.78% 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
Title check ✅ Passed The PR title accurately describes the main change: removing the redundant category field from telemetry events.
Description check ✅ Passed The PR description fully addresses all required template sections with comprehensive detail about what, why, and how the category field removal is implemented.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@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

Caution

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

⚠️ Outside diff range comments (2)
src/plugins/telemetry/prometheus/prometheus_exporter.cpp (1)

134-147: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix clang-format signature wrapping to unblock CI.

The current wrapping in these function declarations/definitions is causing the clang-format check to fail.

Proposed formatting fix
-void
-nixlTelemetryPrometheusExporter::registerCounter(const std::string &name,
-                                                 const std::string &help) {
+void nixlTelemetryPrometheusExporter::registerCounter(const std::string &name,
+                                                      const std::string &help) {
@@
-void
-nixlTelemetryPrometheusExporter::registerGauge(const std::string &name,
-                                               const std::string &help) {
+void nixlTelemetryPrometheusExporter::registerGauge(const std::string &name,
+                                                    const std::string &help) {
As per coding guidelines, “Formatting: 4-space indentation, no tabs; max 100-char lines; continuation lines indented by 4.”
🤖 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 `@src/plugins/telemetry/prometheus/prometheus_exporter.cpp` around lines 134 -
147, The function signature wrapping for
nixlTelemetryPrometheusExporter::registerCounter (and similarly for
registerGauge) violates the project's clang-format rules; fix by reformatting
the function declarations/definitions so the return type and function
name/signature conform to the 4-space indentation and max-100-char line rules
(either put the full signature on one line if it fits or break parameter list
with continuation lines indented by 4 spaces), ensuring consistent wrapping for
both registerCounter and registerGauge so clang-format/CI no longer fails.
src/api/cpp/backend/backend_engine.h (1)

65-69: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Take telemetryEventsMutex_ before checking the queue size.

telemetryEvents_.size() is read before the mutex is acquired, while Line 69 and getTelemetryEvents() mutate the same std::vector under telemetryEventsMutex_. That is a data race and a TOCTOU bug: under contention this can both invoke UB and let producers overshoot MAX_TELEMETRY_QUEUE_SIZE.

🐛 Proposed fix
         void
         addTelemetryEvent(nixl_telemetry_event_type_t event_type, uint64_t value) {
-            if (!enableTelemetry_) return;
-            if (telemetryEvents_.size() >= MAX_TELEMETRY_QUEUE_SIZE) return;
-            std::lock_guard<std::mutex> lock(telemetryEventsMutex_);
+            if (!enableTelemetry_) {
+                return;
+            }
+            const std::lock_guard<std::mutex> lock(telemetryEventsMutex_);
+            if (telemetryEvents_.size() >= MAX_TELEMETRY_QUEUE_SIZE) {
+                return;
+            }
             telemetryEvents_.emplace_back(event_type, value);
         }
🤖 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 `@src/api/cpp/backend/backend_engine.h` around lines 65 - 69, In
addTelemetryEvent, avoid the TOCTOU/data race by acquiring telemetryEventsMutex_
before reading or mutating telemetryEvents_; specifically move the
std::lock_guard<std::mutex> lock(telemetryEventsMutex_) to before checking
telemetryEvents_.size() and MAX_TELEMETRY_QUEUE_SIZE, then re-check the size
under the lock and call telemetryEvents_.emplace_back(event_type, value); this
ensures getTelemetryEvents() and other mutators that use telemetryEventsMutex_
synchronize correctly with addTelemetryEvent.
🤖 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/telemetry.md`:
- Line 82: The doc claim that readers "unlink the file on mismatch" is
inconsistent with the Python example; update either docs or code: either change
docs/telemetry.md wording around TELEMETRY_VERSION to state which
readers/unlinking runtime perform the unlink, or modify
examples/python/telemetry_reader.py to perform an unlink when TELEMETRY_VERSION
mismatches instead of only raising RuntimeError; locate the version-check logic
and the error path in telemetry_reader.py (search for TELEMETRY_VERSION and the
RuntimeError raised on mismatch) and implement os.unlink(file) on the mismatch
path or adjust the documentation text to clarify which implementations remove
the file.

---

Outside diff comments:
In `@src/api/cpp/backend/backend_engine.h`:
- Around line 65-69: In addTelemetryEvent, avoid the TOCTOU/data race by
acquiring telemetryEventsMutex_ before reading or mutating telemetryEvents_;
specifically move the std::lock_guard<std::mutex> lock(telemetryEventsMutex_) to
before checking telemetryEvents_.size() and MAX_TELEMETRY_QUEUE_SIZE, then
re-check the size under the lock and call
telemetryEvents_.emplace_back(event_type, value); this ensures
getTelemetryEvents() and other mutators that use telemetryEventsMutex_
synchronize correctly with addTelemetryEvent.

In `@src/plugins/telemetry/prometheus/prometheus_exporter.cpp`:
- Around line 134-147: The function signature wrapping for
nixlTelemetryPrometheusExporter::registerCounter (and similarly for
registerGauge) violates the project's clang-format rules; fix by reformatting
the function declarations/definitions so the return type and function
name/signature conform to the 4-space indentation and max-100-char line rules
(either put the full signature on one line if it fits or break parameter list
with continuation lines indented by 4 spaces), ensuring consistent wrapping for
both registerCounter and registerGauge so clang-format/CI no longer fails.
🪄 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: ASSERTIVE

Plan: Pro

Run ID: 9d2f4925-7404-41ee-9b52-92126d1f7489

📥 Commits

Reviewing files that changed from the base of the PR and between 49a6eec and a330177.

📒 Files selected for processing (16)
  • docs/telemetry.md
  • examples/cpp/telemetry_reader.cpp
  • examples/python/telemetry_reader.py
  • src/api/cpp/backend/backend_engine.h
  • src/core/telemetry/telemetry.cpp
  • src/core/telemetry/telemetry.h
  • src/core/telemetry/telemetry_event.h
  • src/plugins/telemetry/README.md
  • src/plugins/telemetry/doca/README.md
  • src/plugins/telemetry/doca/doca_exporter.cpp
  • src/plugins/telemetry/doca/meson.build
  • src/plugins/telemetry/prometheus/README.md
  • src/plugins/telemetry/prometheus/prometheus_exporter.cpp
  • src/plugins/telemetry/prometheus/prometheus_exporter.h
  • test/gtest/telemetry_prometheus_test.cpp
  • test/gtest/telemetry_test.cpp
💤 Files with no reviewable changes (1)
  • examples/cpp/telemetry_reader.cpp

Comment thread docs/telemetry.md Outdated
e-eygin added 2 commits May 17, 2026 14:28
Run clang-format-19 on the shortened Prometheus exporter helper
signatures after removing the category parameter.

Verified:
- ninja -C build install
- build/test/gtest/gtest --gtest_filter='telemetryTest.*:prometheusTelemetryTest.*'

Signed-off-by: Efraim Eygin <eeygin@nvidia.com>
Clarify the TELEMETRY_VERSION mismatch behavior in the documentation: the C++
shared-ring-buffer reader unlinks mismatched files, while the Python example
raises RuntimeError.

Also move the backend telemetry queue size check under telemetryEventsMutex_ so
addTelemetryEvent synchronizes all reads and writes of telemetryEvents_ with
getTelemetryEvents().

Verified:
- ninja -C build install
- build/test/gtest/gtest --gtest_filter='telemetryTest.*:prometheusTelemetryTest.*'

Signed-off-by: Efraim Eygin <eeygin@nvidia.com>
@dpressle

Copy link
Copy Markdown
Contributor

👀 Investigating Clang Format Check…

@dpressle

Copy link
Copy Markdown
Contributor

🤖 CI Triage Agent — Clang Format Check · commit 531a5f83

I have everything needed for a complete diagnosis. Here is the full report:


Summary: clang-format check fails on PR #1649 — single-statement if body in src/api/cpp/backend/backend_engine.h must use braces per the project's style rules.

Root cause: The commit 531a5f83 introduced (or retained) a braceless single-line if guard in addTelemetryEvent():

// CURRENT (fails clang-format-19):
if (telemetryEvents_.size() >= MAX_TELEMETRY_QUEUE_SIZE) return;

// REQUIRED by .clang-format style:
if (telemetryEvents_.size() >= MAX_TELEMETRY_QUEUE_SIZE) {
    return;
}

The clang-format-diff-19 tool applied to the diff of this PR detected the violation and produced a non-empty patch, causing the job to exit with code 1. The two earlier if (!enableTelemetry_) return; guards on the lines immediately above use the same braceless style, but those lines were not part of this PR's diff so they were not flagged — only the newly added/modified line was checked. Note that the lock/queue-check lines appear to have been reordered in this PR (queue-size check is now before the mutex lock), which is what put the line into the diff and triggered the linter.

Implicated commit: 531a5f83ba39b38301d382608bff1105b0db0b03 (PR #1649, branch telemetry-remove-category-field)

File: src/api/cpp/backend/backend_engine.h — the addTelemetryEvent method, specifically the if (telemetryEvents_.size() >= MAX_TELEMETRY_QUEUE_SIZE) guard (around line 68 in the file).

Suggested fix: Expand the braceless return into a braced block as clang-format-19 requires:

void
addTelemetryEvent(nixl_telemetry_event_type_t event_type, uint64_t value) {
    if (!enableTelemetry_) return;
    std::lock_guard<std::mutex> lock(telemetryEventsMutex_);
    if (telemetryEvents_.size() >= MAX_TELEMETRY_QUEUE_SIZE) {
        return;
    }
    telemetryEvents_.emplace_back(event_type, value);
}

The fastest way to do this locally is to run:

clang-format-19 -i -style=file src/api/cpp/backend/backend_engine.h

and then commit the result. This will auto-apply exactly the diff the CI checker expected.

Related: #1531 (telemetry enum refactor by BatshevaBlack, last touch to this file), #1522 (Remove timestamp field from telemetry events) — no existing issue specifically for this clang-format violation.

@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 `@src/api/cpp/backend/backend_engine.h`:
- Line 65: The change to the public header method signature
addTelemetryEvent(nixl_telemetry_event_type_t event_type, uint64_t value) is an
API/ABI break for downstream consumers; restore backward compatibility by either
reverting the signature change or adding an overload/compatibility wrapper that
preserves the original symbol (e.g., keep the old addTelemetryEvent signature or
provide an inline forwarding overload in backend_engine.h) and ensure the
implementation in the corresponding .cpp forwards to the new behavior; also add
an explicit migration note to this PR (release notes/CHANGES) and notify
downstream maintainers of the breaking change so they can coordinate upgrades.
- Around line 66-69: Clang-format is failing due to single-line early-return if
statements; update the two ifs that use early returns to use explicit block
braces and proper newlines so formatting is consistent: replace "if
(!enableTelemetry_) return;" with a braced form like "if (!enableTelemetry_) {
return; }" and similarly replace "if (telemetryEvents_.size() >=
MAX_TELEMETRY_QUEUE_SIZE) return;" with "if (telemetryEvents_.size() >=
MAX_TELEMETRY_QUEUE_SIZE) { return; }" around the telemetry-related symbols
enableTelemetry_, telemetryEvents_, MAX_TELEMETRY_QUEUE_SIZE and keep the
existing std::lock_guard<std::mutex> lock(telemetryEventsMutex_) and
telemetryEvents_.emplace_back(event_type, value); lines unchanged.
🪄 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: ASSERTIVE

Plan: Pro

Run ID: 2ef9a66e-721f-4caf-9fff-9762a55b0046

📥 Commits

Reviewing files that changed from the base of the PR and between a330177 and 531a5f8.

📒 Files selected for processing (3)
  • docs/telemetry.md
  • src/api/cpp/backend/backend_engine.h
  • src/plugins/telemetry/prometheus/prometheus_exporter.cpp

Comment thread src/api/cpp/backend/backend_engine.h
Comment thread src/api/cpp/backend/backend_engine.h Outdated
e-eygin added 2 commits May 17, 2026 14:56
Expand the telemetryEvents_ capacity guard added in the review fix so the
touched line follows the project's clang-format rules.

Verified:
- ninja -C build install
- build/test/gtest/gtest --gtest_filter='telemetryTest.*:prometheusTelemetryTest.*'

Signed-off-by: Efraim Eygin <eeygin@nvidia.com>
Expand the enableTelemetry_ early return added to the PR diff so the touched
code follows the project's braced-control-statement style.

Verified:
- ninja -C build install
- build/test/gtest/gtest --gtest_filter='telemetryTest.*:prometheusTelemetryTest.*'

Signed-off-by: Efraim Eygin <eeygin@nvidia.com>
@e-eygin

e-eygin commented May 17, 2026

Copy link
Copy Markdown
Contributor Author

@ColinNV, @ovidiusm please review

Comment thread src/plugins/telemetry/doca/doca_exporter.cpp Outdated
Comment thread src/plugins/telemetry/doca/doca_exporter.cpp Outdated
Mark the event-type classifier helpers constexpr and make the DOCA counter/gauge
branches mutually exclusive in exportEvent.

Verified:
- ninja -C build install
- build/test/gtest/gtest --gtest_filter='telemetryTest.*:prometheusTelemetryTest.*'

Signed-off-by: Efraim Eygin <eeygin@nvidia.com>
Comment thread src/core/telemetry/telemetry_event.h
Add event-type prefix guidance in docs/telemetry.md so category-style
filtering remains discoverable after removing the stored category field.

Signed-off-by: Efraim Eygin <eeygin@nvidia.com>
@e-eygin

e-eygin commented May 20, 2026

Copy link
Copy Markdown
Contributor Author

@brminich please review

@ColinNV
ColinNV requested a review from ovidiusm May 21, 2026 13:40
@e-eygin

e-eygin commented May 25, 2026

Copy link
Copy Markdown
Contributor Author

/build

@e-eygin

e-eygin commented May 25, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 85988f2

@e-eygin

e-eygin commented May 26, 2026

Copy link
Copy Markdown
Contributor Author

/build

Comment thread src/api/cpp/backend/backend_engine.h
Comment thread src/core/telemetry/telemetry.cpp
@brminich

Copy link
Copy Markdown
Contributor

/ok to test ecd6c36

@brminich

Copy link
Copy Markdown
Contributor

/build

@brminich
brminich enabled auto-merge (squash) May 28, 2026 09:24
@guy-ealey-morag

Copy link
Copy Markdown
Contributor

/ok to test 5255ea7

@guy-ealey-morag

Copy link
Copy Markdown
Contributor

/build

3 similar comments
@guy-ealey-morag

Copy link
Copy Markdown
Contributor

/build

@guy-ealey-morag

Copy link
Copy Markdown
Contributor

/build

@guy-ealey-morag

Copy link
Copy Markdown
Contributor

/build

@brminich
brminich merged commit a08cda8 into ai-dynamo:main Jun 1, 2026
15 of 16 checks passed
aranadive pushed a commit to aranadive/nixl that referenced this pull request Jun 2, 2026
* telemetry/doca: add nixl_common_dep so tomlplusplus resolves

Since e539a11 ("UTILS/CONFIG: Add config file reading.")
src/utils/common/configuration.h includes <toml++/toml.hpp> directly,
so any consumer needs tomlplusplus on its include path.

doca_exporter.cpp includes common/configuration.h, so the DOCA
telemetry plugin now fails to compile with:

    fatal error: toml++/toml.hpp: No such file or directory

Adding nixl_common_dep mirrors what the Prometheus plugin already
does in src/plugins/telemetry/prometheus/meson.build, which has
carried this dependency since it was first introduced.

This is currently invisible to CI because contrib/Dockerfile installs
only doca-sdk-gpunetio / -verbs and not libdoca-sdk-telemetry-exporter-dev,
so the cpp.has_header() guard in this file skips the entire DOCA
plugin build. Anyone with the DOCA telemetry-exporter SDK installed
hits this immediately on a clean rebuild.

Verified: ninja -C build install + telemetryTest.* + prometheusTelemetryTest.*
all pass (16/16).

Signed-off-by: Efraim Eygin <eeygin@nvidia.com>

* telemetry: remove redundant category field from events

Drop nixlTelemetryEvent::category_ and derive exporter behavior from the
telemetry event type instead. The category value was redundant with the
metric/event name, and both Prometheus and DOCA were exporting it as an
extra label on every metric sample.

This removes the category enum/string conversion path, drops the category
label from Prometheus and DOCA metrics, and updates the telemetry readers,
tests, and documentation to the new two-field event shape. The updateData
argument-order cleanup is resolved as part of this change because both the
event constructor and updateData now use (event_type, value).

Bump TELEMETRY_VERSION to 3 because removing category_ changes the binary
layout of nixlTelemetryEvent in the shared-memory cyclic buffer. The Python
reader layout is updated at the same time to use the event type's uint32_t
width.

Verified:
- ninja -C build install
- build/test/gtest/gtest --gtest_filter='telemetryTest.*:prometheusTelemetryTest.*'
- Prometheus smoke confirmed agent metrics without category labels

Signed-off-by: Efraim Eygin <eeygin@nvidia.com>

* style: format prometheus exporter signatures

Run clang-format-19 on the shortened Prometheus exporter helper
signatures after removing the category parameter.

Verified:
- ninja -C build install
- build/test/gtest/gtest --gtest_filter='telemetryTest.*:prometheusTelemetryTest.*'

Signed-off-by: Efraim Eygin <eeygin@nvidia.com>

* telemetry: address review comments on category removal

Clarify the TELEMETRY_VERSION mismatch behavior in the documentation: the C++
shared-ring-buffer reader unlinks mismatched files, while the Python example
raises RuntimeError.

Also move the backend telemetry queue size check under telemetryEventsMutex_ so
addTelemetryEvent synchronizes all reads and writes of telemetryEvents_ with
getTelemetryEvents().

Verified:
- ninja -C build install
- build/test/gtest/gtest --gtest_filter='telemetryTest.*:prometheusTelemetryTest.*'

Signed-off-by: Efraim Eygin <eeygin@nvidia.com>

* style: brace backend telemetry queue guard

Expand the telemetryEvents_ capacity guard added in the review fix so the
touched line follows the project's clang-format rules.

Verified:
- ninja -C build install
- build/test/gtest/gtest --gtest_filter='telemetryTest.*:prometheusTelemetryTest.*'

Signed-off-by: Efraim Eygin <eeygin@nvidia.com>

* style: brace backend telemetry enable guard

Expand the enableTelemetry_ early return added to the PR diff so the touched
code follows the project's braced-control-statement style.

Verified:
- ninja -C build install
- build/test/gtest/gtest --gtest_filter='telemetryTest.*:prometheusTelemetryTest.*'

Signed-off-by: Efraim Eygin <eeygin@nvidia.com>

* telemetry/doca: address exporter review nits

Mark the event-type classifier helpers constexpr and make the DOCA counter/gauge
branches mutually exclusive in exportEvent.

Verified:
- ninja -C build install
- build/test/gtest/gtest --gtest_filter='telemetryTest.*:prometheusTelemetryTest.*'

Signed-off-by: Efraim Eygin <eeygin@nvidia.com>

* telemetry: document event type prefix filtering

Add event-type prefix guidance in docs/telemetry.md so category-style
filtering remains discoverable after removing the stored category field.

Signed-off-by: Efraim Eygin <eeygin@nvidia.com>

---------

Signed-off-by: Efraim Eygin <eeygin@nvidia.com>
iyastreb pushed a commit that referenced this pull request Jun 2, 2026
* NIXL: Move to C++20

Signed-off-by: Adit Ranadive <aranadive@nvidia.com>

* NIXL: Add C++20 support for plugins

Switch plugins to use C++20 and update READMEs.

Signed-off-by: Adit Ranadive <aranadive@nvidia.com>

* Fix copyright

Signed-off-by: Adit Ranadive <aranadive@nvidia.com>

* Fix review comments

Signed-off-by: Adit Ranadive <aranadive@nvidia.com>

* NIXL: Fix EP code for C++20 deprecation warnings

Three -Werror sites flagged by GCC under -std=c++20 in the
BUILD_NIXL_EP=true build:

* nixl_ep.cpp:737 used a comma operator to chain two assignments to
  volatile-qualified pointers. C++20 deprecates using the value of an
  assignment to a volatile lvalue (P1152R4). Split into two statements.

* nixl_ep.cpp:1080 and 1182 used [=] capture inside a member function,
  which implicitly captures *this. C++20 deprecates this form. Capture
  this explicitly via [=, this].

Signed-off-by: Adit Ranadive <aranadive@nvidia.com>

* ci: Switch git URL to HTTPS and reduce fetch size (#1677)

* CI: Change git URL from SSH to HTTPS

Switch the SCM URL to HTTPS to fix 'Permission denied (publickey)'
from 'git ls-remote'. SSH requires an SSH key, while
HTTPS allows anonymous reads of public repos like nixl.

Signed-off-by: Noam Tsemah <ntsemah@nvidia.com>

* CI: Drop PR refs from fetch refspec

Fetch only the commit via +$sha1:refs/remotes/origin/$sha1
instead of +refs/pull/* which fetch every PR.

Signed-off-by: Noam Tsemah <ntsemah@nvidia.com>

---------

Signed-off-by: Noam Tsemah <ntsemah@nvidia.com>

* EXAMPLES/DEVICE/EP: Removed method w/o definition. (#1684)

Signed-off-by: Raul Akhmetshin <rakhmetshin@nvidia.com>

* nixl: bulk descriptor removal and empty-section cleanup (#1597)

* nixl: erase empty sections in removeLocalData

removeLocalData removes matching descriptors from the remote section
but leaves the map entry in place once it is empty. In long-running
workloads that repeatedly register and deregister, sectionMap and
memToBackend grow without bound.

Erase the map entry when the section becomes empty, mirroring the
cleanup already done in remDescList.

Signed-off-by: Ben Walker <ben@nvidia.com>

* nixl: bulk removal for descriptor lists

remDescList and removeLocalData removed descriptors one at a time via
target.remDesc(index), giving O(N*M) work per deregister when the
backend held N entries and the caller was removing M of them. The
add side already has addDescs() for batched insertion; the remove
side did not.

Add nixlSecDescList::remDescs(std::vector<int> sorted_indices) which
compacts the descriptor vector in a single pass. Collect indices in
remDescList and removeLocalData and hand them to remDescs.

Signed-off-by: Ben Walker <ben@nvidia.com>

* test/gtest: reset registration list on Agent::init

TestErrorHandling reuses the same Agent instances across testXfer calls
within a single TEST_P. Each Agent::init() reassigns m_priv but the
nested MemDesc is never reconstructed, so MemDesc::init() kept appending
the same descriptor to m_dlist on every invocation. With BasicXfer
running both NIXL_WRITE and NIXL_READ in sequence, the second
registerMem on a fresh agent registered the same memory range twice,
and the matching deregisterMem then asked the section to remove the
same target index twice.

The prior remove-one-at-a-time path in nixlRemoteSection::removeLocalData
masked this: the first remDesc shifted the target so the second
getIndex() returned -1. The new bulk path collects all indices up front,
so unloadMD() is invoked twice on the same metadataP, double-freeing the
UCX public metadata and segfaulting in the destructor.

Clear m_dlist at the start of MemDesc::init() so a re-init() always
yields the single registration the test expects.

Signed-off-by: Ben Walker <ben@nvidia.com>

---------

Signed-off-by: Ben Walker <ben@nvidia.com>

* fix(ci): set build container NPROC/GRPC_NPROC explicitly (#1704)

build-container.sh defaults NPROC to $(nproc), which inside the
privileged podman runner reports the host node's full core count rather
than the pod's cpu limit. The resulting over-parallel make exhausted the
pod memory limit and OOM-killed the build unless NPROC was passed
explicitly as a pipeline parameter.

Set NPROC and GRPC_NPROC in the build-container job env (sized to the
pod's 24Gi memory) and bump the job resources to 24Gi/12 cores.

Signed-off-by: NirWolfer <nwolfer@nvidia.com>

* telemetry/doca: add nixl_common_dep so tomlplusplus resolves (#1640)

Since e539a11 ("UTILS/CONFIG: Add config file reading.")
src/utils/common/configuration.h includes <toml++/toml.hpp> directly,
so any consumer needs tomlplusplus on its include path.

doca_exporter.cpp includes common/configuration.h, so the DOCA
telemetry plugin now fails to compile with:

    fatal error: toml++/toml.hpp: No such file or directory

Adding nixl_common_dep mirrors what the Prometheus plugin already
does in src/plugins/telemetry/prometheus/meson.build, which has
carried this dependency since it was first introduced.

This is currently invisible to CI because contrib/Dockerfile installs
only doca-sdk-gpunetio / -verbs and not libdoca-sdk-telemetry-exporter-dev,
so the cpp.has_header() guard in this file skips the entire DOCA
plugin build. Anyone with the DOCA telemetry-exporter SDK installed
hits this immediately on a clean rebuild.

Verified: ninja -C build install + telemetryTest.* + prometheusTelemetryTest.*
all pass (16/16).

Signed-off-by: Efraim Eygin <eeygin@nvidia.com>

* telemetry: remove redundant category field from events (#1649)

* telemetry/doca: add nixl_common_dep so tomlplusplus resolves

Since e539a11 ("UTILS/CONFIG: Add config file reading.")
src/utils/common/configuration.h includes <toml++/toml.hpp> directly,
so any consumer needs tomlplusplus on its include path.

doca_exporter.cpp includes common/configuration.h, so the DOCA
telemetry plugin now fails to compile with:

    fatal error: toml++/toml.hpp: No such file or directory

Adding nixl_common_dep mirrors what the Prometheus plugin already
does in src/plugins/telemetry/prometheus/meson.build, which has
carried this dependency since it was first introduced.

This is currently invisible to CI because contrib/Dockerfile installs
only doca-sdk-gpunetio / -verbs and not libdoca-sdk-telemetry-exporter-dev,
so the cpp.has_header() guard in this file skips the entire DOCA
plugin build. Anyone with the DOCA telemetry-exporter SDK installed
hits this immediately on a clean rebuild.

Verified: ninja -C build install + telemetryTest.* + prometheusTelemetryTest.*
all pass (16/16).

Signed-off-by: Efraim Eygin <eeygin@nvidia.com>

* telemetry: remove redundant category field from events

Drop nixlTelemetryEvent::category_ and derive exporter behavior from the
telemetry event type instead. The category value was redundant with the
metric/event name, and both Prometheus and DOCA were exporting it as an
extra label on every metric sample.

This removes the category enum/string conversion path, drops the category
label from Prometheus and DOCA metrics, and updates the telemetry readers,
tests, and documentation to the new two-field event shape. The updateData
argument-order cleanup is resolved as part of this change because both the
event constructor and updateData now use (event_type, value).

Bump TELEMETRY_VERSION to 3 because removing category_ changes the binary
layout of nixlTelemetryEvent in the shared-memory cyclic buffer. The Python
reader layout is updated at the same time to use the event type's uint32_t
width.

Verified:
- ninja -C build install
- build/test/gtest/gtest --gtest_filter='telemetryTest.*:prometheusTelemetryTest.*'
- Prometheus smoke confirmed agent metrics without category labels

Signed-off-by: Efraim Eygin <eeygin@nvidia.com>

* style: format prometheus exporter signatures

Run clang-format-19 on the shortened Prometheus exporter helper
signatures after removing the category parameter.

Verified:
- ninja -C build install
- build/test/gtest/gtest --gtest_filter='telemetryTest.*:prometheusTelemetryTest.*'

Signed-off-by: Efraim Eygin <eeygin@nvidia.com>

* telemetry: address review comments on category removal

Clarify the TELEMETRY_VERSION mismatch behavior in the documentation: the C++
shared-ring-buffer reader unlinks mismatched files, while the Python example
raises RuntimeError.

Also move the backend telemetry queue size check under telemetryEventsMutex_ so
addTelemetryEvent synchronizes all reads and writes of telemetryEvents_ with
getTelemetryEvents().

Verified:
- ninja -C build install
- build/test/gtest/gtest --gtest_filter='telemetryTest.*:prometheusTelemetryTest.*'

Signed-off-by: Efraim Eygin <eeygin@nvidia.com>

* style: brace backend telemetry queue guard

Expand the telemetryEvents_ capacity guard added in the review fix so the
touched line follows the project's clang-format rules.

Verified:
- ninja -C build install
- build/test/gtest/gtest --gtest_filter='telemetryTest.*:prometheusTelemetryTest.*'

Signed-off-by: Efraim Eygin <eeygin@nvidia.com>

* style: brace backend telemetry enable guard

Expand the enableTelemetry_ early return added to the PR diff so the touched
code follows the project's braced-control-statement style.

Verified:
- ninja -C build install
- build/test/gtest/gtest --gtest_filter='telemetryTest.*:prometheusTelemetryTest.*'

Signed-off-by: Efraim Eygin <eeygin@nvidia.com>

* telemetry/doca: address exporter review nits

Mark the event-type classifier helpers constexpr and make the DOCA counter/gauge
branches mutually exclusive in exportEvent.

Verified:
- ninja -C build install
- build/test/gtest/gtest --gtest_filter='telemetryTest.*:prometheusTelemetryTest.*'

Signed-off-by: Efraim Eygin <eeygin@nvidia.com>

* telemetry: document event type prefix filtering

Add event-type prefix guidance in docs/telemetry.md so category-style
filtering remains discoverable after removing the stored category field.

Signed-off-by: Efraim Eygin <eeygin@nvidia.com>

---------

Signed-off-by: Efraim Eygin <eeygin@nvidia.com>

* NIXL: Update copyright year to 2025-2026 in docs

Address review feedback on PR #1571: bump the copyright header in
CONTRIBUTING.md and README.md to 2025-2026 for consistency with the
rest of the tree.

Signed-off-by: Adit Ranadive <aranadive@nvidia.com>

* NIXL: Set CUDA C++20 project-wide in meson

Build all CUDA targets with C++20 by adding the standard flag once
in the root meson.build instead of only in the gpunetio plugin.
This guarantees every CUDA target matches the core's C++ standard
and ABI. Drop the now-redundant gpu_cuda_args from the gpunetio
plugin.

Signed-off-by: Adit Ranadive <aranadive@nvidia.com>

* NIXL: Build CI dependencies with C++20

Build the bundled dependencies in .gitlab/build.sh with C++20 to
keep the toolchain ABI-consistent with the C++20 core:
- gRPC and etcd: bump CMAKE_CXX_STANDARD 17 -> 20
- abseil, aws-sdk, azure-sdk: add -DCMAKE_CXX_STANDARD=20
- gusli: build with CXX="g++ -std=c++20"

Bump CI_IMAGE_TAG in all three jenkins matrices, as required
by the CI guard when build.sh changes.

Signed-off-by: Adit Ranadive <aranadive@nvidia.com>

---------

Signed-off-by: Adit Ranadive <aranadive@nvidia.com>
Signed-off-by: Noam Tsemah <ntsemah@nvidia.com>
Signed-off-by: Raul Akhmetshin <rakhmetshin@nvidia.com>
Signed-off-by: Ben Walker <ben@nvidia.com>
Signed-off-by: NirWolfer <nwolfer@nvidia.com>
Signed-off-by: Efraim Eygin <eeygin@nvidia.com>
Co-authored-by: Noam Tsemah <ntsemah@nvidia.com>
Co-authored-by: Raul Akhmetshin <74596089+rakhmets@users.noreply.github.com>
Co-authored-by: Ben Walker <ben@nvidia.com>
Co-authored-by: NirWolfer <82328769+NirWolfer@users.noreply.github.com>
Co-authored-by: e-eygin <eeygin@nvidia.com>
svc-nixl referenced this pull request Sep 8, 2026
Signed-off-by: Raul Akhmetshin <rakhmetshin@nvidia.com>

This branch was previously deployed

1 inactive deployment
SWX_AWS — 5255ea78 Deployed Jun 1, 2026 by copy-pr-bot[bot] via Run AWS Tests #7469
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.

7 participants