Video in progress

In a system of 30 services, checkout's p99 latency went up. How do you find the guilty service, and how do you build observability to be ready for cases like this?

I start from the SLO alert, then open checkout's slow traces to see which spans took the time, and confirm with the RED metrics and logs of the service I find. For that, every service needs identical metrics, tail sampling and a traceId linked to the logs in place beforehand.

📖 Answer

The search. p99 is something the average doesn't show, so I look at exactly the slow requests. In the tracing UI, a filter: service=checkout-bff, duration > 2s, last 1 hour. I open 20–30 traces and compare which span the time went to. Often the pattern shows quickly: in all of them the pricing → promo-service span is 1.5 seconds.

But a trace says "where", not always "why". Next come promo-service's own indicators:

  • RED: rate, errors, duration: has traffic grown, are there errors;
  • resources: CPU throttling, GC pauses, connection pool waits;
  • deploys and config changes: does the rise on the graph line up with a deploy?

In most cases the cause is one of these: an N+1 query in the new deploy, a missing index, an unusual request from one big customer, or a resource shared with a neighbor (DB, node).

Preparation.

  • Every service emits identically named metrics (http.server.requests is the standard in Micrometer), so one dashboard template fits all of them.
  • SLOs by user journey: "99% of checkouts faster than 1.5 seconds", and the alert fires on the speed of error budget burn, not on every CPU spike.
  • Tail sampling: errors and slow traces are kept at 100%.
  • Exemplars: going straight from a point on the latency histogram to the trace. Prometheus and Grafana support this.
  • A traceId is mandatory in logs, and log levels in prod are kept at a readable level.
  • A service map (automatic from tracing): nobody knows from memory who calls whom.

The most useful habit: after every incident, ask "what were we missing to find this in 5 minutes?" and add exactly that.