The idea
A customer action may create several requests, background jobs and notifications. A correlation identifier connects the records of that interaction. It is useful context, but it is not an authentication token and should never grant access on its own.
Design choice
Carry an interaction identifier through relevant boundaries and create separate identifiers for individual operations. Validate identifiers received from outside so that oversized or malformed values cannot pollute logs or conceal another record.
Worked example
One checkout has a correlation identifier. Payment, stock reservation and receipt delivery each have their own operation identifier while retaining the shared checkout reference.
Before you ship
- Distinguish interaction and operation IDs
- Bound external identifier length
- Keep secrets out of log context
Examples are illustrative. Adapt the checks to your own environment.