Distributed Tracing

Trace requests across service boundaries. Spans, parent/child relationships, baggage, sampling. Tools: Jaeger (CNCF Graduated), Tempo (Grafana), Honeycomb (BubbleUp queries), Datadog APM. Solves the microservices "where is the latency?" problem.

Overview

Where is the latency?

Distributed tracing solves the microservices 'where's the latency?' problem. A user sees 3-second checkout latency; without tracing you grep N services' logs hoping to correlate timestamps. With tracing you see the full request path as a flame graph, and the slow span jumps out.

Here is that checkout in outline. The user's POST /checkout reaches the api-gateway, which opens the root span. The gateway calls auth-service, cart-service and payment-service, and payment-service in turn calls Stripe. The Stripe call is the slow span, and the trace shows it at a glance.

> [!IMPORTANT] Every span in the picture shares one traceID; that shared ID is what turns N separate logs into one request story.

Key concepts

  • Span anatomy — the tracing data model
  • W3C Trace Context propagation
  • Sampling strategies in detail
  • Backend choice: Jaeger vs Tempo vs Honeycomb vs Datadog
  • Recipe: Tempo + Grafana on EKS

Interview questions

  • Walk through how a distributed trace gets created across 5 services.
  • How do you control distributed tracing costs at high RPS?
  • When is distributed tracing the wrong tool?
  • How do you handle async / queue-based tracing?
  • Quick-fire interview answers — distributed tracing essentials.

Sign up free to read the full topic

More Observability topics

Start free on Cariara · Coding problems · System design studio