What is distributed tracing and how does it work in microservices?

Answer

Distributed tracing tracks a single user request as it flows through multiple microservices, collecting timing and metadata at each hop to give a complete picture of the request's journey. When a request enters the system, a unique trace ID is generated and propagated in request headers through every service call. Each service creates spans — individual units of work with a start time, duration, and metadata — that are sent to a central tracing backend. Tools like Jaeger and Zipkin visualize the complete trace, showing the full call tree and where latency is being added. This is essential for debugging performance issues and understanding service dependencies in complex microservices topologies.