Hard java backend

How do you design monitoring and alerting systems?

The 30 second answer

I start from user-facing SLOs, not from a pile of host metrics. I measure latency percentiles, traffic, errors and saturation (the four golden signals), I alert on symptoms that a human must act on, and I keep dashboards for diagnosis once the page fires. Alerts need a runbook, a severity, and a way to silence or route them; a noisy page that nobody trusts is worse than a missing graph. I use traces and logs to explain a firing alert, not as the alert itself.

Could you say this in an interview?

Google's SRE book frames monitoring around symptoms and service level objectives: is the user in trouble? The four golden signals are latency, traffic, errors and saturation. I graph all four, and I page on a small subset that tracks the SLO (for example, the ratio of good requests over a window, or p99 above a budget).

Alerts. Every page needs an owner, a severity, and a runbook that says what to check first. I prefer to alert on a burn rate of the error budget rather than on a raw CPU number. Host metrics (disk, GC, pool wait) belong on a diagnostic dashboard or as a secondary, lower-severity warning. The SRE book is explicit that paging on every cause produces noise and people ignore the alerts.

The three signals work together. Metrics tell you that something broke and how much. Traces show which hop was slow. Logs show why for a single request, with trace ids as the join key. That is also how APM traces are used on this page.

# Prometheus-style SLO alert sketch (error budget burn)
groups:
  - name: checkout-slo
    rules:
      - alert: CheckoutErrorBudgetBurn
        expr: |
          (sum(rate(http_requests_total{job="checkout",status=~"5.."}[5m]))
           / sum(rate(http_requests_total{job="checkout"}[5m]))) > 0.01
        for: 10m
        labels:
          severity: page
        annotations:
          runbook: https://wiki.example/runbooks/checkout-5xx

I do not invent a "good" threshold in the interview; I derive it from the SLO the service already has, or I state an assumption.

Sources (3)
  1. Google SRE Book: Monitoring Distributed Systemssre.google
  2. Google SRE Book: Service Level Objectivessre.google
  3. Prometheus: Alerting rulesprometheus.io