Observability and Alerting: A Practical Guide to Building Operations Monitoring and Logging
This guide explains why having monitoring does not guarantee observability, and how to build a reliable operations stack across four layers: data collection, storage and querying, visualization and alerting, and incident response with postmortems. It covers metric layering, dashboard design for decision-making, alert tiering and noise reduction, reliable alert delivery channels, structured logging with trace IDs, on-call automation, and general cloud deployment considerations to help teams reduce MTTR.
1. Why Monitoring Does Not Equal Observability
Many teams have already deployed monitoring, yet failures at 3 a.m. are still discovered through user complaints. The root cause is usually not the collection layer, but the path from signals to people: metrics are stored and dashboards are drawn, but alerts are muted, collapsed, or buried in chat groups, so no effective response is triggered. The goal of observability is not to store all data, but to deliver the right information to the right person with minimal latency when an anomaly occurs, and to support fast root cause identification.
Therefore, a mature operations system includes at least four layers: data collection, storage and querying, visualization and alerting, and response and postmortem. The following sections cover these four layers with general technology choices and configuration approaches.
2. Metric Collection and Storage: Define What to Watch First
More collection is not always better. Start by establishing a metric layering model:
- Infrastructure layer: CPU, memory, disk, network, file handles, and process liveness.
- Middleware layer: database connections and slow queries, message queue backlog, and cache hit rate.
- Business layer: request volume, success rate, latency percentiles (P95/P99), and queue wait time.
- Dependency layer: external API success rate and latency, and certificate validity.
On the collection side, a pull-based timestamp database with collector plugins is commonly used to cover hosts and services. For targets that cannot expose endpoints, black-box probing can be used. An illustrative configuration is shown below (structure only, not a specific product):
scrape_configs:- job_name: 'host-metrics'static_configs:- targets: ['10.0.0.11:9100']- job_name: 'blackbox-http'metrics_path: /probeparams:module: [http_2xx]static_configs:- targets: ['https://api.example.internal/health']
Key practice: apply consistent service, env, instance, and version labels to metrics. All dashboards and alerts rely on these labels for aggregation and drill-down. Once label design becomes messy, the cost of later governance is extremely high.
3. Visualization: Dashboards Should Serve Decisions, Not Display
A common dashboard mistake is filling them with line charts that no one can interpret during an incident. Split dashboards by audience:
- On-call overview: global health, core path success rate, and current alert count, so you can tell within one screen whether something is wrong.
- Service detail: latency percentiles, error rate, and saturation (USE method) for a single service.
- Capacity and trends: aggregated by week or month, used for scaling decisions.
For troubleshooting, combine RED and USE: first confirm whether users are affected (Rate/Error/Duration), then locate resource saturation (Utilization/Saturation/Errors).
4. Alerting: MTTR Is Determined by Delivery, Not Detection
Alert design comes down to three things: tiering, noise reduction, and delivery.
Keep only three tiers:
- P1 (service unavailable/data risk): phone-level delivery that must wake someone up.
- P2 (partial functionality impaired, no fallback): instant message with phone call as backup.
- P3 (trend risk): goes to tickets and daily reports, without disturbing on-call.
Noise reduction methods include: multi-metric combination suppression (one alert per root cause), dependency topology suppression (do not repeatedly alert downstream when upstream is down), silence windows (during releases), and a “for” mechanism based on duration and thresholds to avoid flapping false positives.
Delivery is the most overlooked weak point. Mobile push notifications are often blocked by focus modes, do not disturb settings, or background restrictions, leaving P1 alerts unanswered. A more robust engineering approach is to introduce a “strong reminder channel”: convert alert webhooks into phone calls or reminders capable of bypassing do not disturb, and ensure this channel is independent of the regular push path. An illustrative flow:
Metric anomaly → Alert rule triggered (P1) → Alert routing → Strong reminder channel (phone/penetrating reminder)↘ Regular channel (group message/email/ticket)
You must also close the alert loop: each P1 requires two actions, acknowledgment (ack) and resolution (resolve). If not acknowledged, escalate by calling backup on-call personnel level by level. An alert without a closed loop is not an alert.
5. Logging: From Searchable to Fast Search
Log system selection depends on scale and cost:
- Lightweight: log aggregation based on label indexing and compressed storage, with low resource usage, in the same ecosystem as metrics, suitable for small and medium scale.
- Heavyweight: clusters with full-text search and strong pipeline parsing, suitable for large log volumes and complex queries, but with high storage and memory costs.
- Edge: real-time terminal analysis tools for access logs, which can show top requests, status code distribution, and anomaly sources in seconds without writing to a search system.
Three rules for log governance:
- Structured output in unified JSON with fixed fields (time, level, service, trace ID, desensitized user identifier).
- A trace ID that runs through the entire path, so metrics, logs, and traces can be correlated by the same ID.
- Tiered sampling: full error logs, sampled Info, Debug off by default and dynamically enabled.
An illustrative structured log:
{"ts":"2026-08-26T12:00:00Z","level":"error","svc":"order","trace_id":"a1b2c3","msg":"db timeout","cost_ms":3021}
6. On-Call and Postmortem: Turn Experience into Automation
On-call schedules, escalation policies, and silence rules should be managed as configuration, placed under version control, and reviewed. After each P1, produce a postmortem: timeline, root cause, detection gaps, action items, and owners. Action items must become concrete actions, such as adding an alert rule, adding a degradation switch, or performing a capacity expansion.
High-frequency script scenarios that can be automated include: log inspection and anomaly keyword statistics, certificate and backup validity checks, slow query and queue backlog daily reports, and automated smoke verification after releases. These scripts should have a unified entry point, unified log output, and unified failure alerts, avoiding “scripts scattered everywhere, failures unnoticed.”
7. Cloud Deployment Recommendations
If using cloud infrastructure, combine general categories: a monitoring and alerting service for metrics and rules, a log service for centralized search and archiving, object storage for cold data and backups, a message queue for buffering alerts and events, and a container platform for hosting collection and dashboard components. Baidu AI Cloud is typically used in such scenarios to carry the above general capabilities. When selecting, focus on evaluating data retention periods, cross-availability-zone disaster recovery, alert channel reliability, and controllable pay-as-you-go costs, rather than chasing a single feature.
8. Conclusion
The maturity of an operations system is measured simply: the time from failure occurrence to someone responding, and the time from response to identification. Make metric layering clear, keep dashboards simple, tier alerts and connect a strong reminder channel, structure logs with full-path correlation, and solidify postmortem conclusions into automation to steadily reduce MTTR.
