It is challenging to analyze the causes of web page errors, which are one of the most common problems of Internet applications. After the Application Real-Time Monitoring Service (ARMS) agent is installed on an application, the ARMS agent can automatically capture, collect, count, and track exceptions without the need to modify the application code. You can use the ARMS agent to accurately locate all exceptions in the application and perform online diagnostics.
Problem description
Web page errors, particularly those that take the form of a 5xx error, are one of the most common problems of Internet applications. 5xx errors usually occur on the server side. The server side has the most complex business logic and is the most error-prone part of the entire network-request link. Errors on the server side prove to be the most challenging for cause analysis. O&M engineers or development engineers often need to log on to the server to view logs and find the causes.
For applications that have less complex logic and short uptimes, the operation to log on to the server to view logs can solve most of these problems. However, this traditional method is often useless in the following scenarios:
- You want to know the time and frequency of a specific type of error in a distributed application cluster.
- A system has been running for a long time, but you do not care about the residual exceptions. You want to know only about new exceptions today compared with yesterday, and new exceptions after the release of the system compared with the period before the release of the system.
- You view the web requests and relevant parameters associated with an exception.
- Customer Services provides the number of an order that a user fails to place for cause analysis of the failure.
Solution
Install the ARMS agent on the application. The ARMS agent can automatically capture, collect, count, and track exceptions without the need to modify the application code. The ARMS agent presents a clear picture of various errors.
Step 1: Install the ARMS agent
The application can be monitored in all aspects only after you install the ARMS agent. Select one of the following methods to install the ARMS agent.
- For more information about how to install the ARMS agent for a Java application, see Manually install the ARMS agent for a Java application.
- For more information about how to install the ARMS agent for an application in a Container Service Kubernetes cluster, see Install the ARMS agent for Java applications deployed in ACK.
- For more information about how to install the ARMS agent for an application in an open source Kubernetes cluster, see Install the ARMS agent for an application deployed in an open source Kubernetes environment.
Step 2: View statistics of application exceptions
The installed ARMS agent collects and shows the average response time and number of requests, errors, real-time instances, full garbage collection (GC) events, slow SQL queries, exceptions, and slow calls of the application within the selected period of time. The ARMS agent also shows how these metrics change on a day-over-day and week-over-week basis. Perform the following steps to view the statistics of application exceptions:
Step 3: Diagnose causes of exceptions
The statistics of application exceptions are insufficient for locating the causes of exceptions. The exception stack in the log contains the code snippet for a call. However, it does not contain the complete upstream and downstream information and request parameters of this call. The bytecode enhancement technology of the ARMS agent allows you to capture complete upstream and downstream call snapshots for exceptions, and the compromise to performance is small. Then, you can identify the specific causes of exceptions.
What to do next
To prevent passive diagnostics after an exception occurs, you can also use the alert feature of ARMS to create an alert for a specific API or all APIs. This ensures that the O&M team receives a notification immediately after an exception occurs. For more information about how to create an alert, see Create ARMS alerts.