Skip to content

Collapse the three probe-hold counters into one {reason} label (observability) #1443

Closed

Description

@alpergundogdu

Decision (2026-07 ADR simplification audit). Filed under the Protocol simplifications milestone — sibling to #1396, #1394, #1419. Verdict: DROP / simplify — collapse the three probe-hold counters into one {reason=…} label.

Collapse the three probe-hold counters into one {reason} label (appendix-observability)

Status: proposal for discussion, not a decision.

Summary

Three Mandatory counters answer one question — "couldn't hold, by reason": decdn_probe_hold_violations_total, decdn_probe_holds_disabled_total, decdn_probe_stake_lane_reserved_total. Collapse to decdn_probe_hold_unavailable_total{reason=…}.

Motivation

  1. All three answer the same question with a different reason (budget exhaustion / config-disabled / stake-lane reserved) — the textbook case for a reason label.
  2. The codebase already uses reason= labels for exactly this shape: RejectReason::GlobalFull.as_str() (dispatch.rs:362), AnnounceReject labels, VoucherRejectReason. The three-name split is the odd one out.
  3. Per-reason alerting is preserved — the "raise max_probe_holds" alert becomes rate(...{reason="exhausted"}) > 0 instead of alerting on a whole counter's presence.

What removal touches (blast radius)

crates/node/src/metrics.rs (3 Counter fields + 3 emit helpers → 1 CounterVec); handlers/probe.rs call sites; node/tests/probe_loopback.rs (asserts all 3 names); appendix-observability §Slash-Safety Metrics (3 rows → 1). Confirm: grep -rn 'probe_hold_violations\|probe_holds_disabled\|probe_stake_lane_reserved' crates/node.

What we keep

All three semantics and their distinct alert remedies — as label values on one metric.

Counter-argument

The split was deliberate (#739, #757) so the "raise max_probe_holds" alert never fires on the deliberate/config cases; collapsing pushes that discrimination from metric-name into alert-rule label filters (standard, but a real relocation, and it churns tested slash-safety metrics). [your call] whether metric-name simplicity is worth re-touching Mandatory metrics.

Activity

  1. altanoruc commented on Jul 24, 2026

    @altanoruc
    Contributor

    Automated implementation triage note for a later run: the decision header resolves collapse vs keep, but the Prometheus label vocabulary is still an API decision. Please pin the exact three reason values for budget exhaustion, config-disabled, and stake-lane-reserved, and state whether the three old metric names disappear immediately or have any compatibility window. With those names fixed, this should fit the small-agent bar.

  2. thiras commented on Jul 24, 2026

    @thiras
    Contributor

    Finding from the #1438/#1440 batch (#1456): the CounterVec premise doesn't hold in this codebase. Flagging before anyone picks this up, because it changes the verdict from "simplification" to "convention change".

    decdn-node has no CounterVec. The iroh_metrics backend has no per-field label dimension, so a {reason=…} breakdown is realized here as sibling plain Counter fields with the reason slug baked into the field name. That is a deliberate, written-down convention, not an oversight:

    • crates/gossip/src/metrics.rs:17-27 — the rationale block.
    • crates/node/src/metrics.rs:765-770 — the same rationale restated for channel_open_failures_{insufficient_deposit,contract_revert,rpc_error}, which is the closest existing analogue to this issue (enum + as_label() + a hand-written match dispatch helper).
    • crates/node/src/metrics.rs:296-304 — probe_rate_limit_rejected_{per_peer,per_ip,global}: a three-sibling split of exactly the shape proposed for collapsing here, with the roll-up PromQL for operators documented in the field docs.

    The only Family<L, _> (labelled series) in the crate is streams_active: Family<StreamLabels, Gauge> at metrics.rs:85, and it's a Gauge — there is no labelled-Counter precedent to copy.

    So collapsing decdn_probe_hold_{violations,disabled} + decdn_probe_stake_lane_reserved into one decdn_probe_hold_unavailable_total{reason=…} would mean introducing a new EncodeLabelSet type and the first labelled counter in the crate — while leaving the three other sibling-counter families (rate-limit layers ×2, channel-open failures) inconsistent with it. Motivation 2 ("the three-name split is the odd one out") is inverted: the split is the house style, and RejectReason::GlobalFull.as_str() at dispatch.rs:362 is a structured-log field, not a metric label — it sits next to self.metrics.dispatch_rejected_global(), a sibling counter.

    Combined with the issue's own counter-argument — the split was deliberate in #739/#757 so the "raise max_probe_holds" alert never fires on the config/deliberate cases, and these are Mandatory slash-safety metrics — I'd suggest close as won't-do, or re-scope to "migrate all sibling-counter families to labelled Family counters" as a separate, much larger decision that would want its own discussion.

    Happy to be overruled if the labelled-counter migration is wanted; just didn't want it to land piecemeal on the slash-safety metrics first.

  3. thiras commented on Jul 26, 2026

    @thiras
    Contributor

    Counter-evidence on motivation #2, found while executing the rest of this milestone in #1472. Motivation #2 does not hold, and it was the load-bearing argument.

    1. The codebase already uses reason= labels for exactly this shape: RejectReason::GlobalFull.as_str() (dispatch.rs:362), AnnounceReject labels, VoucherRejectReason. The three-name split is the odd one out.

    None of those three are metric labels.

    • RejectReason (crates/node/src/dispatch.rs:78-96) — its as_str() is consumed at :362 as a tracing field: tracing::debug!(reason = RejectReason::GlobalFull.as_str(), …). The metric on the adjacent line is a plain sibling counter, self.metrics.dispatch_rejected_global().
    • AnnounceReject (crates/node/src/metrics.rs:1446-1457) — gossip_rejected bumps an aggregate, then does a string compare against AnnounceReject::ClockSkew.label() to pick a second, separate counter.
    • VoucherRejectReason (crates/protocol/src/client.rs:772) — a postcard-serialized wire enum. No metric is attached to it at all.

    The closest real analogue is ChannelOpenFailureReason (#966), and it is a hand-written match onto three sibling counters; its as_label() is documented as "the {reason} slug in the decdn_channel_open_failures_{reason}_total sibling counter name".

    The underlying reason: the backend is iroh_metrics, not the prometheus crate. grep -rn CounterVec crates/ and grep -rn with_label_values crates/ both return zero hits. Sibling-counters-instead-of-labels is stated as the deliberate convention in three separate places, each citing the same cause:

    • crates/node/src/metrics.rs:104-114 — "since iroh_metrics carries no label dimension, the ADR-named reason=clock_skew breakdown is realized as this distinct counter (same pattern as dispatch_rejected_{global,per_source})"
    • crates/node/src/metrics.rs:1086-1092 — same rationale for serve_stream_rejected_*
    • crates/gossip/src/metrics.rs:10-33 — the fullest statement: labels are reachable via Family<L, M>, they need a closed compile-time EncodeLabelSet, and one sibling counter per variant is "the established convention for small closed splits"

    So the three probe-hold counters are not the odd one out — they are the convention.

    What the change would actually cost. It is reachable (metrics.rs:84 has Family<StreamLabels, Gauge>, the repo's one labelled metric), but it would be the first reason-labelled family here, i.e. a convention change, plus a breaking rename of three Tier-M / MUST-expose metrics wired into monitoring/prometheus-alerts.yml, monitoring/grafana-dashboard.json (an extra site the issue's blast radius missed), adr/appendix-observability.md (rows at :51-53, threshold :65, and a duplicate listing of probe_holds_disabled at :103), adr/appendix-blob-cache-eviction.md:72, adr/005-protocol.md:65, docs/runbook.md:133,189, and 8 name assertions in crates/node/tests/probe_loopback.rs.

    Leaving this open for a re-decision with accurate premises rather than closing it. Two genuine defects did surface nearby and are worth folding into whatever this becomes:

    1. decdn_probe_holds_disabled_total is documented twice in appendix-observability.md — once under § Slash-Safety Metrics (:52) and again under § Probe Metrics (:103).
    2. decdn_probe_stake_lane_reserved_total has no row in the informal→canonical mapping table at :261-262, though its two siblings do.

    The sibling #1471 (alert annotation + inverted 25% guidance) is fixed independently in #1472 and needed none of this.

  4. thiras commented on Jul 26, 2026

    @thiras
    Contributor

    Correcting one claim in my comment above, and reporting what came of the other.

    Wrong: I said decdn_probe_stake_lane_reserved_total "has no row in the informal→canonical mapping table at :261-262, though its two siblings do," and listed it as a defect. It is not one. That table maps informal names used in earlier ADRs to their canonical forms — its preamble at :19 says so explicitly ("Several ADRs reference informal metric names … from ADRs 001, 005, 011"). probe_hold_violations earns a row because ADR 005 :65 still says "Implementations SHOULD expose probe_hold_violations and probe_hold_slots_used metrics". The stake-lane counter was born canonical in #757 and has no informal predecessor anywhere in adr/, so having no row is correct. Nothing to fix, and I have not "fixed" it.

    Confirmed and fixed: the duplicate is real. decdn_probe_holds_disabled_total was documented twice — § Slash-Safety Metrics (:52) and § Probe Metrics (:103) — and the two copies had already drifted in wording, which is the failure mode duplication causes. #1473 removes the § Probe Metrics copy (§ Slash-Safety Metrics is canonical: its preamble states the probe-hold capacity metrics are grouped there deliberately) and leaves a pointer naming all five probe-hold metrics and where they live, so the next reader looking under § Probe Metrics is not left empty-handed.

    Neither of those touches the decision this issue is actually about. The substantive point in my first comment stands unchanged: motivation #2 is false — iroh_metrics has no label dimension, there is no CounterVec in crates/, and the three cited "reason= label" precedents are a tracing field, a string-compare onto sibling counters, and a wire enum respectively. This issue still needs a fresh verdict on whether a Family<ProbeHoldReasonLabels, Counter> is worth a first-of-its-kind convention change plus a breaking rename of three Tier-M metrics, argued from what the codebase actually does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions