TExcelTAD

What Observability Is

A service in production is a black box until you give it windows. Observability is how well you can answer questions about a running system from the outside, using only what it emits, including questions you didn't think of when you wrote it. "Is it up?" is monitoring. "Why are 2% of redirects for short codes created yesterday slow, but only on one node?" is observability.

You have met the ideas already: the Kubernetes observability lesson showed kubectl logs, kubectl top and events, and System Design: Observability introduced RED, USE, structured logs and tracing as design concepts. This course is the hands-on version: you run the real tools, write the queries, and test the alerts.

The three signals

Signal What it is Good at Tool in this course
Metrics numbers sampled over time, with labels: http_requests_total{code="500"} 37 trends, rates, alerting, cheap long-term storage Prometheus, PromQL
Logs timestamped records of individual events the details of one request or error Loki, LogQL, Alloy, Fluent Bit
Traces the path of one request through every service it touched, as a tree of timed spans where the time went, which dependency failed OpenTelemetry, Jaeger, Tempo

Each answers a different question, and a good investigation moves between them: an alert fires on a metric (error rate above 5%), a dashboard narrows it down (only POST /links, only since the last deploy), a trace of a failing request shows the database call timing out, and the logs of that request show the exact error. The tools in this course link the three with shared labels (service, env) and IDs (trace_id in log lines, exemplars on metrics).

Two more signals are worth knowing by name: events (deploys, config changes, Kubernetes events: "what changed?") and continuous profiles (CPU and memory flame graphs over time, e.g. Grafana Pyroscope). They come up in the Toolkit.

Monitoring vs observability

Monitoring Observability
known failure modes: "disk > 90%", "process down" unknown ones: "why is this slow for these users?"
dashboards and checks decided in advance ad-hoc queries over rich, high-dimensional data
tells you that something is wrong helps you find why

You need both. Monitoring is the alerting layer on top; observability is what you use once the pager has gone off.

The stack you will build

text
  linkly (Go API)  ──metrics /metrics──▶  Prometheus ──alerts──▶ Alertmanager ──▶ Slack / PagerDuty
        │  └──── OTLP traces ──▶ OpenTelemetry Collector ──▶ Tempo / Jaeger
        └── JSON logs on stdout ──▶ Grafana Alloy ──▶ Loki
                                                     ╲
                     Grafana: dashboards over Prometheus, Loki and Tempo, plus its own alerting

The running example is linkly, the link shortener of the DevOps Capstone: POST /links stores a short code in PostgreSQL, GET /{code} redirects (with Redis as a cache), and /metrics, /healthz and /readyz serve Prometheus and Kubernetes. By the Mini Project you will have its metrics, a dashboard, alerts with unit tests, and log and trace pipelines.

A first taste

Everything here is a real session. This one checks an alert rule for linkly with promtool, the tool that ships with Prometheus:

bash · try it yourself
cat > linkly-rules.yml <<'YML'
groups:
  - name: linkly
    rules:
      - alert: LinklyHighErrorRate
        expr: |
          sum(rate(http_requests_total{job="linkly", code=~"5.."}[5m]))
            / sum(rate(http_requests_total{job="linkly"}[5m])) > 0.05
        for: 5m
        labels:
          severity: page
        annotations:
          summary: "linkly is failing {{ $value | humanizePercentage }} of requests"
YML
promtool check rules linkly-rules.yml
Checking linkly-rules.yml
  SUCCESS: 1 rules found

The next lesson explains how the sessions work, and the Rules & Alerting section takes this rule apart.

What you need first

  • Linux administration: services, journalctl, ports and processes (Linux Server Administration).
  • Kubernetes basics: Pods, Deployments, Services, labels (Kubernetes), because most of the deployment examples target a cluster.
  • Reading a little Go and Python helps; the instrumentation examples use both.

After this course, Site Reliability Engineering builds SLOs, burn-rate alerts and incident practice on top of what you learn here.

Test yourself

Which signal answers "which downstream call made this one request slow?" best?

  1. Metrics
  2. Logs
  3. Traces
  4. Kubernetes events

What distinguishes observability from classic monitoring?

  1. It only uses logs
  2. It lets you ask new questions about unknown failure modes from the data a system emits
  3. It replaces alerting
  4. It needs no instrumentation

What links metrics, logs and traces during an investigation?

  1. Nothing, they are separate tools
  2. Shared labels such as service and env, and IDs such as trace_id in log lines and exemplars
  3. The scrape interval
  4. Grafana's theme