You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
Grafana is an open-source visualisation and analytics platform that turns your metrics, logs, and traces into interactive dashboards. It connects to dozens of data sources — Prometheus, Loki, Elasticsearch, InfluxDB, PostgreSQL, and many more — making it the most popular observability frontend.
| Concept | Description |
|---|---|
| Dashboard | A collection of panels arranged on a canvas |
| Panel | A single visualisation (graph, stat, table, heatmap, etc.) |
| Data source | A connection to a backend (Prometheus, Loki, etc.) |
| Query | A request for data from a data source (e.g., a PromQL expression) |
| Variable | A dynamic value (dropdown) that parameterises dashboard queries |
| Alert | A condition on a panel that triggers notifications |
| Annotation | A marker on a graph (e.g., deployment events) |
version: '3.8'
services:
grafana:
image: grafana/grafana:latest
ports:
- "3000:3000"
volumes:
- grafana-data:/var/lib/grafana
environment:
- GF_SECURITY_ADMIN_PASSWORD=secret
prometheus:
image: prom/prometheus:latest
ports:
- "9090:9090"
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
volumes:
grafana-data:
After starting, navigate to http://localhost:3000 and log in with admin / secret.
http://prometheus:9090Grafana supports many data sources out of the box:
| Data Source | Type |
|---|---|
| Prometheus | Metrics |
| Loki | Logs |
| Tempo | Traces |
| Elasticsearch | Logs, Metrics |
| InfluxDB | Metrics |
| PostgreSQL | SQL |
| CloudWatch | AWS Metrics |
Each panel runs a query against a data source and renders the result:
# Request rate
rate(http_requests_total{job="api"}[5m])
# Error rate percentage
100 * sum(rate(http_requests_total{status=~"5.."}[5m])) / sum(rate(http_requests_total[5m]))
# 95th percentile latency
histogram_quantile(0.95, sum(rate(http_request_duration_seconds_bucket{job="api"}[5m])) by (le))
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.