Course contentsShow
← System Design
Lesson 1219 of 1,91931. Observability: TracingFree lesson

What is Distributed Tracing?

Understanding how distributed tracing tracks requests across multiple services in a microservices architecture.

What is Distributed Tracing?

You'll learn how distributed tracing tracks a single request's journey across multiple services in a microservices architecture.

The Problem Without Tracing

Imagine debugging a slow API call that touches 8 different microservices. Your logs show each service processed something, but which request was slow? Which service caused the delay? Without distributed tracing, you're piecing together a puzzle with timestamps and correlation IDs — tedious and error-prone.

How Distributed Tracing Works

Distributed tracing follows a single user request as it flows through your entire system, creating a trace — a complete timeline showing every service call, database query, and message queue operation involved.

Think of it like tracking a package through a delivery network. Each warehouse (service) scans the package (adds timing data), and you get a full journey map showing exactly where delays occurred.

Key Components

A trace represents one complete request journey, composed of multiple spans. Each span represents a single operation:

  • Service A calls Service B (one span)
  • Service B queries a database (another span)
  • Service B calls Service C (another span)

Spans are linked together using trace IDs (identifies the whole request) and span IDs (identifies individual operations). Each span records:

  • Operation name
  • Start and end timestamps
  • Parent span ID (to build the hierarchy)
  • Tags and metadata

Why It Matters

While logs tell you what happened in one service and metrics tell you how many and how fast overall, distributed tracing shows you where time was spent across your entire system for a specific request. It's essential for debugging latency issues, understanding service dependencies, and identifying bottlenecks in complex architectures.

Key Takeaway: Distributed tracing tracks individual requests across multiple services by creating a hierarchical timeline of operations (spans), making it possible to debug and optimize complex microservices interactions.