Logs, metrics, and traces
Logs describe events, metrics count or measure them, and traces follow one request through multiple operations.
How it works
Start from the question you need to answer. A latency metric can indicate that many requests became slow. A trace can break one request into timed steps. A log can record a specific failure code on a step. Use correlation IDs to connect the information.
Walk through an example
A slow-request metric tells you when latency increased. A trace can show that the database took most of one request’s time. A relevant log can explain why a specific step failed.
What to watch for
Avoid logging sensitive input. Prefer a request ID and safe context so events can be connected without exposing private data.
Check your understanding
Which tool most directly shows that breakdown?
See the example and explanation
- Worked example
- Given
You need to find which step of one request was slow. - Answer
A trace.
A trace records timed spans for steps in the same request.