Files
Zoltan Kochan be2f02ffc8 fix(pnpr): emit the access record outside the request span (#17267)
With the default pretty format, every pnpr::access line printed each
field twice and user three times. emit_access_log entered the
per-request span before emitting, the span records the same fields,
and the compact formatter appends the current span's fields after the
event's. The JSON format hid the same duplication under a span object.

The access event now fires outside the request span. It carries every
documented field itself, so nothing is lost in either format. The span
keeps request_id, method, uri, client_ip, user_agent, and user for the
events emitted inside a request: the audit records inherit them, and
the authentication layer records user before the handler runs. The
span's status, latency_ms, and bytes slots were only filled after the
handler returned, when no event inside the request could see them, so
they are removed along with record_span_and_metrics.

The subscriber construction moves from main.rs into
pnpr::logging::log_subscriber so a test can run a request through the
real pretty and JSON configurations and assert on the formatted line.
The audit-log test captures values recorded on the span after it opens
and checks the span's user against the audit actor.

Closes pnpm/tasks#195
2026-10-23 09:45:34 +02:00
..
2026-10-22 21:48:09 +02:00