A logistics platform's request crosses synchronous services, message queues, scheduled batch jobs and third-party callbacks. Tracing works within services and breaks between them. What is missing?
Show the full answer Hide the answer
What is missing
Context propagation across the asynchronous boundaries. Tracing libraries handle synchronous HTTP calls automatically; they do not automatically carry context into a message, through a queue, out of a worker, into a scheduled job, or through a third-party callback that returns hours later.
Each of those is a manual instrumentation point, and each one that is missed severs the trace.
The propagation points that must be handled
- Into and out of messages. The trace context travels in message headers, and the consumer restores it before doing work. A link rather than a parent-child relationship is usually correct here, since the consumer's work is causally related but temporally separate — and modelling it as a child produces traces that appear to last hours.
- Into scheduled and batch work, where the job processes items originating from many different requests. The correct model is a trace per item with links to its origin, not one enormous trace for the batch.
- Across third-party callbacks, by embedding your own reference in the request and restoring the context when the callback arrives. Without this, the two halves of an operation are unconnected.
- Into retries, where the retry should be linked to the original attempt rather than appearing as an unrelated request.
The business-entity correlation that matters more
For a logistics platform, the technically correct trace is less useful than a business correlation identifier: the shipment ID, present on every log line, every event, every job and every external call related to it.
When a customer asks where their package is, nobody wants a trace — they want every event for that shipment, across days, across systems, including the batch jobs and the carrier callbacks. That is a different capability from distributed tracing and it is the one this domain actually needs.
The practical requirement
Both, with the business identifier on every signal. Tracing answers "why was this request slow"; the business correlation answers "what happened to this shipment", and the second question is asked far more often in a physical-world domain where operations span days and cross organisational boundaries.