feat(oci): debug-level blob cache hit/miss logging for observability (PSA-41) #9

Merged
nrupard merged 2 commits from feat/psa-41-blob-cache-hit-miss-logging into main 2026-06-03 20:24:55 +02:00
Owner

Problem

The dunite-oci blob cache emitted no log line on a hit or miss; the only blob-cache output was the eviction warning. During the bunyip BUNYIP-35 e2e it was impossible to confirm from logs whether a re-pull was served from cache or refetched from upstream, so proving cache behaviour required a dead-upstream test.

Change

Two debug-level structured log lines in get_or_fetch:

  • oci blob cache hit with digest + size_bytes, when a stored row's on-disk file is present.
  • oci blob cache miss, fetching from upstream with owner, name, digest, before the upstream fetch (also covers a stale row whose file was wiped).

Debug level keeps production quiet at the default info level while making cache behaviour observable once RUST_LOG is raised.

Acceptance criteria

  • A blob served from cache logs a hit at debug; a blob fetched from upstream logs a miss/fetch at debug, both with the digest.
  • No new output at the default info level (structural: tracing::debug!).

Tests

Adds a tracing-test dev-dependency (workspace + dunite-oci). cache_hit_logs_at_debug_with_digest and cache_miss_logs_at_debug_with_digest capture the events in-process and assert both the message and the digest are present. fmt + clippy -D warnings clean; full cargo test --workspace green.

#PSA-41

## Problem The dunite-oci blob cache emitted no log line on a hit or miss; the only blob-cache output was the eviction warning. During the bunyip BUNYIP-35 e2e it was impossible to confirm from logs whether a re-pull was served from cache or refetched from upstream, so proving cache behaviour required a dead-upstream test. ## Change Two debug-level structured log lines in `get_or_fetch`: - `oci blob cache hit` with `digest` + `size_bytes`, when a stored row's on-disk file is present. - `oci blob cache miss, fetching from upstream` with `owner`, `name`, `digest`, before the upstream fetch (also covers a stale row whose file was wiped). Debug level keeps production quiet at the default info level while making cache behaviour observable once `RUST_LOG` is raised. ## Acceptance criteria - [x] A blob served from cache logs a hit at debug; a blob fetched from upstream logs a miss/fetch at debug, both with the digest. - [x] No new output at the default info level (structural: `tracing::debug!`). ## Tests Adds a `tracing-test` dev-dependency (workspace + dunite-oci). `cache_hit_logs_at_debug_with_digest` and `cache_miss_logs_at_debug_with_digest` capture the events in-process and assert both the message and the digest are present. fmt + clippy -D warnings clean; full `cargo test --workspace` green. #PSA-41
feat(oci): debug-level blob cache hit/miss logging for observability (PSA-41)
All checks were successful
Checks / fmt + clippy + test (pull_request) Successful in 31s
8fd50d1606
The blob cache emitted no log line on a hit or miss; the only blob-cache output was the eviction warning. During the bunyip BUNYIP-35 e2e it was impossible to confirm from logs whether a re-pull was served from cache or refetched from upstream, so proving cache behaviour required a dead-upstream test.

Add two debug-level structured log lines in `get_or_fetch`: "oci blob cache hit" (with digest + size_bytes) when a stored row's file is present, and "oci blob cache miss, fetching from upstream" (with owner, name, digest) before the upstream fetch. Debug level keeps production quiet at the default info level while making cache behaviour observable once RUST_LOG is raised; no new output at info.

Tested with a new `tracing-test` dev-dependency: `cache_hit_logs_at_debug_with_digest` and `cache_miss_logs_at_debug_with_digest` capture the events in-process and assert both the message and the digest are present. The info-level quietness is a structural property of using `tracing::debug!`.

#PSA-41

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
fix(oci): log blob cache miss inside the single-flight closure (PSA-41 review)
All checks were successful
Checks / fmt + clippy + test (pull_request) Successful in 19s
create-release / create-release (pull_request) Has been skipped
c487cf411e
Code review: the miss/fetch debug line was emitted before `inflight.run`, so under N concurrent callers for the same digest it logged "fetching from upstream" N times even though single-flight collapses them to one actual upstream fetch. Move the line inside the single-flight closure so it fires once per real fetch (the leader) rather than once per waiting caller. Hit-path logging and the capture tests are unchanged.

#PSA-41

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
nrupard deleted branch feat/psa-41-blob-cache-hit-miss-logging 2026-06-03 20:24:55 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
psa-systems/dunite!9
No description provided.