Dashboard Configuration
SLOzy ships with Prometheus and Grafana for observability. This page covers how to configure, provision, and customise dashboards.
Grafana Provisioning
The docker-compose.yml mounts provisioning directories for automatic dashboard loading:
volumes:
- ./grafana/provisioning:/etc/grafana/provisioning
- ./grafana/dashboards:/var/lib/grafana/dashboardsGrafana loads datasources and dashboards from these mounted paths at startup. To add a new dashboard, place a JSON file in grafana/dashboards/ and restart Grafana.
Datasource Provisioning
Create grafana/provisioning/datasources/prometheus.yaml:
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
access: proxy
url: http://prometheus:9090
isDefault: trueDashboard Provisioning
Create grafana/provisioning/dashboards/slozy.yaml:
apiVersion: 1
providers:
- name: SLOzy
type: file
options:
path: /var/lib/grafana/dashboardsRecommended Dashboards
1. SLO Burn-Rate Overview
Track error budget consumption and burn rate for all SLOs.
| Panel | Query | Description |
|---|---|---|
| SLO Status | slo_status | Current status per SLO (OK / warning / critical) |
| Error Budget | 1 - (slo_error_budget_consumed) | Remaining error budget percentage |
| Burn Rate | rate(slo_error_budget_consumed[5m]) | Current rate of budget consumption |
| Time to Exhaustion | slo_error_budget_remaining / rate(slo_error_budget_consumed[1h]) | Hours until budget depleted |
2. Application Performance
Monitor request rate, latency, and error rate for the SLOzy API.
| Panel | Query | Description |
|---|---|---|
| Request Rate | rate(http_requests_total[5m]) | Requests per second |
| Latency P95 | histogram_quantile(0.95, rate(http_request_duration_seconds_bucket[5m])) | 95th percentile latency |
| Latency P99 | histogram_quantile(0.99, rate(http_request_duration_seconds_bucket[5m])) | 99th percentile latency |
| Error Rate | rate(http_requests_total{status=~"5.."}[5m]) / rate(http_requests_total[5m]) | Percentage of 5xx responses |
3. Database
| Panel | Query | Description |
|---|---|---|
| Active Connections | pg_stat_database_numbackends | Current connections to slozy_db |
| Cache Hit Ratio | rate(pg_stat_database_blks_hit[5m]) / (rate(pg_stat_database_blks_hit[5m]) + rate(pg_stat_database_blks_read[5m])) | Buffer cache efficiency |
4. Host & Containers (pre-installed)
A comprehensive infrastructure dashboard showing host and container metrics from node_exporter and cAdvisor. Located at grafana/dashboards/host-overview.json.
| Panel | Query | Description |
|---|---|---|
| CPU Usage | 100 - avg(rate(node_cpu_seconds_total{mode="idle"}[$__rate_interval])) * 100 | Host CPU utilisation gauge |
| Memory Usage | (1 - node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes) * 100 | Host RAM utilisation gauge |
| Disk Usage | (1 - node_filesystem_free_bytes{mountpoint="/"} / ...) * 100 | Root partition usage gauge |
| Uptime | time() - node_boot_time_seconds | Host uptime |
| Container CPU | sum(rate(container_cpu_usage_seconds_total{...} [$__rate_interval])) by (container_label_com_docker_compose_service) | Per-container CPU |
| Container Memory | sum(container_memory_usage_bytes{...}) by (container_label_com_docker_compose_service) | Per-container memory |
| Container Network | sum(rate(container_network_receive_bytes_total{...} [$__rate_interval])) by (container_label_com_docker_compose_service) | Per-container network traffic |
Alerting from Grafana
Grafana can send alerts to Slack, email, Telegram, or PagerDuty. Configure notification channels in:
- UI: Configuration > Notification Channels
- Provisioning:
grafana/provisioning/notifiers/
Example Slack notifier:
apiVersion: 1
notifiers:
- name: Slack
type: slack
uid: slack-notifier
settings:
url: https://hooks.slack.com/services/YOUR/WEBHOOK/URLAccess
- Development: Grafana runs at
http://localhost:3001(default credentialsadmin/admin) - Production: Expose Grafana behind Nginx with TLS and authentication. Consider using Grafana's built-in OAuth or LDAP integration.
The SLOzy application itself does not serve dashboards — all visualisation is done through Grafana using Prometheus as the data source. To customise the dashboards, edit the JSON files in grafana/dashboards/ and redeploy.