
In general practice, for online systems that need to operate 24/7, the caution of developers alone is insufficient; monitoring tools must be introduced. Each monitoring failure alert serves as a feedback mechanism, enhancing system availability. Furthermore, the significance of monitoring extends far beyond this.
What is "three-dimensional"?
The purpose of surveillance:
24/7 availability, performance data collection, bug data collection, and anomaly detection.
The objects being monitored:
Server, components, API calls, configuration, business statistics, etc.
Depth of surveillance:
HTTP code, load level, response speed, and branch logic correctness.
Combining the above, we get the concept of "three-dimensional monitoring": "Three-dimensional" refers to implementing multi-dimensional monitoring without limitations on purpose, target, or depth: external monitoring, internal monitoring, user perspective, server perspective, component perspective, multiple networks and regions, multiple terminals, technical monitoring, operational monitoring, risk monitoring, etc. I don't intend to give a precise definition, but only a brief description, hoping to broaden the thinking, with practicality as the primary focus.
Basic server monitoring:
Several basic metrics for a server include: CPU, memory, I/O, traffic, and load.
External domain name monitoring:
We monitor the HTTP and HTTPS sites of domains from network monitoring points across the country. Any DNS resolution failure or incorrect HTTP code return will trigger an immediate alert. Considering China's network environment, all major telecom operators (Great Wall Broadband, China Railcom, China Telecom, China Mobile, China Unicom, and China Telecom) need to have monitoring points, and having overseas monitoring points is even better. (For example, Alibaba Cloud Monitoring, Monitoring Treasure, Pingdom, etc.)
Internal component monitoring:
Adhering to the principle that "all components must be monitored," from nginx, memcached, redis, rabbitmq, uwsgi to various custom cron jobs, daemon programs, etc., all require status monitoring and process load monitoring. If necessary, automatic restarts can also be implemented (e.g., VeryNginx, Supervisor).
500 surveillance:
500 error collection tools can save 500 errors and call stacks that occur within the code, making it easier to reproduce and fix bugs later. (For example, Sentry, which initially supported Django, now supports multiple languages.)
404 monitoring:
A large number of 404 errors for images in a browser can significantly reduce client-side performance; a 404 error may also indicate a bug in a critical document or a calling path.
CDN/Static Resource Monitoring:
Although CDNs are quite mature now, it is still necessary to pay attention to statistical monitoring indicators such as CDN traffic, hit rate, and origin pull strategy.
External dependency monitoring:
For example, a critical piece of logic might depend on an external API. If there's a problem with that logic or significant performance fluctuations, it will affect the availability of the service, making it necessary to monitor it.
API call monitoring (reporting):
Availability monitoring often cannot meet the needs of scenarios with stringent performance requirements. Therefore, it is necessary to embed reporting code in the calling code to report the execution time of each call to the monitoring service, ensuring that if performance degrades, technical personnel can be notified immediately and contact the interface provider for adjustments.
User access monitoring:
User access behavior data is of great interest to both operations personnel and product managers. Front-end tracking and back-end logs can be used to uncover user behavior characteristics (e.g., using tools like cnzz, growthio, and Verynginx for statistical monitoring).
Business logic monitoring:
For certain key logics that require a certain level of operational steps (such as logging in, selecting, placing an order, and making a payment), you can also write your own monitoring logic scripts to achieve this.
Business data monitoring:
Inventory alerts, delayed order shipment alerts, daily order transaction volume monitoring, and balance alerts.
Other elements of the monitoring system
It has aggregation functionality: it prevents hundreds of alarm messages from being sent out due to a temporary failure.
A variety of timely notification methods: email, SMS, telephone, etc.
Possible candidates for "who should receive the alert": testers, technicians, operations and maintenance personnel, and business stakeholders.
Possible candidates for "who should enter the monitoring rules": testers, technicians, operations and maintenance personnel.