How would you verify trace correlation across an asynchronous producer and consumer?
Answer
Emit a known message with a trace context and business correlation identifier, then verify that producer, broker and consumer telemetry can be joined without making high-cardinality business IDs metric labels. Cover batching, retries, delayed consumption and fan-out; confirm context is propagated rather than accidentally reused. Sample failures deliberately and retain links from the trace to message and consumer logs.
Strong answer includes
- propagates context through message metadata
- covers batching, retries and fan-out
- controls cardinality while preserving diagnostic correlation
Practical example
A consumer that processes messages in batches of 50 accidentally attaches the trace context of only the first message in the batch to every downstream span; a test that publishes 50 uniquely identifiable messages in one batch and checks that each one's trace can be independently followed back to its own producer span catches the bug before it hides real latency outliers behind one shared trace.