A user reports an error at 14:02 and the error page shows a request ID. How does a trace ID help you find the cause across ten services?
Sketch your own answer first, then compare it with the one below.
A strong answer
If the request ID is the trace ID, it is a key that every service shares. Each service puts the current trace ID into every log line it writes, usually as a structured field filled in by the logging library from the active span. Searching your log store for that one ID returns the lines from the gateway, the backend that failed, and every service in between, ordered by time.
The trace gives the structure that the logs lack. Open the trace by the same ID and you see which service called which, how long each call took, and which span carries the error status. You then read the logs of that span only, instead of ten services' worth.
The W3C trace context identifier is 32 hexadecimal characters, so it is long enough to be unique across services and to be pasted into a search box. Expose it on error pages and in a response header, because support staff can then pass it along without needing access to your tools.
The link works only if the ID reaches every service, so a hop that drops the header leaves its logs without a matching ID.
Sources
- Sergey Kanzhelev, Morgan McLean, Alois Reitbauer, Bogdan Drutu, Nik Molnar, Yuri Shkuro (2021). Trace Context.
- OpenTelemetry project (2024). Traces.