M. Kodirov

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 query

The 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, 2019

Observe distributed services

Uber described an observability stack including metrics and distributed tracing for diagnosing services.

  1. Services
  2. Metrics and traces
  3. Investigation

What to learn: Metrics reveal patterns across requests; traces help follow a particular request across components.

Read the source: Uber observability

GitHub

GitHub engineering, 2021

Connect traces to logs

GitHub described adopting OpenTelemetry and adding trace identifiers to logs to help correlate signals.

  1. Request trace
  2. Trace identifier
  3. 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 adoption

TRY 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

Official references.