Distributed tracing tools like Jaeger or Zipkin track the flow of a single request as it moves through multiple microservices by attaching a shared trace ID to it.
Key Points: • When a request enters the system, it's assigned a unique trace ID, and each service it passes through adds its own span with timing information under that same trace. • The trace ID and span context are propagated through HTTP headers or message metadata as the request hops between services. • Tracing tools stitch the spans back together into a single timeline, showing exactly how long each service took and where time was spent. • This makes it possible to pinpoint which service caused a slowdown or an error in a request that touched many services. • Spring Cloud Sleuth (or Micrometer Tracing in newer Spring Boot versions) integrates with Zipkin to add tracing with minimal code changes.
Example: If a checkout request is slow, a trace might show it spent 5ms in the API Gateway, 200ms in the Inventory service due to a slow database query, and 10ms in Payment, immediately pointing to Inventory as the bottleneck.
Interview Tip: A concise interview answer is:
"I'd add distributed tracing with a tool like Zipkin or Jaeger, which tags each request with a trace ID that's propagated across service calls and stitched into a single timeline. That lets me see exactly how long each hop took and quickly isolate which service is causing latency or failures."