Send the request ID upstream and log it with each image
The fetcher sends the request ID chi's RequestID middleware put in the context as X-Request-Id, next to User-Agent and Accept, and the "upstream fetched", "image converted" and "image served" lines carry it as request_id, as the request log line does. A fetch shared by several requests runs with the first request's context values, so it carries that request's ID; README says so where it describes the shared fetch. Model: opus-5-5
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
|
||||
"github.com/dustin/go-humanize"
|
||||
"github.com/getsentry/sentry-go"
|
||||
"github.com/go-chi/chi/v5/middleware"
|
||||
"golang.org/x/sync/singleflight"
|
||||
"sneak.berlin/go/pixa/internal/allowlist"
|
||||
"sneak.berlin/go/pixa/internal/httpfetcher"
|
||||
@@ -461,6 +462,7 @@ func (s *Service) fetchAndProcess(
|
||||
|
||||
// Log upstream fetch details
|
||||
s.log.Info("upstream fetched",
|
||||
"request_id", middleware.GetReqID(ctx),
|
||||
"host", req.SourceHost,
|
||||
"path", req.SourcePath,
|
||||
"bytes", fetchBytes,
|
||||
@@ -545,6 +547,7 @@ func (s *Service) processAndStore(
|
||||
}
|
||||
|
||||
s.log.Info("image converted",
|
||||
"request_id", middleware.GetReqID(ctx),
|
||||
"host", req.SourceHost,
|
||||
"path", req.SourcePath,
|
||||
"src_format", processResult.InputFormat,
|
||||
|
||||
Reference in New Issue
Block a user