Add detailed logging for image requests with cache status and timing

This commit is contained in:
2026-01-08 05:04:08 -08:00
parent 6a20406b0f
commit 1a97f42cd8
3 changed files with 18 additions and 0 deletions

View File

@@ -90,6 +90,8 @@ type ImageResponse struct {
LastModified time.Time
// CacheStatus indicates HIT, MISS, or STALE
CacheStatus CacheStatus
// FetchedBytes is the number of bytes fetched from upstream (0 if cache hit)
FetchedBytes int64
}
// CacheStatus indicates whether the response was served from cache.

View File

@@ -172,6 +172,7 @@ func (s *Service) fetchAndProcess(ctx context.Context, req *ImageRequest) (*Imag
Content: io.NopCloser(bytes.NewReader(processedData)),
ContentLength: int64(len(processedData)),
ContentType: processResult.ContentType,
FetchedBytes: int64(len(sourceData)),
}, nil
}