1---2name: monitoring-setup3description: Set up observability with logs, metrics, and traces — know what your system is doing at all times.4---56# Monitoring Setup78## Three Pillars91. **Logs** — structured, searchable records of events102. **Metrics** — numerical measurements over time (latency, error rate, throughput)113. **Traces** — end-to-end request flow across services1213## What to Monitor14- **RED metrics**: Rate, Errors, Duration (for every service)15- **USE metrics**: Utilization, Saturation, Errors (for every resource)16- **Business metrics**: signups, orders, revenue — know if the business is working1718## Alert Design19- Alert on symptoms (high error rate), not causes (high CPU)20- Set proper thresholds — too many alerts = ignored alerts21- Page for: user-facing errors, data loss, security incidents22- Email/Slack for: warnings, approaching thresholds23- Every alert must have a runbook link2425## Logging Rules26- Structured format (JSON), not plain text27- Include: timestamp, level, service, trace_id, message28- No secrets in logs (PII, passwords, tokens)29- Log at the right level: DEBUG (dev), INFO (normal), WARN (concern), ERROR (broken)