Repository navigation
feat(minter): report the age of the oldest in-flight deposit - #237
Conversation
59be724 to
790aedb
Compare
Add an oldest_in_flight_deposit_age_seconds gauge covering every stage from queued to pending mint, deriving each deposit's queued_at from the QueuedDeposit event timestamp so that it survives an event replay, and a failed_credit_attempts counter labelled by reason. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…nt attempts An oldest_pending_mint_age_seconds gauge computed from the created_at_time the ledger deduplicates each mint by, so an alert can fire hours before the deduplication window quarantines the deposit, and a failed_mint_attempts counter by reason, mirroring failed_credit_attempts. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
790aedb to
cda0221
Compare
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
Static review found no blocking issues in timestamp replay, lifecycle cleanup, or failure counters; tests were not run.
Review effort: Balanced
Findings: None
What changed in this PR
Adds observability for stalled deposits in the minter’s sweep-to-mint pipeline.
Changes:
- Tracks deposit and pending-mint ages using replayable timestamps.
- Counts credit and mint failures by reason, resetting counters on upgrade.
- Adds lifecycle, replay, counter, and metric-output assertions.
| File | Description |
|---|---|
| minter/src/storage/mod.rs | Defines failure counters and reason labels. |
| minter/src/state/tests.rs | Verifies queued timestamps survive replay. |
| minter/src/state/mod.rs | Passes queued timestamps into deposit state. |
| minter/src/state/deposits/tests.rs | Tests age tracking across lifecycle transitions. |
| minter/src/state/deposits/mod.rs | Tracks timestamps and exposes oldest-deposit lookups. |
| minter/src/state/audit.rs | Applies event timestamps when queuing deposits. |
| minter/src/metrics.rs | Exports age gauges and failure counters. |
| minter/src/deposit/sweep/mint/tests.rs | Checks mint failure classifications and counts. |
| minter/src/deposit/sweep/mint/mod.rs | Records mint failures by reason. |
| minter/src/deposit/sweep/finalize/tests.rs | Checks credit failure classifications and counts. |
| minter/src/deposit/sweep/finalize/mod.rs | Records credit failures by reason. |
| integration_tests/tests/tests.rs | Checks initial metric values and labels. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
✅ No security or compliance issues detected. Reviewed everything up to f479ce9. Security OverviewDetected Code Changes
|
# Conflicts: # minter/src/storage/mod.rs
There was a problem hiding this comment.
🟢 Approval recommended
No blocking issues were identified; remaining feedback concerns minor metric help-text clarifications.
2 open findings
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
…RPC errors Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…errors Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The quarantine guard now only fires when the outcome of the ledger call is unknown, so it can record its own reason without double counting the deliberate quarantines of rejected and expired mints. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
The observability changes have no identified functional blockers; the remaining description update is nonblocking.
2 open findings
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
Timestamp tracking follows the deposit lifecycle and event replay, while failure counters align with retry and quarantine paths without unresolved blocking issues.
0 open findings
2 resolved since last review
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Adds the metrics suggested in the reviews of #222 and #220:
oldest_in_flight_deposit_age_seconds: the age of the oldest deposit between being queued and being minted, dropped or quarantined, whatever sweep stage it is stuck in. One alert on this gauge covers a deposit stuck at any stage, while the existing per-stage count gauges tell which stage. The age is derived from theQueuedDepositevent timestamp, so it survives an event replay.oldest_pending_mint_age_seconds: the age of the oldest pending mint from thecreated_at_timethe ledger deduplicates it by, so an alert can fire hours before the deduplication window quarantines the deposit.failed_credit_attempts{reason}: counts failed attempts to credit a finalized sweep by reason (not_found,rpc_error,invalid_response,unreadable,mismatch), showing why credits fail without reading the logs. Transient fetch failures (rpc_error) are kept apart from responses the providers agreed on but that do not belong to the queried transaction (invalid_response), so alerts can ignore the former. Failures that should never happen for a finalized sweep are logged as errors.failed_mint_attempts{reason}: counts failed attempts to mint a pending deposit by reason (expired,rejected,ledger_error,created_in_future,call_error,unknown_outcome).unknown_outcomecounts deposits quarantined because the outcome of the ledger call is unknown.The counters are observability-only and reset on upgrade.
🤖 Generated with Claude Code