correlation ID
A unique value attached to one request and passed along everywhere it goes, so its logs and traces can be found together.
In more detail
Return it to the caller so they can quote it when reporting a problem, propagate it through gateways and queues, and record it in every log line and span for that request. Many systems carry it in a header such as X-Request-ID or inside the trace context.
Examples
In AWS: A unique identifier attached to one request and passed through every service it touches, so all its logs and traces can be joined up.When a proxy, a load balancer and an application all log the same identifier, you can follow one failing request end to end. Include it in incident notes.Related terms
- log — A time-stamped record of an individual event in a system, such as one request being handled; structured logs record it as named fields rather than free text.
- trace — A record of one request’s whole journey through a system, made of nested spans that show where the time went.
- leaky error — An error response that reveals private details such as a stack trace, a database query, a secret or internal names.
- API gateway — A server that sits in front of one or more services and handles shared concerns such as routing, authentication, rate limits and TLS for every request.
- structured logging — Writing each log entry as named fields, such as status, duration and request identifier, instead of a free-text sentence.
- trace ID — An identifier shared by every span and log line belonging to one request, so they can be found together.
- AsyncLocalStorage — A Node.js feature that keeps a value available to all code running for one request, even across await and callbacks, without passing it as an argument.
- HTTP header — A named line of metadata in an HTTP message, such as Content-Type: application/json, that describes the body, the caller or how to handle the exchange.
- Problem Details — A standard JSON shape for HTTP error responses, defined in RFC 9457, with members such as type, title, status, detail and instance.
- stack trace — The list of function calls that were running when an error happened, printed to help a developer find where it came from; Python calls it a traceback.
- journald — The systemd logging service that collects messages from the kernel, services and programs into a structured, indexed journal.
- distributed tracing — Following one request across every service, queue and database it touches by recording linked spans that share a trace identifier.
- logging — Recording individual events in detail, such as one failed order, as text or structured lines.
- deadline propagation — Passing a request's absolute deadline to every service it calls, so each knows how much time is left.
Taught in
- Error Handling And Safe Retries — Modern API Architecture: REST, GraphQL & gRPC
- API Gateways And Proxies — Modern API Architecture: REST, GraphQL & gRPC
- Observability: Logs, Metrics, Traces — Modern API Architecture: REST, GraphQL & gRPC
- Serverless Compute (Lambda) — Cloud Infrastructure & Hyperscaler Architecture
- Observability with CloudWatch — Cloud Infrastructure & Hyperscaler Architecture
- The ASP.NET Core Middleware Pipeline — Modern .NET Core, C# & Enterprise Microservices
- Global Exception Handling and Problem Details — Modern .NET Core, C# & Enterprise Microservices
- Resilient Error Handling: Problem Details & Envelopes — Production Full-Stack Engineering
- Structured Logging & Correlation IDs: Context Stitching — Production Full-Stack Engineering
- Reading The Request — Modern Java: Virtual Threads & High-Throughput Services
- Exception Handling To Problem Details — Modern Java: Virtual Threads & High-Throughput Services
- HTTP Is Text: Requests, Status Codes And Headers — Linux Fundamentals & Systems Administration
- Routing & Middleware: Path Parsing & Async Context — Node.js Internals & Backend Services
- Observability As A Design Input — Scalable System Design & Distributed Architecture