Monitoring
The practice of observing and tracking system health, performance, and behavior to detect issues, optimize performance, and ensure reliability.
Detailed Explanation
Monitoring provides visibility into your application's behavior in production. The three pillars of observability (which monitoring supports) are: metrics (numeric measurements over time), logs (discrete events), and traces (request flow through distributed systems).
Key monitoring concepts: SLIs (Service Level Indicators, what you measure), SLOs (Service Level Objectives, targets), SLAs (Service Level Agreements, commitments), and error budgets (how much failure is acceptable). Monitoring tools: Prometheus (metrics), Grafana (dashboards), ELK Stack (logs), Jaeger (traces), and Datadog/New Relic (all-in-one).
Why It Matters
You cannot improve what you cannot measure. Monitoring is essential for detecting issues before users do and for making data-driven decisions about performance.
Real-World Example
Grafana dashboards show API response times, error rates, CPU usage, and database connections. When response time exceeds 500ms, PagerDuty alerts the on-call engineer who investigates and fixes the issue before it impacts users.
When to Use
For every production application. Start with basic metrics (uptime, response time, error rate) and add more as your application grows.
Advantages
- Early issue detection
- Performance optimization data
- Capacity planning insights
- SLA compliance verification
- Root cause analysis support
Disadvantages
- Requires ongoing maintenance
- Alert fatigue from too many alerts
- Storage costs for metrics and logs
- Complexity of distributed tracing
- Requires expertise to set up and interpret
Related Terms
Frequently Asked Questions
What is the difference between monitoring and observability?
Monitoring is collecting and analyzing data. Observability is the ability to understand system state from its outputs. Monitoring provides the data; observability is the capability to ask questions about your system.
What should I monitor?
Start with: uptime, response time, error rate, throughput (requests/second), CPU/memory usage, database connection pool, and queue depth. Add business metrics (signups, purchases) as you grow.
How do I avoid alert fatigue?
Only alert on actionable issues, use severity levels (page vs. notify), aggregate alerts, set appropriate thresholds, and regularly review and clean up alerts. An alert should require human action.
What is a golden signal?
Google's four golden signals: latency (request duration), traffic (demand), errors (failure rate), and saturation (how full resources are). Monitor these four for most services.
What is the difference between logs, metrics, and traces?
Logs are discrete events (what happened). Metrics are numeric measurements over time (how much). Traces follow a request through distributed systems (how it flowed). Together, they provide complete observability.