Services

Resources

Company

/

Correlation ID

Correlation ID

A correlation ID, also called a request ID, is a unique identifier assigned to a request at its entry point and passed along to every service, queue and job that handles it. Each service writes the ID into its logs and responses. Searching for that one value then returns the whole story of the request across the system.

How it works

The gateway or first service generates an ID, such as a UUID, unless the caller already sent one. It forwards the ID in a header, for example X-Request-ID, and adds it to message metadata for async work. Every log line includes it as a field. If a checkout request passes through 4 services, one search for request_id = 7f3a9c returns all 12 log lines it produced, in order. With OpenTelemetry, the W3C traceparent trace ID, 32 hex characters, plays the same role and also links the distributed trace.

Why it matters in production

Without a shared ID, debugging one failed request means matching timestamps across services by hand. Returning the ID to the client lets support quote it in a ticket, so engineers jump straight to the exact logs and trace.

See also

On the One2N blog

Further reading

Diagram of a correlation ID: a request carrying the header X-Request-ID: 7f3a9c passes through four services, gateway, checkout, payments and worker. Each writes three log lines tagged with the ID. Arrows from all four log stacks lead to one search, request_id = 7f3a9c, which returns 12 lines in order. A red note says that without the ID, engineers match timestamps across services by hand.

Putting this into practice?

Talk to One2N about our SRE consulting

Talk to One2N about our SRE consulting