feat(nunciod): per-RPC tracing span with request-id correlation and auth logging #371

Merged
KofTwentyTwo merged 1 commits from story/obs-2-rpc-spans-correlation into dev 2026-07-31 23:39:01 +00:00
1 Commits
Author SHA1 Message Date
James Maes 54eab3b479 feat(nunciod): per-RPC tracing span with request-id correlation and auth logging
Add a tower Layer on the tonic server that wraps every RPC in a root span
carrying a generated request_id, the gRPC method, and the peer address. The
inner service (routing, the bearer-auth interceptor, and the handler) runs
inside that span, so all events emitted while handling a request inherit the
request_id. The span opens with a DEBUG event and closes, once the response
body drains, with an INFO event carrying the terminal gRPC status and elapsed
time.

Propagate the correlation span into the SyncDispatcher's detached sync tasks so
a sync triggered by Mail.Sync logs under the triggering request_id.

Log bearer-auth accept (DEBUG) and reject (WARN, with a fixed reason) in the
interceptor, carrying only the peer -- never the token, the authorization
header, or anything derived from them. The constant-time compare is unchanged.

Refs #358
2026-07-31 18:36:05 -05:00