Skip to content

cache: add a counter metric for outboard declines #2855

Closed as not planned
Closed as not planned

Description

@yigitdot

Follow-up to #2826 / #2853.

Problem

An HTTP origin that declines an outboard GET (401/403/3xx, or another non-retriable non-404 status such as 400/405/410) warns once per origin per status class, then logs at debug (#2853). That keeps an origin that answers 403 for a missing key from warning on every cold miss, but the warn-once cannot tell a new ACL break (a 403 during a real outage) from that steady-state 403-for-missing. The warn re-arms only on node restart. Only a rate can tell the two apart.

Keep the warn-once as the first log notice; add a counter next to it.

Goal

Count every outboard decline, e.g. decdn_cache_origin_outboard_declines_total{kind, class} in CacheMetrics, where kind is the origin kind and class the decline reason (401, 403, 3xx, other 4xx, oversize). Cover:

  • HTTP status declines (HttpOrigin::get_outboard_bounded)
  • oversize-outboard declines (advertised Content-Length over the cap, and a body that runs past it), in HTTP and S3
  • S3 declines

Implementation options

A. Carry a reason on the variant. OutboardFetch::Unsupported carries the decline class, and the engine counts it where it already maps Unsupported to Declined (fetch_gated_outboard).

  • + The adapters stay free of metrics, and all adapters are counted the same way.
  • - A contract change across all three adapters (cheap pre-mainnet).

B. Pass Arc<CacheMetrics> into HttpOrigin, which counts in the adapter.

  • + A smaller change, HTTP adapter only.
  • - The adapter now depends on metrics, and S3 and oversize declines need separate plumbing.

Done when

  • Every outboard decline increments the counter with its kind and class.
  • The warn-once log stays as it is.
  • A test pins one increment per decline for at least the HTTP 403 and oversize cases.

Activity

  1. added
    kind:feature
    prio:low
    area:cache
    on Nov 6, 2026
  2. alpergundogdu commented on Nov 11, 2026

    @alpergundogdu
    Contributor

    Closing as won't-fix: the warn-once log is enough until an operator needs a decline rate. Reopen if one does.

  3. moved this from Backlog to Done in deCDNon Nov 11, 2026
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

    area:cachekind:featureprio:low

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions