Skip to content

cache: split decdn_cache_prewarm_failures_total by cause #1514

Closed

Description

@thiras

Deferred from the #1510 review as feature scope rather than a fix.

PrewarmReport.failed (and the counter behind it) merges three situations with different operator remedies:

  1. The origin does not hold the pinned hash — wrong cache.pinned_hashes, or a wrong bucket/prefix. Surfaces as CacheError::NotFound.
  2. The origin is unreachable, or its circuit breaker is open — an availability problem, nothing wrong with the config.
  3. A local store error on the presence check — a node-side fault.

The original metric doc asserted that failed == pin-set size "almost always means cache.pinned_hashes names content the configured origin does not have". An unreachable origin produces the identical number, and in ops terms it is the more common cause. #1510 corrected the doc to say the counter does not diagnose on its own and to point at the per-hash warn lines — but the per-hash logs are the wrong granularity for an alert.

CacheError::NotFound already distinguishes case 1 at zero cost, so the split is roughly:

  • PrewarmOutcome::Failed gains a discriminator (e.g. Failed { at_origin: bool }, or split into NotAtOrigin / Errored), set by matching the error at crates/cache/src/engine.rs in prewarm_one.
  • PrewarmReport.failed splits into two counts; the partition identity in its doc extends to five bins.
  • One new sibling counter (decdn_cache_prewarm_not_at_origin_total), per the metrics: decide whether the remaining reason-splits follow probe-hold onto {reason} labels #1475 convention.
  • Appendix row + the assertions in crates/cache/tests/prewarm.rs, where prewarm_counts_a_pin_the_origin_does_not_have_as_a_failure already constructs exactly case 1 and would become the test for the new bin.

Worth doing because it turns an "look at the logs" counter into one an operator can alert on: sustained case 1 is a config error that will never self-heal, while case 2 is transient and should not page.

Activity

  1. added
    kind:feature
    on Jul 29, 2026
  2. github-actions commented on Jul 29, 2026

    @github-actions

    🎯 Triage report

    Deferred from #1510, this asks to split decdn_cache_prewarm_failures_total (and the backing PrewarmReport.failed field) into two distinct bins — not_at_origin (case 1: config/content mismatch) vs errored (cases 2+3: transient availability or local store faults). The motivation is sound: the current single counter is ambiguous between a "will never self-heal" config error and a transient origin outage, making it impossible to write a meaningful alert. The issue is well-scoped: it names the exact enum variant (PrewarmOutcome::Failed), the source file (crates/cache/src/engine.rs), the new counter name, and the existing test that already constructs the case 1 scenario.

    📊 Assessment

    Dimension Value Reasoning
    Type Feature Adds a new metric bin and observability capability; not fixing broken behavior
    Labels enhancement, technical, rust Already has enhancement + technical; adding rust for Rust implementation scope
    Coding agent Suitable Requirements are specific and self-contained: enum discriminator, counter split, doc update, and a known test to extend — no design decisions needed
    💡 Notes and suggestions

    Suggested sub-tasks:

    • Add discriminator to PrewarmOutcome::Failed in crates/cache/src/engine.rs — e.g. Failed { at_origin: bool } or split into NotAtOrigin / Errored variants; set it by matching CacheError::NotFound in prewarm_one.
    • Split PrewarmReport.failed into two counts (not_at_origin + errored); update the five-bin partition identity in the doc comment.
    • Add decdn_cache_prewarm_not_at_origin_total counter following the metrics: decide whether the remaining reason-splits follow probe-hold onto {reason} labels #1475 naming convention; update the appendix observability row.
    • Update crates/cache/tests/prewarm.rs: rename or extend prewarm_counts_a_pin_the_origin_does_not_have_as_a_failure to assert the new not_at_origin bin; add a companion test for the errored path.

    Implementation note: CacheError::NotFound is already available at the prewarm_one call site, so the discriminator can be set at zero extra I/O cost. The split should be exhaustive — ensure the match arm covers all CacheError variants so future variants don't silently fall into the wrong bin.

    Generated by Agentic Triage for #1514 · sonnet46 · 17.2 AIC · ⌖ 5.62 AIC · ⊞ 6.2K · ◷

    Add this agentic workflow to your repo

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/issue-triage.md@94ec5db57374c5b04a4b8eef8b4413f9af44d63f
    
  3. added
    rust
    on Jul 29, 2026
  4. alpergundogdu commented on Jul 30, 2026

    @alpergundogdu
    Contributor

    We're removing the prewarm, origins should be able to return probe responses with { has_blob: true } as long as they have access to the origin and the files "exist" there, and stream and store simultaneously. That removes the need to pull data that's not paid for.

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

    kind:featurerust

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions