Skip to content

Rationalize OCI image fetching logging#11347

Merged
dan-stowell merged 2 commits intomasterfrom
bbdan-rationalize-oci-logging
Feb 18, 2026
Merged

Rationalize OCI image fetching logging#11347
dan-stowell merged 2 commits intomasterfrom
bbdan-rationalize-oci-logging

Conversation

@dan-stowell
Copy link
Contributor

@dan-stowell dan-stowell commented Feb 18, 2026

Net effect

  • Info+ log lines per cached image pull: ~6 -> 1
  • Double-logged errors: 5-6 sites -> 0
  • Log lines missing request context: 12 -> 2
  • Ambiguous duplicate messages: 5 pairs -> 0
  • Cache hit/miss metrics (OCIRegistryCacheEvents) fully preserved

deets

ocicache.go (library layer - log at boundary, not in library):

  • Remove 7 Warning log lines from WriteManifestToAC and FetchManifestFromAC that were duplicated by callers in oci.go and ocifetcher.go
  • Remove Info log on successful manifest write (normal path, no value)
  • Downgrade manifest cache hit/miss from Info to Debug (metrics preserved)
  • Add ctx to readThroughCacher for fire-and-forget cache write warnings (these are the only place these errors are logged)

oci.go (resolver - direct registry path):

  • Downgrade 'Authenticating with registry' from Info to Debug (every pull)
  • Downgrade 'Resolving image' from Info to Debug (every pull)
  • Add ctx to 'Error fetching blob from cache' (was missing tracing)

ociregistry.go (HTTP mirror/registry):

  • Differentiate two identical 'Error writing response body' messages

ociruntime.go (layer extraction):

  • Add ctx to 4 filecache population log calls

ociconv.go (ext4 conversion):

  • Add ctx to 3 Debug calls

ocicache.go (library layer - log at boundary, not in library):
- Remove 7 Warning log lines from WriteManifestToAC and FetchManifestFromAC
  that were duplicated by callers in oci.go and ocifetcher.go
- Remove Info log on successful manifest write (normal path, no value)
- Downgrade manifest cache hit/miss from Info to Debug (metrics preserved)
- Add ctx to readThroughCacher for fire-and-forget cache write warnings
  (these are the only place these errors are logged)

oci.go (resolver - direct registry path):
- Downgrade 'Authenticating with registry' from Info to Debug (every pull)
- Downgrade 'Resolving image' from Info to Debug (every pull)
- Add ctx to 'Error fetching blob from cache' (was missing tracing)

ocifetcher.go (server-side fetcher):
- Prefix all Warning messages with [ocifetcher] to disambiguate from
  near-identical messages in oci.go

ociregistry.go (HTTP mirror/registry):
- Differentiate two identical 'Error writing response body' messages

ociruntime.go (layer extraction):
- Add ctx to 4 filecache population log calls

ociconv.go (ext4 conversion):
- Add ctx to 3 Debug calls

Net effect:
- Info+ log lines per cached image pull: ~6 -> 1
- Double-logged errors: 5-6 sites -> 0
- Log lines missing request context: 12 -> 2
- Ambiguous duplicate messages: 5 pairs -> 0
- Cache hit/miss metrics (OCIRegistryCacheEvents) fully preserved

Co-authored-by: Shelley <shelley@exe.dev>
// Since we do not know the state of the stream, it is not safe
// to write bytes to the stream past this point.
log.CtxWarningf(ctx, "Error fetching blob from cache: %s", err)
log.CtxWarningf(ctx, "[ocifetcher] Error fetching blob from cache: %s", err)
Copy link
Member

@bduffany bduffany Feb 18, 2026

Choose a reason for hiding this comment

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

not a huge fan of the square-bracket prefix because this info is already logged automatically (and accessible in a nicer way imo)

  • Expand the log entry in go/logs
  • Find sourceLocation > file in the JSON payload
  • Click the file name > "Add field to summary line"
  • If you want to always see this info, you can make a go/ link since this state is stored in the URL (in the "summaryFields" param). We could consider updating go/logs to make it always visible as well

Should look like this:

image

Also during local development I believe we have the short filename prefix enabled by default (or if not, I think there is a flag to turn it on)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ack, i'll remove

@dan-stowell dan-stowell enabled auto-merge (squash) February 18, 2026 20:41
@dan-stowell dan-stowell merged commit 5856b6e into master Feb 18, 2026
7 of 12 checks passed
@dan-stowell dan-stowell deleted the bbdan-rationalize-oci-logging branch February 18, 2026 20:42
dan-stowell added a commit that referenced this pull request Feb 19, 2026
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