STAGE 08 / LESSON 01
Logs, metrics and traces
Observability helps you understand what a running system is doing and why.
THE IDEA
Understand it.
A log records an event, a metric measures a value over time, and a trace follows a request or operation across steps. Together they help answer different questions: what happened, how often, and where time was spent.
Use structured logs and consistent context such as a request ID. Do not log passwords, tokens, payment details or unnecessary personal information. Apply retention and access controls to operational data.
SEE IT IN CONTEXT
Three views of one request
Log: request completed, route=/tasks, status=200
Metric: request duration histogram for /tasks
Trace: browser → API → database queryThe example describes the same operation from three perspectives. A trace helps relate the individual steps of one request.
LEARN FROM REAL WEBSITES
See it in the real world.
These simplified structures come from public sources. Company systems change, and the sources may describe only one project or an earlier design.
Uber
Uber engineering, 2019Observe distributed services
Uber described an observability stack including metrics and distributed tracing for diagnosing services.
- Services
- Metrics and traces
- Investigation
What to learn: Metrics reveal patterns across requests; traces help follow a particular request across components.
Read the source: Uber observabilityGitHub
GitHub engineering, 2021Connect traces to logs
GitHub described adopting OpenTelemetry and adding trace identifiers to logs to help correlate signals.
- Request trace
- Trace identifier
- Related log lines
What to learn: A shared identifier helps an engineer move from a trace to relevant logs. The report describes a 2021 adoption effort.
Read the source: GitHub OpenTelemetry adoptionTRY IT YOURSELF
Practice.
A dashboard shows increased response time. Which signal could help identify which internal step is slow?
Show one possible answer
A distributed trace can show the timing of individual spans, while metrics and logs add context about frequency and failures.
GO DEEPER