Video in progress
What is distributed tracing? What do trace ID and span ID mean?
Distributed tracing follows the path of a single request through several services. The trace ID is one shared identifier for the whole request; a span ID identifies a single step on that path (a piece of work inside one service, or a single call).
📖 Answer
A request arrives at the gateway and gets a trace ID. Every following service passes that ID on through an HTTP header and records its own part as a separate span:
trace 4bf92f35...
├─ span gateway 120 ms
│ └─ span order-service 110 ms
│ ├─ span SELECT orders 8 ms
│ └─ span payment-service 85 ms <- most of the time is here
In Zipkin, Jaeger or Grafana Tempo this shows up as a tree, and you immediately see which service is slow.
In Spring Boot 3 this works through Micrometer Tracing (the old Spring Cloud Sleuth is no longer used). The dependencies you need are micrometer-tracing-bridge-otel (or -brave) and an exporter. The header format is usually W3C traceparent.
management.tracing.sampling.probability=0.1
On prod it's normal to record only a fraction of requests (say, 10%), otherwise storing traces gets expensive.
Sign up to mark studied questions and save your progress.