Try
↑ ↓ move↵ openesc close

Interview prep / Distributed tracing

Junior · Distributed tracing · System design interview question

When would you reach for a trace instead of logs or metrics?

Sketch your own answer first, then compare it with the one below.

A strong answer

Use metrics to see that something is wrong and how widely: rates, errors, latency percentiles. They are cheap and aggregate over all requests, but they have forgotten which request was which.

Use logs to see what a service did in detail. They are rich, but a log line in one service does not say which upstream request caused it unless an identifier is attached.

Use a trace when you need to know where one request spent its time across services: which call was slow, whether calls ran in parallel or in sequence, and what the critical path was.

In practice you chain them. An alert fires on a metric, a trace of one slow request finds the slow span, and the logs of that span give the cause.

Sources

Learn it by running it

The distributed tracing lesson explains the mechanism behind this question, and its lab lets you change the parameters and watch the effect.

Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms