Skip to content

feat: expose artifact cache and origin metrics - #428

Merged
worstell merged 3 commits into
mainfrom
jrobotham/host-cache-metrics
Nov 9, 2026
Merged

worstell merged 3 commits into
mainfrom
jrobotham/host-cache-metrics

Conversation

@jrobotham-square

@jrobotham-square jrobotham-square commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Why

Artifact request totals mix cache hits with origin downloads. They cannot show a cold-cache retry storm or a failed cache write behind HTTP 200.

What

Add metrics for origin HTTP exchanges and latency, and cache fill/write outcomes. Label cache hits with the backend that served them (cachew.cache.source), next to the existing cachew.cache.result. Cover the shared artifact handler used by host, Hermit, Artifactory, HTTP proxy, OCI and GitHub release downloads.

How

Record the accepted cache source after tier selection. Measure outbound exchanges in a transport below the upstream 429 cooldowns, so rejected requests are not counted. Record publication only when writes finish, for both coalesced and uncoalesced fills, separating origin fills, local backfills and background heals. Cache write wrappers keep pending reads, so coalesced readers still follow the cache write. Use bounded strategy/registry labels and exclude internal forwarding from origin traffic.

Risk

This touches shared cache and streaming paths. Existing responses, cache keys, cancellation and cache-failure fallback behavior are preserved. Six local Git/snapshot test failures also reproduce on unchanged main; they prevent a clean full-suite result on this machine.

Testing

No manual testing.

Bigger picture

Release and deploy this change before building dashboard panels for the new metrics. This adds observability; cache-fill coordination and upstream backoff remain separate behavior changes.

Generated with Codex

jrobotham-square and others added 2 commits November 9, 2026 14:13
Distinguish cache resolution, outbound HTTP exchanges, and cache publication so cache hits cannot hide origin failures.

Co-authored-by: Daics (6.1 sol) <c903389623ca2947421fd4fb3757d43fb6c7f47e8c915cfaa22d31027cd80c15@buzz.block.builderlab.xyz>
Origin metrics now wrap the transport below the 429 cooldowns, so a
request that a cooldown rejects is not counted as origin traffic.

Coalesced fills record their outcome in cachew.cache.fills. The fill
writer and the tier write wrapper keep pending reads, so coalesced
readers still follow the cache write.

The cachew.cache.resolutions counter is removed: cachew.cache.result
already gives hit and miss counts. Hits now also get the
cachew.cache.source label on the same HTTP server metrics. OCI blob and
manifest handlers get metric labels.

Co-authored-by: Chain <492cad42391b4a5c84d831885f468e6f1699c0a8c39241f1c002235ece37ee69@buzz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@worstell
worstell force-pushed the jrobotham/host-cache-metrics branch from b3d5094 to d46a758 Compare November 9, 2026 22:23
Tiered and single-tier Stat now report the backend that found the
object, so HEAD hits carry the correct cachew.cache.source instead of
the fallback value.

Co-authored-by: Chain <492cad42391b4a5c84d831885f468e6f1699c0a8c39241f1c002235ece37ee69@buzz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@worstell
worstell marked this pull request as ready for review November 9, 2026 22:37
@worstell
worstell requested a review from a team as a code owner November 9, 2026 22:37
@worstell
worstell requested review from worstell and removed request for a team November 9, 2026 22:37
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T22:39:45.411681Z 76da2ca Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@worstell
worstell enabled auto-merge (squash) November 9, 2026 22:38

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 76da2ca02e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/strategy/github_releases.go Resolved
@worstell
worstell merged commit ec57632 into main Nov 9, 2026
7 checks passed
@worstell
worstell deleted the jrobotham/host-cache-metrics branch November 9, 2026 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants