SOFTWARE ARCHITECTURE / SYSTEM CONCEPT BRIEF

Observability

Observability is the ability to understand what a system is doing internally from the data it produces, so you can answer new questions about failures without shipping new code.

IntermediatePhase 08 / Topic 10 of 17RequirementsTrade-offsFailure modes
01

Overview

Observability is the ability to understand what a system is doing internally from the data it produces, so you can answer new questions about failures without shipping new code. Its three pillars are metrics (numeric time series such as request rate and latency), logs (timestamped event records), and traces (the path of one request across services, broken into spans).

Good observability ties these together with shared context (trace IDs in logs, exemplars in metrics), defines SLIs and SLOs for user-facing behavior, alerts on symptoms users feel rather than every cause, and supports fast debugging with dashboards and distributed tracing. OpenTelemetry has become the standard for instrumenting applications across vendors.

A car's dashboard, trip log, and GPS track

The dashboard gauges (metrics) show speed and fuel at a glance. The trip log (logs) records notable events. The GPS track (trace) shows exactly which roads one journey took and where it slowed down.

02

When to use it

  • Every production service.
  • Debugging latency and errors across microservices.
  • Defining SLOs and alerting.
  • Capacity planning and performance tuning.
03

Where it shows up in interviews

Monitoring design

Recognize it when: how will you know it is working?

  • Design monitoring for a payment system
  • Design an observability platform
Debugging distributed latency

Recognize it when: requests are slow, but which service?

  • Diagnose slow checkout in microservices
04

Where it is used in real software

OpenTelemetry

CNCF standard APIs, SDKs, and collector for metrics, logs, and traces, supported by most vendors.

Prometheus and Grafana

Widely used open-source metrics and dashboards.

Jaeger, Tempo, Datadog, Honeycomb

Tracing backends for following requests across services.

05

Key terms

Metrics
Aggregated numbers over time (counters, gauges, histograms).
Logs
Discrete event records, ideally structured JSON.
Traces and spans
Request path across services; each span is one operation.
RED / USE
Rate, errors, duration for services / utilization, saturation, errors for resources.
Cardinality
Number of unique label combinations; high cardinality is costly for metrics.
06

How it works, step by step

  1. 1
    Instrument with OpenTelemetry

    Auto-instrument HTTP, DB, and messaging clients.

  2. 2
    Emit RED metrics per endpoint

    Rate, errors, latency histograms.

  3. 3
    Use structured logs with trace IDs

    Correlate logs with traces.

  4. 4
    Propagate trace context

    traceparent header across services and messages.

  5. 5
    Define SLOs and alert on burn rate

    Page on user impact, not on every blip.

A distributed trace for GET /checkout
Step 1 / 4
Gateway 5 ms
Checkout 420 ms
Cart 12 ms
Pricing 35 ms
Payments 360 ms
DB 8 ms

STEP 1The trace starts at the gateway; total latency is 420 ms.

07

Three pillars compared

What each is best at

Step 1 / 3
SignalAnswersCost driverExample
MetricsIs something wrong? How much?Label cardinalityp99 latency of /checkout = 850 ms
LogsWhat exactly happened?Volumepayment declined: insufficient_funds
TracesWhere is the time going?Sampling ratePayments span 360 ms of 420 ms

NOWSignal: Metrics | Answers: Is something wrong? How much? | Cost driver: Label cardinality | Example: p99 latency of /checkout = 850 ms

Metrics detect, traces locate, logs explain. Linking them via trace IDs makes debugging fast.

08

Implementation

import { NodeSDK } from "@opentelemetry/sdk-node";import { getNodeAutoInstrumentations } from "@opentelemetry/auto-instrumentations-node";import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";import { trace } from "@opentelemetry/api"; new NodeSDK({  serviceName: "checkout",  traceExporter: new OTLPTraceExporter({ url: process.env.OTEL_EXPORTER_OTLP_ENDPOINT }),  instrumentations: [getNodeAutoInstrumentations()], // HTTP, Express, pg, Redis, Kafka...}).start(); const tracer = trace.getTracer("checkout"); export async function checkout(cartId: string) {  return tracer.startActiveSpan("checkout.process", async (span) => {    span.setAttribute("cart.id", cartId);    try {      const result = await processCart(cartId);      logger.info({ cartId, traceId: span.spanContext().traceId }, "checkout completed"); // correlated log      return result;    } catch (err) {      span.recordException(err as Error);      throw err;    } finally {      span.end();    }  });}
09

Complexity and performance

Trace sampling1-10% typical

Tail sampling keeps errors and slow traces.

Metric seriesLabels multiply

Avoid user IDs as labels.

10

Trade-offs

Visibility vs cost

Full logs and 100% traces are expensive at scale; sample traces, sample or aggregate logs, and control metric cardinality.

Alert sensitivity

Too many alerts cause fatigue; SLO burn-rate alerts focus on user impact.

11

Variants and related techniques

Continuous profiling

Always-on CPU and memory profiles (Pyroscope, Parca).

Real user monitoring

Front-end performance and errors from real browsers.

12

Common mistakes

  • Unstructured logs.

    Fix: Use JSON with consistent fields and trace IDs.

  • High-cardinality metric labels.

    Fix: User or request IDs belong in logs and traces, not metric labels.

  • Alerting on causes (CPU 80%).

    Fix: Alert on symptoms (error rate, latency SLO burn).

  • Logging secrets or personal data.

    Fix: Redact sensitive fields.

13

Interview questions

What is the difference between monitoring and observability?

Monitoring tracks known conditions with predefined dashboards and alerts; observability is the broader ability to ask new questions of the system using rich telemetry (metrics, logs, traces) to understand unknown failure modes.

How do you find which service causes slow requests?

Use distributed tracing: each request carries a trace ID across services, and the trace waterfall shows which span dominates latency; then drill into that service's metrics and correlated logs.

14

Practice problems

ProblemDifficultyWhat it trains
Define SLIs and SLOs for an APIEasyUser-facing indicators.
Instrument a service with OpenTelemetryMediumTraces and correlation.