What you will learn
- Understand metric types
- Write PromQL
- Instrument an app
New to this? Start here
The basics, in plain English
Metrics are simple numbers your system reports over time, like temperature readings for software. Prometheus is a popular free tool that regularly collects these numbers and stores them so you can graph and alert on them. Watching metrics tells you if things are getting slower or busier.
- Metric
- A number measured repeatedly over time, such as memory used or error count.
- Prometheus
- A widely used open-source tool that gathers and stores metrics.
- Scrape
- When Prometheus reaches out and pulls the current numbers from your app.
- Time series
- A list of values for one metric stamped with the time each was recorded.
- Counter vs gauge
- A counter only goes up (total requests); a gauge can go up or down (current users).
- Query
- Asking the metrics store a question, like “what was CPU usage last hour”.
01
Pull-based metrics
Prometheus scrapes metrics endpoints. Counters, gauges, and histograms cover most needs. PromQL queries and aggregates them.
Try it yourself
promql
rate(http_requests_total[5m])↳Per-second request rate, averaged over the last 5 minutes.histogram_quantile(0.95, sum(rate(latency_bucket[5m])) by (le))↳The 95th-percentile latency from a histogram metric.↳ lines explain what each command does — only the commands get copied
Finished this topic?
Mark it done to earn 100 XP and keep your streak alive.