dine. a kitchen run by sagas Book a table
Log in with Google (coming soon)

Articles

Tiếng Việt · English

How one order travels through the system

October 14, 2026 · about 6 min read

An order at dine passes through four services, a few processes and a few dozen milliseconds of messages going back and forth on Kafka. When an order is cancelled, the first question is always: what happened, and in what order? The diagram on the order detail page answers that question. This article is about how it is made, and why dine built it instead of using an existing tool.

Nobody knows the whole story

In a monolith, to find out where an order went, reading the log is enough: everything is in one place, in the right order.

At dine, each service only knows its own part. The table service knows which table it held. Payment knows how much it charged. No service knows how the order ended, and the logs of the four services live in four different places. To understand a failed order, you would have to open each one and line up the timestamps by hand. That is slow, error-prone, and certainly not something you can show to an outsider.

One row for each job

The idea is very simple: every time order does a job for an order, it writes down one row. Each such row is called a span. At dine there are only three kinds of job:

KindWho does itWhat the row records
Receive orderAPI processWhen the booking request arrived and the order was written to the database.
Send commandsaga processWhen the command was taken from the outbox and sent to Kafka, how long it waited in the outbox, which services it went to.
Receive replysaga processWhich service replied, done or failed, and what order decided: which state the order moved from and to, and whether an undo was sent to anyone.

Each row also records the order ID, the start and end time, the name of the process that did the work, and the exact position of the message in Kafka. Thanks to that position, the original message can be found again when needed.

These are all the rows of the sample order "Failure after others finished", in time order:

TimeJobDetails
+0msReceive orderWrite the order, the saga and the command into the outbox, taking 4ms.
+93msSend command"Do" command to 3 services, after waiting 90ms in the outbox.
+380msReceive replyTable: done. The order is still running.
+550msReceive replyKitchen: done. The order is still running.
+710msReceive replyPayment: failed. The order moves to undoing; undo the table and the kitchen.
+806msSend command"Undo" command to the table and the kitchen.
+1050msReceive replyTable: undone.
+1120msReceive replyKitchen: undone. Nothing left to clean up; the order ends as cancelled.

Eight rows; read them top to bottom and you have the whole story. The diagram on the order detail page is just these eight rows redrawn.

Starting with order, then the other three

order is the coordinator: every command going out and every reply coming back passes through it. So a single service writing rows is enough to see almost the whole path of an order, including the most important decisions.

What is missing is what happens inside the other three. So the table service, the kitchen and payment write rows of their own too, two per command: one when the command is received and processed, one when the reply is sent. Each writes into its own database and sends them to nobody. Rows from two different services are linked by the message's position in Kafka: the message order sends is exactly the message the other side receives.

This splits a leg into all its parts: how long the command sat on Kafka, how long the other side took to process it, how long the reply waited in the other side's outbox, and how long it took to get back to order. When a service receives a duplicate command, the diagram also shows clearly that it did not redo the work, only resent the original reply.

From rows to pictures

Each service keeps its rows in its own database, and has a public API that returns the rows for one order. The browser asks all four services, merges the results itself and draws two pictures:

All the drawing happens in the browser. The server only returns raw data, so changing how things are drawn only means editing the web page, without touching the services.

Recording must not break the order

There is one rule dine holds firmly: writing rows is only for observation and must never affect the order. A row is written after the main work is done. If writing it fails, there is just one log line reporting the error, and the order carries on as if nothing happened. A missing row means one missing box in the diagram. Breaking the order because a row failed to write would mean breaking the very thing being observed, and that is not worth it.

Why not Jaeger or OpenTelemetry

Recording the path of a request through many services is a well-known problem, called distributed tracing, and there are very good tools for it, such as OpenTelemetry and Jaeger. dine still built its own, for two reasons:

Given those two points, a table sitting next to the order data is the simplest approach: no extra system to run, written and read with the database that is already there.

Building it yourself has a price too. It follows no standard, so it cannot plug into existing tools. Each service that wants its own part has to build it. The table grows with the number of orders and needs cleaning up. For a much larger system, with many teams working on it, OpenTelemetry is still the more sensible choice. At dine's scale, building it is just enough and easy to understand.

See it for yourself

Open any sample order, read the diagram from top to bottom, then press Show technical chart below it to see the same story at the level of processes and messages.

Spotted a mistake, or have a question? Write to [email protected].

dine is a personal project about distributed systems, written in Go: orchestrated sagas, transactional outbox, Kafka. More articles.