Skip to content
$ lynuxpro
← Monitoring with Prometheus, Grafana & Datadog

LESSON 1 OF 18 · BEGINNER · 13 MIN

Observability fundamentals

Free previewLesson 1 of the 2 free lessons in this Pro course.Unlock all 18

HOW IT WORKSThree pillars, one question

Something is wrongbut what?Metricsis it bad?Logswhat happened?Traceswhere is it slow?The cause
1/5

A user says the site is slow. You need to find out why.

In simple words

  • Monitoring: watching known numbers, such as CPU or error count, and alerting when they cross a line.
  • Observability: being able to ask new questions about a system from its outputs, to find out why something happened.
  • Three pillars: metrics (numbers over time), logs (event records) and traces (the path of one request).
  • Four golden signals: latency, traffic, errors and saturation: the first things to watch for any service.

Big picture

Your app is running. Is it healthy? Is it fast? Why did it break at 3 a.m.? Observability is how you answer those questions from the outside, using the data your systems give out.

Think of a car. The dashboard shows speed, fuel and engine heat. When a warning light comes on, a mechanic plugs in a tool and reads detailed reports. Your software needs both: a quick dashboard and detailed reports.

Monitoring or observability?

WordPlain meaningQuestion it answers
MonitoringWatching known signs and alerting when they go bad"Is something wrong?"
ObservabilityHaving enough data to find out why, even for problems you never expected"Why is it wrong?"

You need both. Monitoring wakes you up. Observability helps you fix it.

The three pillars

PillarWhat it isAnalogyExample
MetricsNumbers measured over timeThe speedometerCPU is 73%, 120 requests per second
LogsText records of eventsThe ship's diaryERROR payment failed for order 812
TracesThe path of one request through many servicesA parcel tracking pageWeb -> API -> database, 340 ms total
  • Metrics are cheap and good for spotting trouble.
  • Logs give the details of one event.
  • Traces show where the time went.

The four golden signals

Google's SRE book says that if you can only watch four things for a service, watch these:

SignalQuestionExample
LatencyHow long do requests take?95% finish in under 300 ms
TrafficHow much demand is there?800 requests per second
ErrorsHow many requests fail?0.4% return 5xx
SaturationHow full is the system?Disk is 91% full

A simple picture of the tools in this course

Your apps -> Prometheus (metrics) -> Grafana (dashboards)                        |-> Alertmanager (alerts to people)Your apps -> Loki (logs)Your apps -> OpenTelemetry -> trace store (traces)
OUTPUTterminalutf-8 · 4L

A first look

Many apps expose a health page you can check by hand:

curl -s localhost:8080/healthz
SHELLbashutf-8 · 1L
{"status":"ok","uptime_seconds":86412}
OUTPUTterminalutf-8 · 1L

A metrics page looks like plain text with one number per line:

curl -s localhost:8080/metrics | head -4
SHELLbashutf-8 · 1L
# HELP http_requests_total Total requests handled# TYPE http_requests_total counterhttp_requests_total{method="GET",code="200"} 10482http_requests_total{method="GET",code="500"} 7
OUTPUTterminalutf-8 · 4L

Prometheus reads this page every few seconds. You will build on this in the next lessons.

A story: finding the cause

It is 3 a.m. and an alert says "checkout is slow". Here is how the three pillars work together:

StepWhat you look atWhat you learn
1. The alertMetricsp95 latency went from 300 ms to 2.4 s at 02:51
2. Narrow it downMetrics by serviceOnly orders-service is slow. The others look normal
3. Look for cluesLogs of orders-serviceERROR db timeout order=812 appears again and again
4. Find the exact stepTraces of one slow requestThe postgres query span takes 1.9 s of the 2.4 s
5. Fix itYour changeAdd an index, or kill the long query

Notice the order: metrics find it, logs explain it, traces locate it. You will build each tool in this course.

Who uses what

PersonCares aboutLooks at
Developer"Why is my code slow?"traces, logs
On-call engineer"What is broken right now?"alerts, dashboards
Manager"Are we reliable?"SLO reports
Security"Who did what?"audit logs

Where to start

  1. Pick one service.
  2. Watch the four golden signals for it.
  3. Add one alert for the symptom users feel most.
  4. Add logs, then traces, when you need more detail.

Do not try to build everything on day one.

Common mistakes

  • Collecting everything and looking at nothing. Start with the golden signals.
  • Alerting on causes (CPU is high) instead of symptoms (users see errors).
  • Having dashboards nobody reads. Every dashboard should answer a question.
  • Treating logs as the only tool. Metrics are far cheaper for trends.

Summary

  • Monitoring says something is wrong. Observability helps you find out why.
  • The three pillars are metrics, logs and traces.
  • Start with the four golden signals: latency, traffic, errors, saturation.

CHECK YOUR UNDERSTANDING

3 quick questions

  1. 1. Which pillar shows the path of one request through many services?

  2. 2. Which is NOT one of the four golden signals?

  3. 3. What is the main difference between monitoring and observability?