Skip to content

fix: de-double the dsx-exchange-consumer counter metric names#3465

Merged
chet merged 1 commit into
NVIDIA:mainfrom
chet:gh-issue-3431
Jul 14, 2026
Merged

fix: de-double the dsx-exchange-consumer counter metric names#3465
chet merged 1 commit into
NVIDIA:mainfrom
chet:gh-issue-3431

Conversation

@chet

@chet chet commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

fix: de-double the dsx-exchange-consumer counter metric names

The DSX exchange consumer's counters were exposed with a doubled suffix -- carbide_dsx_exchange_consumer_messages_received_total_total and its four siblings -- because the instruments were registered with a name already ending in _total and the Prometheus exporter appends another. #3427 preserved that byte-for-byte to keep the framework conversion a zero-observable-change reshape; this is the deliberate fix.

  • The four framework #[derive(Event)] counters drop the doubled name = "..._total_total" for the single-_total form and no longer need name_unchecked -- the framework strips one trailing _total before registering and the exporter re-appends exactly one, so a single-_total name exposes a single _total.
  • The hand-rolled alerts_detected counter registers without the trailing _total for the same reason, so all five dsx counters are now consistent.
  • The exposition tests assert the single-_total names and prove the doubled names are gone.

The consumer serves its own /metrics and isn't in core_metrics.md, so there's no catalogue change -- but this renames the exposed series, so any dashboard or alert selecting the old _total_total names must migrate to the single-_total forms.

Breaking metric rename: the dsx-exchange-consumer counters drop their doubled suffix -- carbide_dsx_exchange_consumer_{messages_received,messages_processed,messages_dropped,dedup_skipped,alerts_detected}_total_total become the single-_total forms. Migrate any dashboard or alert selecting the old _total_total series.

This supports #3431

@chet chet requested a review from a team as a code owner July 14, 2026 00:56
@chet

chet commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full_review, thanks!

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

@chet, you're welcome! I'll perform a full review of all the changes in this PR.

🐇✨

✅ Action performed

Full review finished.

@coderabbitai

coderabbitai Bot commented Jul 14, 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: 51056ed3-803a-47fd-b711-fd5c574e9386

📥 Commits

Reviewing files that changed from the base of the PR and between 1eb3a7f and 44e7d27.

📒 Files selected for processing (2)
  • crates/dsx-exchange-consumer/src/metrics.rs
  • crates/dsx-exchange-consumer/tests/metric_exposition.rs

Summary by CodeRabbit

  • Bug Fixes

    • Updated Prometheus-exposed message counter metric names to use a single _total suffix (MessageReceived, MessageProcessed, MessageDropped, MessageDeduplicated).
    • Fixed the alert-detection counter to be exported under the correct metric name (without the _total portion before Prometheus appends it).
    • Removed legacy *_total_total metric variants from exposed metrics.
  • Tests

    • Adjusted metric exposition tests to validate the single-_total counters, exact increments, and absence of legacy doubled *_total_total metrics.

Walkthrough

The change normalizes message and alert counter registrations for Prometheus exporter suffix handling. Exposition tests now verify single _total metric names and reject the previous _total_total forms.

Changes

Metric suffix normalization

Layer / File(s) Summary
Counter registration updates
crates/dsx-exchange-consumer/src/metrics.rs
Message counters now declare single-suffix names, and alerts_detected omits _total so the exporter appends it once.
Exposition validation
crates/dsx-exchange-consumer/tests/metric_exposition.rs
Tests assert the four single-suffix message metrics and confirm doubled suffix names are absent.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

  • NVIDIA/infra-controller issue 3427 — Concerns metric naming for the same message counters.
  • NVIDIA/infra-controller issue 3431 — Addresses metric suffix de-duplication in metrics.rs and exposition tests.

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: correcting doubled counter metric names in dsx-exchange-consumer.
Description check ✅ Passed The description is directly aligned with the changes and accurately explains the metric-name fix and test updates.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

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

Caution

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

⚠️ Outside diff range comments (1)
crates/dsx-exchange-consumer/tests/metric_exposition.rs (1)

50-77: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Cover alerts_detected in the exposition test.

The registration changed in crates/dsx-exchange-consumer/src/metrics.rs Lines [139-143], but this test emits only the four message events. Add an alert-counter assertion for ..._alerts_detected_total and reject ..._alerts_detected_total_total; otherwise that production change can regress without this test failing.

🤖 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/dsx-exchange-consumer/tests/metric_exposition.rs` around lines 50 -
77, The exposition test currently omits the alerts_detected counter. Extend the
metric names checked by the existing counter_delta loop to include
carbide_dsx_exchange_consumer_alerts_detected_total, and add the corresponding
doubled _total_total name to the rejection loop so both registration and
de-duplication remain covered.
🤖 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.

Outside diff comments:
In `@crates/dsx-exchange-consumer/tests/metric_exposition.rs`:
- Around line 50-77: The exposition test currently omits the alerts_detected
counter. Extend the metric names checked by the existing counter_delta loop to
include carbide_dsx_exchange_consumer_alerts_detected_total, and add the
corresponding doubled _total_total name to the rejection loop so both
registration and de-duplication remain covered.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: e92c4fef-8822-44c3-8ed3-6fddd50ab970

📥 Commits

Reviewing files that changed from the base of the PR and between 69cd51c and fee5534.

📒 Files selected for processing (2)
  • crates/dsx-exchange-consumer/src/metrics.rs
  • crates/dsx-exchange-consumer/tests/metric_exposition.rs

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
crates/dsx-exchange-consumer/tests/metric_exposition.rs (1)

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

Cover the hand-rolled alerts_detected counter.

This test verifies only the four event counters. Add an alert recording and assert its single-suffix exposed name, including the point_type label, plus the absence of its historical _total_total name; otherwise the registration change in crates/dsx-exchange-consumer/src/metrics.rs Lines 139-143 can regress unnoticed.

🤖 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/dsx-exchange-consumer/tests/metric_exposition.rs` around lines 50 -
77, Extend the metric exposition test around the existing counter assertions to
record one hand-rolled alerts_detected event, then assert its exposed
single-suffix name increments by 1 with the point_type label. Also assert the
rendered exposition does not contain the corresponding historical _total_total
name, using the alerts_detected metric symbols and existing metric helpers.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@crates/dsx-exchange-consumer/tests/metric_exposition.rs`:
- Around line 50-77: Extend the metric exposition test around the existing
counter assertions to record one hand-rolled alerts_detected event, then assert
its exposed single-suffix name increments by 1 with the point_type label. Also
assert the rendered exposition does not contain the corresponding historical
_total_total name, using the alerts_detected metric symbols and existing metric
helpers.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 43bc5425-25ae-4dcf-a14e-4afb7be91d20

📥 Commits

Reviewing files that changed from the base of the PR and between 69cd51c and fee5534.

📒 Files selected for processing (2)
  • crates/dsx-exchange-consumer/src/metrics.rs
  • crates/dsx-exchange-consumer/tests/metric_exposition.rs

@github-actions

Copy link
Copy Markdown

🔍 Container Scan Summary

Service Total Critical High Medium Low Other
boot-artifacts-aarch64 3 0 0 3 0 0
boot-artifacts-x86_64 3 0 0 3 0 0
forge-admin-cli-x86_64 255 13 30 79 7 126
machine-validation-runner 800 40 234 292 36 198
machine_validation 800 40 234 292 36 198
machine_validation-aarch64 800 40 234 292 36 198
nvmetal-carbide 800 40 234 292 36 198
TOTAL 3461 173 966 1253 151 918

Per-CVE detail lives in the per-service grype-* artifacts (JSON + SARIF). Severity counts only — no CVE IDs published here.

The DSX exchange consumer's counters were exposed with a doubled suffix -- `carbide_dsx_exchange_consumer_messages_received_total_total` and its four siblings -- because the instruments were registered with a name already ending in `_total` and the Prometheus exporter appends another. NVIDIA#3427 preserved that byte-for-byte to keep the framework conversion a zero-observable-change reshape; this is the deliberate fix.

- The four framework `#[derive(Event)]` counters drop the doubled `name = "..._total_total"` for the single-`_total` form and no longer need `name_unchecked` -- the framework strips one trailing `_total` before registering and the exporter re-appends exactly one, so a single-`_total` name exposes a single `_total`.
- The hand-rolled `alerts_detected` counter registers without the trailing `_total` for the same reason, so all five dsx counters are now consistent.
- The exposition tests assert the single-`_total` names and prove the doubled names are gone.

The consumer serves its own `/metrics` and isn't in `core_metrics.md`, so there's no catalogue change -- but this renames the exposed series, so any dashboard or alert selecting the old `_total_total` names must migrate to the single-`_total` forms.

Tests updated!

This supports NVIDIA#3431

Signed-off-by: Chet Nichols III <chetn@nvidia.com>
@chet

chet commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full_review, thanks!

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

@chet, you're welcome! I'll perform a full review of all the changes in this PR again.

🐇✨

✅ Action performed

Full review finished.


Your plan includes PR reviews subject to rate limits. More reviews will be available in 33 seconds.

@github-actions

Copy link
Copy Markdown

@chet chet merged commit 1b7a0df into NVIDIA:main Jul 14, 2026
60 checks passed
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.

2 participants