Observability & SRE··2 min read

Stopping Alert Fatigue: How We Rebuilt Our Observability Stack with Prometheus, Grafana, and Loki

Shafikul Islam

Shafikul Islam

Backend & Cloud Infrastructure Engineer · Infrastructure & Cloud Team Lead

Stopping Alert Fatigue: How We Rebuilt Our Observability Stack with Prometheus, Grafana, and Loki

Why Paging on Raw CPU Spikes Destroys On-Call Engineers

In many growing backend teams, the #alerts channel fires 40 to 60 times a day: "Node 3 CPU > 80% for 2 minutes", "Pod memory > 75%", "Disk I/O spike". Because 95% of those alerts resolve themselves when a background job finishes, engineers mentally mute the channel - until a real database deadlock silently drops checkout traffic for 25 minutes.

When we overhauled our observability stack using Prometheus, Grafana, Loki, and Alertmanager, we enforced a simple rule: never page a human unless user-facing SLOs are degrading or capacity will exhaust within 4 hours.


1. Alerting on Multi-Window Error Budget Burn Rates

A 90-second CPU spike during a nightly report job is not an incident. A sustained rise in HTTP 5xx responses or P95 latency above 500ms is.

We replaced noisy threshold alerts with Prometheus symptom alerts that only fire when both short-window (5m) and medium-window (30m) error rates breach our SLO threshold:

groups:
  - name: slo-api-availability
    rules:
      - alert: HighApi5xxErrorRateBurn
        expr: |
          (
            sum(rate(http_requests_total{status=~"5..", job="core-api"}[5m]))
            /
            sum(rate(http_requests_total{job="core-api"}[5m]))
          ) > 0.01
          and
          (
            sum(rate(http_requests_total{status=~"5..", job="core-api"}[30m]))
            /
            sum(rate(http_requests_total{job="core-api"}[30m]))
          ) > 0.005
        for: 3m
        labels:
          severity: critical
        annotations:
          summary: "Core API 5xx error rate exceeds 1% SLO burn"
          runbook_url: "https://shafiktanbir.com/?tab=blog"

2. Correlating Metrics to Structured Loki Logs via Trace IDs

Metrics tell you what broke; structured logs tell you why and for which tenant.

Every incoming HTTP request receives a X-Request-ID / trace_id middleware header injected into every structured JSON log line (zerolog in Go / tracing in Rust) and Prometheus exemplar. When an alert fires, the on-call engineer clicks the spike in Grafana and jumps directly to the exact Loki log stream for that failing request in under 10 seconds.

Infrastructure & PostgreSQL Advisory

Scaling Infrastructure or Diagnosing P95 Latency?

I help engineering teams diagnose PostgreSQL indexing bottlenecks, concurrency limits, and K3s/Docker deployments. Book a 20-minute call with me to review your setup.

Related Technical Articles