foundation18 min studyLesson 10 in Engineering

Observability: turn a symptom into a testable explanation

Use metrics, logs, traces, latency distributions, and disciplined hypotheses to debug systems without guessing.

On this page

What you’ll understand

  • Match metrics, logs, and traces to different diagnostic questions.
  • Distinguish rates, distributions, symptoms, and possible causes.
  • Use a queueing identity and controlled hypotheses without overclaiming causality.

A user says the application is slow. That is a symptom, not a diagnosis. Observability supplies evidence about what the system did, while debugging turns that evidence into testable explanations. Start with the affected user operation and its time window. Then narrow the problem with measurements that distinguish competing causes, rather than changing several components and hoping one helps.

Different signals reveal different views

Metrics summarize behavior as measurements over time: request counts, error fractions, durations, or queue depth. Logs record events with context. Traces connect spans of work across an operation's path, helping locate time spent in dependencies. These signals complement one another. A count can reveal a broad change without explaining one failed request; a trace can explain one path without representing every user's experience.

Choose labels and retained context carefully. A user ID on every metric can create an enormous number of distinct time series, while raw request bodies can expose private data. Prefer bounded dimensions for aggregate metrics and controlled, appropriate context for event investigation. Correlation identifiers can connect evidence across boundaries, but missing propagation, sampling, clock differences, and broken telemetry must be considered when interpreting gaps.

e=NfailedNeligiblee=\frac{N_{\rm failed}}{N_{\rm eligible}}
The error fraction is dimensionless and requires a defined eligible-request population and time window. Decide whether timeouts, cancellations, and partial failures count before comparing services or releases.↔ Scroll wide equations horizontally.

Latency is a distribution, not one number

An average can hide a slow minority. A latency percentile describes the value below which a specified fraction of observations falls under the chosen definition. Compare the median with higher percentiles and the request population behind them. A percentile from a quiet endpoint can be unstable, and averaging percentiles across machines does not generally produce the percentile of the combined requests. Aggregate the underlying distribution appropriately.

Traffic, latency, errors, and saturation are a useful starting set of service signals. Saturation concerns how close a resource is to an effective limit, which may involve queued work rather than just CPU utilization. A machine can have low CPU usage while waiting on storage. A growing queue may be the cause of added waiting time, or a symptom of a slower downstream service; the signals need a causal investigation.

L=λWL=\lambda W
Little's law relates long-run average in-system jobs L, effective arrival rate lambda in jobs per second, and average time W in seconds for a stable system with consistent boundaries. It is not a percentile formula or a guarantee during an unbounded transient backlog.↔ Scroll wide equations horizontally.

Debug with competing hypotheses

Write a concrete observation: the high-percentile duration of successful inference requests increased after a particular release while traffic stayed roughly similar. Propose alternatives, such as larger inputs, reduced batching efficiency, a slow dependency, or resource contention. Identify a measurement that separates them. A temporal correlation suggests where to look; it does not establish that the release caused the change or explain its mechanism.

Prefer reversible, bounded investigations and preserve evidence before it disappears. Compare versions, inspect representative traces, and change one relevant variable when practical. The queue lab shows fluid backlog starting at four jobs and changing at arrival rate minus service rate, clipped at zero. Its separately labeled M/M/1 mean assumes independent Poisson arrivals, exponential service times, one server, and arrival rate below service rate. Neither is a fitted production forecast. Pause and define which jobs your real measurements count before applying Little's law to a dashboard.

Check a concurrency measurement

A stable inference service completes an average of 120 requests per second. Across the same boundary and observation period, average end-to-end time is 0.25 seconds.

  1. Confirm the population and boundary: requests are counted from admission to response, including waiting within that boundary. The system is stable over a sufficiently representative window.

  2. Apply Little's law: 120 requests per second × 0.25 seconds gives an average of 30 requests in the system. This includes waiting and active work, not simply worker count.

  3. If a dashboard reports 300 in-flight requests for the same period, investigate mismatched boundaries, unfinished work, retries, nonstationary backlog, or faulty instrumentation before declaring the mathematical identity broken.

The result

The consistent estimate is 30 average in-system requests. It does not determine the 99th-percentile latency or prove that 30 workers are required.

Explore the model

Interactive lab

Interactive lab · queue

Observe arrivals, service, and backlog

Change arrival rate λ and service rate μ for fluid backlog max(0,4+(λ−μ)t). Contrast it with the separate stable M/M/1 mean and its stochastic assumptions. Neither readout estimates production percentiles.

Observe arrivals, service, and backlogFluid backlog starts at 4 and follows max(0, 4 + (λ − μ)t). The separate M/M/1 residence-time formula assumes Poisson arrivals, exponential service and λ < μ. Current readings: Fluid backlog: 4; Net rate · λ − μ: −1 /s; M/M/1 mean residence: 1 s. All parameters are adjustable with the labeled controls below.02.557.51001.534.56Elapsed time · sFluid backlogλ < μ
Fluid backlogCurrent time
Fluid backlog
4
Net rate · λ − μ
−1 /s
M/M/1 mean residence
1 s
t = 0 s

Fluid backlog starts at 4 and follows max(0, 4 + (λ − μ)t). The separate M/M/1 residence-time formula assumes Poisson arrivals, exponential service and λ < μ. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forUse consistent populations and stable averages before connecting throughput, concurrency, and time.

Check your understanding

A service has low average CPU usage and high request latency. What follows?

Try it yourself

A stable service admits 40 jobs per second, and jobs spend an average of 1.5 seconds inside the measured boundary. Estimate average in-system jobs and state one limitation.

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Multiply a rate by a duration, checking that the same jobs and boundary are used.

Compare with the solution

Little's law gives 40 × 1.5 = 60 jobs on average. It does not reveal the tail of the latency distribution, and it must not be applied blindly to inconsistent populations or a backlog growing without bound. Active worker count can be smaller than 60 because some jobs are waiting.

Take it with you

  • Metrics, logs, and traces answer complementary questions.
  • Define populations and distributions before interpreting a dashboard.
  • Use hypotheses and consistent boundaries to turn correlations into evidence.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.