OpenTelemetry Visual Handbook · lab

The trace dies at send and comes back an orphan

The checkout trace ends at orders publish. A few seconds later, a trace appears in fulfillment that starts from nothing. Both look complete. Nothing errored, and nothing joins them.

A queue is not a call. The context only crosses it if the producer writes the traceparent into the message headers, and the consumer reads it back. Then it has a second decision: one message gets a parent; a batch from three traces cannot have three parents, so it gets links.

Break it

  1. Turn off injection, publish two orders and consume them. Four traces for two orders: two that stop at publish and two orphans that start from nowhere.
  2. Turn it back on and consume one at a time. Each process span names its publish span as parent, and the trace runs through the queue.
  3. Publish three, then consume the batch. One new trace, with a link to each of the three. Following a link is how you get from the batch back to the request that produced the message.
  4. Publish, wait five seconds, consume. The wait is real time in the trace: the gap between publish and process is the queue.

Predict before you look

Answer first, then try it in the simulation.

A consumer reads a batch of 10 messages, published by 10 different requests, and processes them in one span. Every producer injected traceparent. What does that span carry?

Commit to an answer first. You cannot change it afterwards.

What people get wrong

Each row is a belief the simulation is built to take apart. The right column is the specification, with the link.

What people believe What the spec says
The HTTP instrumentation propagates context, so the queue does too. Context crosses a boundary only if something injects it into the carrier. For a message, the carrier is the message's own headers, and the producer side has to write them. source
The consumer's span should always be a child of the producer's. When one consumer span handles messages from several traces, it cannot have several parents. Messaging conventions use links from the process span to each message's context. source
If propagation breaks, something errors. The consumer finds no traceparent and starts a root span. You get complete-looking traces on both sides of the queue, and nothing joins them. source

Where this connects

Hard context and baggage is the same injection and extraction over HTTP headers; a queue moves the carrier into the message. Anatomy of a trace is why the orphan looks complete: the backend builds a tree from whatever arrived.

Check your understanding

The assessment for this lab has not been authored yet.

Continue to the handbook assessment →