Intermediate·Concept·2 min read

Logs vs metrics vs traces, and SLI vs SLO?

Practice this question

Definition:

Observability means understanding a system's behavior from the information it emits. Logs capture events, metrics summarize measurements over time, and traces connect work across a request path. An SLI is a measured service behavior, while an SLO is the target the team aims to meet over a defined period.

Key points:

  • Logs describe events; metrics show numeric trends; traces connect request steps.

  • A request ID helps connect related logs without exposing private data.

  • SLI is a measurement, such as successful requests; SLO is its target over a time window.

  • For an availability SLO, specify what counts as a successful eligible request and which measurement window applies.

Example:

  • SLI: proportion of eligible API requests that complete successfully.
  • SLO: at least 99.9% of those requests succeed over a rolling 30-day window.
  • Trace: one slow request spends 4.5 seconds waiting for a DB connection and 50ms executing SQL.
  • That trace points toward pool contention or connection ownership, not immediately a slow SQL plan.

Interview point:

  • Alert on meaningful user impact or exhausted error budget, not every transient resource fluctuation.
Adapted from 08_PERFORMANCE_SECURITY.md · “Logs vs metrics vs traces, and SLI vs SLO?”. Code examples are study fragments. Difficulty and core labels are editorial estimates; version-specific behavior should be checked against your project.