feat(firmware): count artifacts unavailable before download#4085
Conversation
`DownloadFinished` runs only after a firmware download starts. A missing URL and a stale cached artifact that cannot be removed both return earlier, which meant neither blocker appeared in the download metrics.
So, the two existing error branches now emit sibling Events backed by `carbide_firmware_artifact_unavailable_total`, with a bounded `reason={missing_url,stale_cache_removal_failed}` label. Separate Event types keep each branch's existing log fields intact without adding empty context, while every `false` return and the recoverable checksum warning stay the same.
The table-driven Event contract checks both reasons and exact log fields, and callsite tests exercise an empty URL and a deterministic stale-cache removal failure.
Tests added!
This supports NVIDIA#4078
Signed-off-by: Chet Nichols III <chetn@nvidia.com>
|
@coderabbitai full_review, thanks! |
|
🐇🔍 ✅ Action performedFull review finished. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (4)
Summary by CodeRabbit
WalkthroughFirmware downloader artifact-unavailable paths now emit structured events for missing URLs and stale cached artifact removal failures. Tests validate event fields and reason-scoped metrics, and observability documentation records the new counter. ChangesFirmware artifact telemetry
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant FirmwareDownloaderActual
participant emit
participant Metrics
participant ErrorLogs
FirmwareDownloaderActual->>emit: Emit artifact-unavailable event
emit->>Metrics: Increment counter by reason
emit->>ErrorLogs: Record structured error fields
Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
🌿 Preview your docs: https://nvidia-preview-pull-request-4085.docs.buildwithfern.com/infra-controller |
DownloadFinishedruns only after a firmware download starts. A missing URL and a stale cached artifact that cannot be removed both return earlier, which meant neither blocker appeared in the download metrics.So, the two existing error branches now emit sibling Events backed by
carbide_firmware_artifact_unavailable_total, with a boundedreason={missing_url,stale_cache_removal_failed}label. Separate Event types keep each branch's existing log fields intact without adding empty context, while everyfalsereturn and the recoverable checksum warning stay the same.The table-driven Event contract checks both reasons and exact log fields, and callsite tests exercise an empty URL and a deterministic stale-cache removal failure.
Tests added!
Related issues
This supports #4078
Part of #3169
Type of Change
Breaking Changes
Testing
Unit tests added/updated
Integration tests added/updated
Manual testing performed
No testing required (docs, internal refactor, etc.)
cargo test -p carbide-firmware --libcargo make format-nightlycargo make clippycargo make carbide-lintscargo xtask check-event-namescargo xtask check-metric-docscargo xtask check-workspace-depscargo make check-licensescargo make check-bansAdditional Notes
Closes #4078