What is Prometheus?
Prometheus is a metrics collection system with a time-series database. It pulls (scrapes) metrics from targets on a fixed interval.
Application / Exporter
↓ /metrics
Prometheus scrapes
↓
Time-series DB
↓
Grafana
Targets & exporters
Targets are things Prometheus monitors (Node.js app, Linux host, Redis, Postgres).
Exporters expose Prometheus-format metrics for systems that do not natively speak Prometheus.
| Exporter | Purpose |
|---|---|
| Node Exporter | Linux host metrics |
| Redis Exporter | Redis |
| MySQL / Postgres exporters | Databases |
docker run -d --name=node-exporter -p 9100:9100 prom/node-exporter
curl http://localhost:9100/metrics | headScraping
Scraping = repeatedly HTTP-GETting /metrics and storing samples.
# prometheus/prometheus.yml
global:
scrape_interval: 15s
scrape_configs:
- job_name: "prometheus"
static_configs:
- targets: ["localhost:9090"]
- job_name: "node"
static_configs:
- targets: ["<APP_IP>:9100"]Restart or reload Prometheus after edits, then confirm the target is UP in Status → Targets.
Metric types
| Type | Behaviour | Examples |
|---|---|---|
| Counter | Only increases | Total requests, total errors |
| Gauge | Up or down | CPU usage, active users |
| Histogram | Distribution / buckets | API latency |
| Summary | Client-side quantiles | p95 / p99 latency |
Labels (dimensions)
Labels add dimensions so one metric can be sliced many ways:
http_requests_total{method="GET", route="/products", status="200"} 1200
http_requests_total{method="POST", route="/orders", status="500"} 14
Without labels you only know “1547 requests”. With labels you know which route and status.
Keep label cardinality under control — high-cardinality labels (user IDs, raw URLs) can explode series count and cost.