Monitoring tracks application health through metrics, logs, and traces. The three pillars: metrics (numeric measurements), logs (event records), and traces (request paths).
Metrics: CPU usage, memory consumption, request latency, error rates, and throughput. Tools: Prometheus + Grafana, Datadog, New Relic.
Logging: structured logging with JSON format. Include request ID, timestamp, level, and context. Centralized logging with ELK stack or cloud services.
Alerting: define thresholds for critical metrics. PagerDuty or OpsGenie for on-call rotations. Alert on symptoms (high latency) not causes (CPU usage).
APM (Application Performance Monitoring): trace requests across services. Identify slow queries, bottleneck services, and error patterns.
Uptime monitoring: ping endpoints from external services. Checkly, Pingdom, or UptimeRobot for availability alerts.
Best practices: log at appropriate levels, sample traces in production, set meaningful alerts, and maintain runbooks for common issues.