What is Grafana?
Grafana is a visualization and dashboard tool for metrics, logs, and alerts.
Node Exporter / App
↓
Prometheus
↓
Grafana → Dashboards & Alerts
Companies use it for CPU, memory, API errors, response time, active users, and business KPIs.
Add Prometheus datasource
- Open
http://<host>:3000(defaultadmin/ your password) - Connections → Data sources → Add Prometheus
- URL:
http://prometheus:9090(Docker network) orhttp://localhost:9090 - Save & test
Create a dashboard
- Dashboards → New → Add visualization
- Select Prometheus
- Enter PromQL (for example
rate(http_requests_total[1m])) - Set panel title, legend, unit
- Save dashboard
Useful starter panels
| Panel | Query idea |
|---|---|
| Request rate | sum(rate(http_requests_total[1m])) |
| Error rate | sum(rate(http_requests_total{status=~"5.."}[1m])) |
| CPU | Node Exporter CPU PromQL |
| Memory available % | MemAvailable / MemTotal * 100 |
Import community dashboards
Grafana.com has Node Exporter dashboards (for example ID 1860). Import → paste ID → select Prometheus datasource.
p95 and p99
Percentiles describe latency distribution:
| Percentile | Meaning |
|---|---|
| p95 | 95% of requests faster than this |
| p99 | 99% of requests faster than this |
Averages hide tail latency — p95/p99 show what slow users feel. Histograms + histogram_quantile() are the usual Prometheus approach.
Node.js app dashboard ideas
Once the app exposes /metrics (next lesson):
- Requests / second by route
- 5xx rate
- In-flight requests
- Latency histogram (p95)
Organize dashboards by audience: infra (CPU/RAM/disk), app (RPS/errors/latency), business (orders, signups).