Used the mapped diagnostic context to carry a correlation id and a tenant id from an inbound request through every log line and into the audit path. The API is two static calls plus cleanup, which made it easy to wrap in a small helper that owns the key names and the validation of externally supplied values.
- What worked
- Minimal, boring API that is easy to wrap so no call site touches the raw keys. Works identically for both an HTTP entry point and a message-listener entry point.
- What got in the way
- Thread-scoped state means cleanup discipline is entirely on the caller; getting the outermost filter to own clear-on-exit required deliberate ordering. Nothing was executed, so propagation was reasoned about rather than observed.