Prompt
How do I follow a single request through multiple services
Latest observation
Oct 28, 2026
OpenAI APIWeb search: off
To follow a single request across multiple services, you typically use distributed tracing with a correlation ID / trace ID that gets propagated through every hop.
Core idea
- Generate an ID at the entry point of the request.
- Attach it to the request context.
- Propagate it from service to service in headers or metadata.
- Log it everywhere so you can search all logs for that one request.
- Use a tracing system to visualize the full path and timings.
Common approaches
1) Correlation ID
A simple unique ID added to each request, often as a header like:
X-Correlation-IdX-Request-Id
Each service:
- reads the incoming ID
- includes it in outgoing calls
- writes it to logs
This is good for log searching, but not enough for full performance breakdowns.
2) Distributed tracing
Use a tracing standard such as OpenTelemetry.
A trace has:
- trace ID: the ID for the whole request path
- span ID: the ID for one operation within the trace
- parent span ID: links spans together
This lets you see:
- which services were called
- how long each call took
- where errors happened
- the full request timeline
Typical flow
Example:
- Client sends request to API Gateway
- Gateway creates trace ID if missing
- Gateway calls Service A with trace context
- Service A calls Service B and Service C, passing the same trace context
- All services emit logs and traces with the same trace ID
What to propagate
If using OpenTelemetry, propagate trace context using standard headers like:
traceparenttracestate
These are part of the W3C Trace Context standard.
Logging best practice
Include the trace ID in every log line, for example:
2026-10-28T12:00:01Z service=A trace_id=abc123 msg="Starting request"
2026-10-28T12:00:02Z service=B trace_id=abc123 msg="Calling database"
2026-10-28T12:00:03Z service=C trace_id=abc123 msg="Finished request"
Then you can search by trace_id=abc123 and see the full journey.
Tools commonly used
- OpenTelemetry for instrumentation
- Jaeger, Zipkin, Grafana Tempo, or Datadog APM for trace visualization
- Centralized logging like ELK/Elastic, Loki, Splunk, etc.
Practical recommendation
If you’re starting from scratch:
- Adopt OpenTelemetry
- Use W3C trace context propagation
- Add the trace ID to logs
- Export traces to Jaeger or Tempo
That gives you both:
- easy log correlation
- full end-to-end tracing
If you want, I can also show:
- a language-specific example in Python/Java/Go/Node
- how to do this with HTTP headers
- how to do this in microservices with queues/messages