Skip to content

refactor(api): pair measured-boot failures with iteration latency#3740

Merged
chet merged 1 commit into
NVIDIA:mainfrom
chet:gh-issue-3729
Jul 21, 2026
Merged

refactor(api): pair measured-boot failures with iteration latency#3740
chet merged 1 commit into
NVIDIA:mainfrom
chet:gh-issue-3729

Conversation

@chet

@chet chet commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Measured-boot collector iterations already recorded latency by outcome, but the warning for a failed pass came from the outer run loop.

MeasuredBootCollectorIteration now owns both signals. Every pass still records one duration under the existing outcome series; failures add the historical warning and log-only error context, while successful passes remain silent.

A table-driven test covers both outcomes without changing the histogram's name, description, labels, or millisecond observations.

Related issues

Type of Change

  • Add - New feature or capability
  • Change - Changes in existing functionality
  • Fix - Bug fixes
  • Remove - Removed features or deprecated functionality
  • Internal - Internal changes (refactoring, tests, docs, etc.)

Breaking Changes

  • This PR contains breaking changes

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
  • No testing required (docs, internal refactor, etc.)

A table-driven check_values test covers the successful and failed outcomes, including log presence, histogram count, and histogram sum.

Verified with:

  • the focused carbide-api-core measured-boot Event tests
  • cargo make format-nightly
  • cargo make clippy
  • cargo make carbide-lints
  • cargo make check-event-names
  • cargo xtask check-metric-docs

Additional Notes

The dashboard-facing histogram name, description, labels, and millisecond observations are unchanged; only failed samples gain a correlated diagnostic record.

Closes #3729

@chet
chet requested a review from a team as a code owner July 20, 2026 21:49
@coderabbitai

coderabbitai Bot commented Jul 20, 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: 15d534c9-f455-43e5-85ff-93a96577b6d9

📥 Commits

Reviewing files that changed from the base of the PR and between 4ad44c6 and 3b6874d.

📒 Files selected for processing (1)
  • crates/api-core/src/measured_boot/metrics_collector/mod.rs

Summary by CodeRabbit

  • Bug Fixes
    • Improved measured boot monitoring by logging failed iterations at warning level with relevant error details.
    • Successful iterations no longer generate unnecessary log entries.
    • Preserved metric reporting for both successful and failed iterations.

Walkthrough

Measured-boot iteration telemetry now logs failed iterations at WARN level with error context, keeps successful iterations silent, removes duplicate loop-level warnings, and tests logging and histogram behavior for both outcomes.

Changes

Measured-boot iteration logging

Layer / File(s) Summary
Iteration event and error context
crates/api-core/src/measured_boot/metrics_collector/mod.rs
MeasuredBootCollectorIteration dynamically logs failures at WARN level, remains silent for successes, and records the corresponding error context.
Collector integration and validation
crates/api-core/src/measured_boot/metrics_collector/mod.rs
The run loop discards iteration errors without emitting a second warning, while tests verify logs, event fields, and histogram deltas for both outcomes.

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

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the refactor: measured-boot iteration failures are now paired with latency reporting.
Description check ✅ Passed The description is clearly aligned with the measured-boot collector refactor and the updated test coverage.
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.

@chet

chet commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full_review, thanks!

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

@chet Understood — I’ll perform a complete re-review of the PR. 🐇

✅ Action performed

Full review finished.

@chet chet changed the title refactor(api): emit measured boot collector failures refactor(api): let measured-boot passes own their latency and warning Jul 20, 2026
@chet

chet commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full_review, thanks!

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

@chet Understood — I’ll perform a complete re-review of the PR.

🐇🔍

✅ Action performed

Full review finished.


Your plan includes PR reviews subject to rate limits. More reviews will be available in 17 minutes.

@chet

chet commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

Hey @coderabbitai can you do a full_review when you get a chance? CICD isn't letting me continue because the CodeRabbit check "failed". Thanks!

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

@chet I’ve triggered a complete re-review of #3740. This should refresh the CodeRabbit check once the review completes.

🐇🔍

✅ Action performed

Full review finished.

@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

🤖 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/api-core/src/measured_boot/metrics_collector/mod.rs`:
- Around line 120-121: Update the ignored result in the measured-boot iteration
flow around run_single_iteration to call .ok() on the awaited result instead of
assigning it to an underscore. Preserve the existing behavior and surrounding
failure logging.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 7a785a48-1282-4187-987e-e795b3a1fcc4

📥 Commits

Reviewing files that changed from the base of the PR and between dcdd5da and f9fa27e.

📒 Files selected for processing (1)
  • crates/api-core/src/measured_boot/metrics_collector/mod.rs

Comment on lines +120 to +121
// The iteration Event logs any failure before the result returns.
let _ = self.run_single_iteration().await;

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.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Acknowledge the intentionally ignored result with .ok().

let _ = suppresses the fallible result directly. Use .ok() to make the deliberate error discard explicit while keeping future async-result changes visible.

Proposed fix
-            let _ = self.run_single_iteration().await;
+            self.run_single_iteration().await.ok();

As per coding guidelines, “Do not discard fallible results with let _unused = foo();; use .ok() when the error is intentionally ignored so future async changes remain compiler-visible.”

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// The iteration Event logs any failure before the result returns.
let _ = self.run_single_iteration().await;
self.run_single_iteration().await.ok();
🤖 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/api-core/src/measured_boot/metrics_collector/mod.rs` around lines 120
- 121, Update the ignored result in the measured-boot iteration flow around
run_single_iteration to call .ok() on the awaited result instead of assigning it
to an underscore. Preserve the existing behavior and surrounding failure
logging.

Source: Coding guidelines

@chet chet changed the title refactor(api): let measured-boot passes own their latency and warning refactor(api): pair measured-boot failures with iteration latency Jul 21, 2026
Measured-boot collector iterations already recorded latency by outcome, but the warning for a failed pass came from the outer run loop.

`MeasuredBootCollectorIteration` now owns both signals. Every pass still records one duration under the existing outcome series; failures add the historical warning and log-only error context, while successful passes remain silent.

A table-driven test covers both outcomes without changing the histogram's name, description, labels, or millisecond observations.

This supports NVIDIA#3729

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

chet commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full_review, thanks!

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

@chet Understood — I’ve triggered a complete re-review of #3740.

🐇🔍

✅ Action performed

Full review finished.


Your plan includes PR reviews subject to rate limits. More reviews will be available in 21 minutes.

chet commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full_review, thanks!

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

@chet Understood — I’ll perform a complete re-review of #3740.

✅ Action performed

Full review finished.


Your plan includes PR reviews subject to rate limits. More reviews will be available in 2 minutes.

chet commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full_review, thanks!

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

@chet Understood — I’ve triggered a complete re-review of #3740. This will refresh the CodeRabbit check once the review completes.

🐇🔍

✅ Action performed

Full review finished.

@chet
chet merged commit 908ecc9 into NVIDIA:main Jul 21, 2026
62 checks passed
@chet
chet deleted the gh-issue-3729 branch July 21, 2026 15:54
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.

Unify measured-boot collector failures with iteration metrics

2 participants