Repository navigation
Description
When seller-side payment-channel finalization (settleChannel) fails, an operator cannot triage it from metrics, and cannot distinguish a transient JSON-RPC failure from a permanent on-chain revert without grepping raw tracing output. The three outcomes already emit distinct log messages, but carry no structured outcome field and increment no metrics counters at all.
This is an observability gap, not a correctness bug — the revert path is already handled gracefully (drop_pending_if_finalized drops or re-stamps the pending entry, see payment_settlement.rs:2064). The problem is purely that settlement health is invisible to metric-based alerting.
Where
try_settle — crates/node/src/payment_settlement.rs:2016. Three outcomes, distinct warn!/info! messages, zero metrics:
| Outcome | Line | Current signal |
|---|---|---|
Transient — settleChannel().send() errored (RPC timeout / network) |
2024 | warn! "send failed; will retry next sweep" |
Transient — get_receipt() errored |
2031 | warn! "receipt failed; will retry next sweep" |
Permanent — receipt.status() == false (on-chain revert, e.g. ChannelNotClosing / already finalized) |
2046 | warn! "reverted; checking whether it was already finalized" |
| Success | 2036 | info! "settled channel" |
Gaps
- No metric for the
settleChannelfinalization sweep — any outcome. The existing settlement counterssettlement_auto_triggered/settlement_auto_failures(metrics.rs:292) cover only thecloseChannelauto-trigger path — a different lifecycle stage. The finalization sweep (settleChannel) has no counter for success, transient failure, or revert. An operator alerting on metrics is blind to whether settlement is actually landing. - Transient vs permanent is metric-indistinguishable. Even once a counter exists, the two transient paths (send / receipt) and the permanent on-chain revert need separate counts (or a labeled
outcome) so operators can tell "RPC is flaky, will self-heal" from "settlement is permanently reverting and the pending obligation is stuck". - Logs carry no structured outcome field. The three sites differ only by message string, so triage relies on substring matching. Add an
outcome = "transient_send" | "transient_receipt" | "reverted" | "ok"field to make log-based filtering/alerting reliable. - (Related, separate path)
redemption_failuresis a single lumped counter.metrics.rs:276collapsesgetChannel/withdrawRPC errors and receipt failures into one count — the same transient/permanent blindness on the redemption side. [your call] whether to split it here or leave out of scope; the finalization sweep is the primary gap.
Suggested fix
- Add counters for the finalization sweep, split by outcome — e.g.
decdn_settlement_finalize_totalwith anoutcomelabel, or three counters (..._ok/..._transient/..._reverted) to match the existing flat_totalconvention. Wire them into the four arms oftry_settle. - Add the
outcomestructured field to the existingwarn!/info!sites intry_settle. - Optionally apply the same transient/permanent split to
redemption_failuresfor parity (the redemption path has the identical limitation).
Notes
- Prior observability follow-up Seller-settlement robustness follow-ups (metrics, redeemer tick, downtime backfill) #751 added
redemption_failures,redeem_hints_dropped, andwatcher_persist_failures, but did not cover thesettleChannelfinalization sweep — this is the remaining uncovered seller-settlement path.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
github-actions commentedon Jun 4, 2026
🎯 Triage report
Observability gap in
crates/node/src/payment_settlement.rs: thetry_settlefunction (settleChannelfinalization sweep) emits distinct log messages for four outcomes but increments no metrics counters, making settlement health invisible to alerting. The existingsettlement_auto_triggered/settlement_auto_failurescounters cover only thecloseChannelauto-trigger phase, leaving the entire finalization sweep unmonitored. Correctness is not affected — the fix is purely additive instrumentation.📊 Assessment
lowpriority appropriate for a non-blocking observability gaptry_settleeach emit a counter + structuredoutcomefield)🔗 Similar issues
redemption_failures,redeem_hints_dropped, andwatcher_persist_failures; explicitly notessettleChannelfinalization was NOT covered — this issue is the direct continuationwarn!log, fixed by adding metrics tometrics.rs+ observability appendix💡 Notes and suggestions
Implementation checklist:
decdn_settlement_finalize_totalcounter withoutcomelabel (ok/transient_send/transient_receipt/reverted) tocrates/node/src/metrics.rs— or use three flat counters (_ok_total,_transient_total,_reverted_total) if the codebase convention prefers flat names (check existingsettlement_auto_*convention atmetrics.rs:292)try_settleatpayment_settlement.rs:2016–2046outcome = "transient_send" | "transient_receipt" | "reverted" | "ok"structured field to the four existingwarn!/info!log sites intry_settleadr/appendix-observability.md(canonical metric registry — see how Observability: surface ChainStakerSet watcher drift via a metric (not just a warn! log) #783 was handled for thedecdn_staker_set_*entries)redemption_failures(metrics.rs:276) into transient/permanent for paritySuggested alert rule (for operator docs):
Key cross-references:
payment_settlement.rslines 2016–2064;metrics.rslines 276 and 292;adr/appendix-observability.md.Add this agentic workflows to your repo
To install this agentic workflow, run
feat(node): instrument settleChannel finalization sweep (#810) (#812)
refactor(node): remove dead pairwise-channel dispute/close/settle met…
refactor(node): drop PaymentPool close monitor; lean on the redeem sw…