Nothing erodes engineering morale faster than an on-call rotation drowning in Slack alerts that mean nothing, followed by a real customer outage nobody noticed until support tickets piled up. Most monitoring setups fail because they track machine symptoms ("CPU over 75% for 3 minutes") instead of customer experience ("5% of checkout requests timed out over the last 5 minutes").
When managing 300+ WordPress sites at server level for a Finnish partner alongside multi-tenant APIs across 170+ delivered projects, Prometheus and Grafana consistently proved to be the most reliable observability backbone—provided you discipline your label cardinality and route alerts strictly through actionable SLO thresholds.
Measure What Users Feel: RED Metrics and Queue Age
Before importing fifty community Grafana dashboards, instrument four signals that immediately expose 90% of production incidents:
- Rate: Requests per second broken down by service and normalized route pattern.
- Errors: HTTP 5xx responses, failed database transactions, and unhandled worker exceptions.
- Duration: Request latency histograms (
p50,p95,p99), never simple averages (an average hides a broken 12-second tail). - Queue oldest-item age: Not just queue length, because 500 fast jobs clear in two seconds while 50 stalled billing jobs mean your workers are deadlocked.
Expose Clean Histograms From Your Application
Use coarse, normalized route templates (/orders/:id, not /orders/89421) and keep histogram buckets aligned with your user-facing latency SLA:
var httpRequestDuration = prometheus.NewHistogramVec(
prometheus.HistogramOpts{
Namespace: "api",
Name: "http_request_duration_seconds",
Help: "HTTP request latency distribution by normalized route and status class.",
Buckets: []float64{0.025, 0.05, 0.1, 0.25, 0.5, 1.0, 2.5, 5.0},
},
[]string{"method", "route", "status_class"},
)
Using status_class (2xx, 4xx, 5xx) instead of every individual HTTP code keeps label permutations tiny while giving you immediate error-budget math.
Guard Against Cardinality Explosions
Prometheus stores active time series in an in-memory head block and flushes chunks to disk. If an engineer accidentally attaches tenant_id, email, or full query strings as a metric label across 50,000 customers, active series jump from 10,000 to tens of millions—crashing the Prometheus server right when you need graphs during a spike.
Follow a strict split between telemetry types:
- Metrics (Prometheus): Bounded labels only (
service,route,queue,status_class,region). Keep total combinations per metric under a few thousand. - Logs & Traces (Loki / Tempo / OpenTelemetry): High-cardinality context (
tenant_id,user_id,request_id, SQL bind parameters).
If you ever need per-tenant metrics for top enterprise accounts, track a synthetic tenant_tier label (enterprise, pro, free) in Prometheus and rely on structured logs for exact tenant attribution.
Configure Reliable Scrape Targets and Exporters
Combine white-box application metrics with targeted infrastructure exporters in prometheus.yml:
global:
scrape_interval: 15s
evaluation_interval: 15s
rule_files:
- /etc/prometheus/rules/*.yml
alerting:
alertmanagers:
- static_configs:
- targets: ["alertmanager.internal:9093"]
scrape_configs:
- job_name: "saas-api"
metrics_path: /metrics
scrape_timeout: 10s
static_configs:
- targets: ["api-1.internal:9100", "api-2.internal:9100"]
- job_name: "postgres-exporter"
static_configs:
- targets: ["db-primary.internal:9187"]
- job_name: "redis-exporter"
static_configs:
- targets: ["redis-1.internal:9121"]
Pair this with pg_stat_statements on PostgreSQL and queue depth metrics from Redis—see our scaling background jobs and queues guide for the exact queue metrics worth exporting—plus backup freshness timestamps from automated PostgreSQL backups.
Write Symptom-Based Alerts That Respect Engineers' Sleep
Every page sent to an engineer at 2:30 AM must require immediate human intervention and link directly to a runbook. Put everything else on a morning ticket or dashboard.
| Alert Condition | Page On-Call Immediately? | Better Routing |
|---|---|---|
| CPU > 85% for 2 minutes | No | Informative dashboard panel only |
| 5xx error ratio burns > 2% of monthly SLO in 1 hour | Yes | High-severity page (PagerDuty / Opsgenie) |
| Critical queue oldest job > 10 minutes | Yes | High-severity page + worker restart runbook |
| Disk usage > 80% (projected full in < 48h) | Business hours | Slack/ticket to infra channel |
| Backup job failed or > 26 hours since last WAL | Business hours (or urgent if primary) | Infra alert with restore-drill check |
Multi-Window Error Budget Burn Rules
Instead of fragile static thresholds that miss slow leaks or flap during brief blips, define PromQL recording and alerting rules against your monthly availability target (for example, 99.9% = 0.001 error budget):
groups:
- name: api_slo_alerts
rules:
- record: job:http_errors_ratio:rate5m
expr: |
sum(rate(api_http_requests_total{status_class="5xx"}[5m]))
/
sum(rate(api_http_requests_total[5m]))
- alert: ApiErrorBudgetFastBurn
expr: |
job:http_errors_ratio:rate5m > (14.4 * 0.001)
and
sum(rate(api_http_requests_total{status_class="5xx"}[1h]))
/
sum(rate(api_http_requests_total[1h])) > (14.4 * 0.001)
for: 2m
labels:
severity: critical
annotations:
summary: "API 5xx error rate burning 30-day SLO at 14.4x pace"
runbook: "https://internal.example.com/runbooks/api-5xx-burn"
Requiring both a 5-minute window and a 1-hour window to breach the threshold guarantees you catch catastrophic outages within minutes while suppressing 30-second transient blips automatically. You can study more cloud-native observability patterns from the CNCF blog and GitHub Engineering.
Design Grafana Dashboards for 60-Second Triage
A useful Grafana dashboard answers two questions in under one minute during an outage: is the problem inside our code, our database, or an external vendor—and did a recent deploy trigger it?
Structure your main service board top-to-bottom as a triage funnel:
- Row 1 (Impact): Overall request rate, 5xx error percentage, and
p95/p99latency with Git deploy annotations overlaid vertically. - Row 2 (Dependencies): PostgreSQL active connections vs
max_connections, lock waits, Redis hit ratio and memory fragmentation, and outbound third-party API latency/429 rates. - Row 3 (Background Capacity): Queue oldest-job age, retry rate, and dead-letter queue count.
Overlaying deploy markers directly on latency and error panels immediately removes guesswork: when p99 triples at 14:22 and a deploy annotation sits at 14:21, you roll back first and debug afterward.
Putting Production Observability in Place With SmitDev
Whether you are a CTO replacing blind server logs ahead of an enterprise audit or stabilizing an existing system through our upgrade old software practice, SmitDev implements production Prometheus, Grafana, and Alertmanager stacks cleanly via Terraform and Ansible. You can bring on senior engineering capacity at $55/day for 8–9 hours of dedicated engineering work or $1,999/month for dedicated delivery, or engage us through remote software engineering.
Ready to stop finding out about outages from customer emails? Contact us with your current hosting setup and critical SLAs, and we will map out a practical monitoring rollout.