Prometheus scrapes metrics from HTTP endpoints, stores them as time series, and lets you query and alert on them with PromQL - the backbone of Kubernetes-era monitoring.
Why teams use it
- Pull-based scraping with service discovery fits dynamic infrastructure
- PromQL makes rich, dimensional queries and alerts possible
- A huge ecosystem of exporters for almost everything
Install it
docker run -p 9090:9090 -v $PWD/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus
# open http://localhost:9090A first working config
Scrape config plus an alert rule.
# prometheus.yml
scrape_configs:
- job_name: app
static_configs: [{ targets: ['app:3000'] }]
---
# rules.yml
groups:
- name: app
rules:
- alert: HighErrorRate
expr: rate(http_requests_total{status=~"5.."}[5m]) > 0.05
for: 10m
labels: { severity: page }
annotations: { summary: "5xx error rate above 5%" }Run and verify
Useful PromQL queries.
# 95th percentile latency
histogram_quantile(0.95, sum(rate(http_request_duration_seconds_bucket[5m])) by (le))
# error ratio
sum(rate(http_requests_total{status=~"5.."}[5m])) / sum(rate(http_requests_total[5m]))Mistakes to avoid early
- High-cardinality labels (user IDs, request IDs) exploding memory
- Treating Prometheus as long-term storage without Thanos/Cortex
- Alerting on raw values instead of rates/ratios tied to user impact
Want senior help putting Prometheus to work - or a team bootcamp on it? CodeWizard runs Israel's largest DevOps community and embeds named senior engineers with a transparent hours log. Book a free consult or explore the Academy.