Skip to content

incentive: no metric or structured log event distinguishing payment-channel open failures caused by insufficient buyer deposit from those caused by RPC/contract errors #966

Description

@alpergundogdu

The buyer-side openChannel path (#753) can fail due to insufficient deposited USDC, on-chain revert, or transient RPC errors, but all failure modes appear as a single error log line. Splitting these into distinct counter labels (e.g. decdn_channel_open_failures_total{reason="insufficient_deposit|contract_revert|rpc_error"}) would let operators distinguish misconfiguration from infrastructure problems.


Filed via GitDailyReporterBot

Activity

  1. added
    kind:feature
    design:economics
    prio:medium
    on Jun 22, 2026
  2. added
    rust
    on Jun 22, 2026
  3. github-actions commented on Jun 22, 2026

    @github-actions

    🎯 Triage report

    The buyer-side openChannel path fails silently with an undifferentiated error log line regardless of whether the root cause is an insufficient USDC deposit (misconfiguration), an on-chain contract revert, or a transient RPC error. The request is to split these into distinct labeled Prometheus counters (decdn_channel_open_failures_total{reason="..."}) so operators can immediately tell whether an alert reflects an operator misconfiguration vs. an infrastructure blip. This is a well-scoped, high-signal observability gap in the incentive crate.

    📊 Assessment

    Dimension Value Reasoning
    Type Feature Adding structured metrics/observability where none exists today
    Labels rust added; enhancement, economics, technical, medium retained The existing labels are already accurate; rust added since this is a pure Rust crate implementation task
    Coding agent Suitable Clear success criteria, well-defined scope (incentive crate openChannel error paths), and an established codebase pattern to follow

    🔗 Similar issues

    💡 Notes and suggestions

    Where to look:

    • crates/incentive/src/buyer_channel.rs — buyer-side channel state machine; the openChannel trigger logic consults get_by_provider before deciding reuse vs. open.
    • crates/incentive/src/client_bridge.rs — wires buyer channel state to the stream layer; RetryLater vs ChannelError paths are likely candidates for tagging.
    • crates/incentive/src/channel.rs — already has the decdn_voucher_nonce_gaps_total precedent: the leaf crate exposes a saturating counter accessor and the node crate's metrics layer calls it to publish via iroh-metrics. The same pattern should be used here (no iroh-metrics dep in decdn-incentive).

    Suggested implementation steps:

    1. Define an error-reason enum (or extend the existing error type) that distinguishes at least:
      • InsufficientDeposit — USDC balance below channelDeposit at open time.
      • ContractRevert — on-chain call reverted (decode the revert reason if possible).
      • RpcError — transport/RPC layer error (timeouts, provider unavailable, etc.).
    2. Add a saturating counter accessor on the buyer channel manager (follow the evictions_total / decdn_client_reputation_evictions_total pattern in client_reputation.rs) so the metric value is exposed without pulling iroh-metrics into the leaf crate.
    3. Wire it in the node crate metrics layer: read the counter and publish decdn_channel_open_failures_total{reason="..."}.
    4. Add a unit test asserting that a synthetic InsufficientDeposit error increments the right bucket without touching the others.

    CI reminder: new Rust code must satisfy the workspace-wide clippy::unwrap_used, clippy::expect_used, and clippy::indexing_slicing denies. Run cargo clippy and cargo nextest run -p decdn-incentive before opening the PR.

    Generated by Agentic Triage for issue #966 · ◷

    Add this agentic workflows to your repo

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/issue-triage.md@94ec5db57374c5b04a4b8eef8b4413f9af44d63f
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

design:economicskind:featureprio:mediumrust

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions