Prometheus
In one line
Prometheus is an open-source monitoring and alerting system that collects metrics as time-series data using a pull model.
In simple words
Prometheus is the most popular monitoring system in the DevOps world. It collects and stores metrics as time-series data — each data point has a timestamp and a value, identified by a metric name and labels.
Prometheus uses a pull model: it actively scrapes metrics from your applications at regular intervals (usually 15 seconds). Your application needs to expose a /metrics endpoint in the Prometheus format. Many libraries exist to help with this.
Prometheus has its own query language called PromQL that lets you filter, aggregate, and calculate metrics. It also has a built-in alerting system — you define alert rules in YAML, and when a rule fires, it sends alerts to an Alertmanager which routes them to Slack, email, etc.
Example
# Alert rule example
groups:
- name: example
rules:
- alert: HighCPUUsage
expr: rate(cpu_seconds_total[5m]) > 0.8
for: 5m
labels:
severity: warning
annotations:
summary: "CPU usage above 80% for 5 minutes"This alert fires when CPU usage exceeds 80% for 5 minutes continuously.
How it works
- Applications expose metrics at a /metrics endpoint.
- Prometheus scrapes these endpoints at configured intervals.
- Metrics are stored in Prometheus's time-series database.
- You query with PromQL and set up alert rules that fire when conditions are met.
Common confusions
Confused with: Grafana
The difference: Prometheus collects and stores metrics; Grafana visualizes them. They work together — Prometheus is the data source, Grafana is the dashboard.
Related terms
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.