mirror of
https://github.com/docker/docker-agent.git
synced 2026-11-04 10:02:15 +00:00
The previous LogValuesFunc passed context.Background() to slog.LogAttrs,
discarding any values stored in the per-request context.Context — most
notably OpenTelemetry trace spans and correlation IDs threaded through
the codebase by commit 5f0a5796 (refactor(logging): pass context to
all slog calls for correlation).
Use c.Request().Context() instead so request-scoped attributes injected
by upstream middleware reach the structured log handler. Adds a
regression test that asserts a context value set on the request is
visible to a custom slog.Handler when the middleware logs the request.