EDAS method tracing helps you quickly troubleshoot problems of running applications. Typical use cases include:
- When you find that it takes a long time to run a service logic, and you want to identify the part of code that causes the time consumption.
- Applications and services are all running smoothly for most of the time. However, a user reports the problem that service response is extremely slow when a specific parameter is passed. In this case, you may need a mechanism to check the code execution related to a specific parameter in a method.
- When a method with complex service logic is executed, you want to have a clear view of the logic and time sequence of service calls in details.
EDAS method tracing is designed to meet the preceding requirements without interfering with code or stopping applications.
EDAS method tracing adopts the JVM bytecode enhancement technique when recording the time consumption and sequence during the entire call process of the selected method, enabling you to check the execution sequence while execution is in progress.
If the following restrictions affect your services or troubleshooting, open a ticket to consult with us so that we can improve some restrictions or configure a whitelist.
In principle, only tracing of service-type classes is supported. Therefore, packages are filtered by name before tracing starts.
Sampled output is adopted to prevent excessive logs due to large amout of method calls. The default policy is to output logs on 10 calls per second for the method.
When you exit and then log on to the EDAS console again, or refresh the screen, historical trace records are lost and previously pulled tracing information is no longer retained.
Automatic stop policy: If method tracing is in inactive state for 10 minutes, EDAS automatically detaches the tracing module and restores the method to the initial state (state prior to enhancement).
Parameter printing: Currently, EDAS only supports printing of basic Java types (string, char, int, float, double, short, and boolean).
If the selected string is too long, EDAS truncates the string to output the first 100 characters.
If the JVM instance restarts during the tracing process, you must stop tracing and then restart it.
Currently, a maximum of 10,000 trace logs can be output. To output more logs, restart the tracing function.
The current version does not support Docker-based applications.
Because the method tracing function adopts the JVM bytecode enhancement technique, to ensure normal running of applications, this function is disabled when the environment check fails.
Before the method tracing function starts, EDAS automatically checks that:
- Ali-Tomcat is in Running state.
- CPU usage is lower than 60%.
- Available system memory is more than 100 MB.
- The available space of JVM PermGen or Metaspace is more than 20 MB.
If the environment check fails, we recommend that you clear the alarms and then click Retry.
Log on to the EDAS console.
Click Applications in the left-side navigation pane and click the name of the application to be checked in the application list.
Click Application Diagnosis in the left-side navigation pane of the Application Details page.
Click the Method Tracing tab on the application diagnosis page.
If the Method Tracing tab does not appear, follow these steps:
Check that you are using Google Chrome as the web browser, and refresh the page. (We performed tests in Google Chrome only.)
If you log on with a sub-account, check that the sub-account has required permissions.
To check permissions, choose Applications > Application Diagnosis > Method Tracing and Tool Authorization.
Before the permission check starts, EDAS performs an environment check on the ECS instance where the application is located. When the environment check dialog box appears, select the checkbox to confirm the precondition and click Confirm to start the environment check.
The method tracing page appears after the environment check is successful.
Set tracing parameters.
Note: Class Name and Method Name are required. Set the two parameters to the class and method you want to trace.
The configuration items are described as follows:
Class Name: Required. Enter a full path name starting with the package path, for example, com.test.alibaba.demo.HelloWorldServlet. EDAS does not support tracing of classes whose names start with the following package paths:
After a complete package path is entered, EDAS checks whether the class exists on the selected ECS instance.
- If the entered class exists, it is displayed in the drop-down list. Select the class to continue.
- If the entered class does not exist, the message “Class does not exist” is displayed in the drop-down list.
Method Name: Required. After a class is selected, the system automatically searches for all methods under the class and displays the method list below the textbox.
The icon on the left of each method indicates the modifier of the method.
- public: A green lock
- protected: A yellow key
- private: A red lock
- package: A blue block
- abstract: No icon
Select the method to be traced from the drop-down list and continue.
Exception Tracing Only: The execution of a method either returns a response normally or ends execution due to an exception. If you select “Exception Tracing Only”, the tracing results are printed and output only when the method is ended due to an exception.
Print Returned Values: If you select this option, the returned values of the method are printed on the result page.
nullis output if the return type of the method is
After a method is selected, the Start Tracing button is available in blue.
Click Start Tracing to trace the method. Whenever the method is called, the call information is displayed in the result area.
Note: After method tracing starts, EDAS periodically checks whether the tracing is in active state. If method tracing is in inactive state for 10 minutes, EDAS automatically stops the tracing and restores the method to the initial state.
Check the method call information.
After method tracing starts, EDAS displays the generated call logs in the EDAS console.
On the left of the display area, each record represents the log that is generated each time the method is called.
44-62/150at the bottom of the table indicates that the browser returns
150records in total and currently lists the trace records in rows
44 to 62.
The prompt “Press key
Hto show help information” is displayed at the bottom of the table. Press “H” on the keyboard to display the usage instructions on shortcut keys.
H: Displays the help document.
Ctrl+G: Displays the latest data in real time. As the call times increase, it is impossible to render and display all records. Similar to the
Ctrl+Gis used to display the latest data once retrieved.
G: Jumps to a specific record. Search for the trace record in a specific row and select it to display details.
ESC: Ends the command that is being executed.
Ctrl+H: Goes to the next page to display the next 10 trace records.
Ctrl+I: Returns to the previous page to display the preceding 10 trace records.
↓: Selects the next trace record.
↑: Selects the previous trace record.
Double-click: Zooms in or restores the selected trace record.
The right side of the display area displays the details or basic information of the selected record. You can double-click or press Enter in the details section to zoom in, or press ESC to restore to initial display.
- Tracing details: Shows the time consumption and execution sequence for each call.The time in blueis the total time consumed by calling the method.The time in redindicates that the time of the specific call is more than 30% of the total time consumed.
- Output details: Shows the exceptions, return values, and input parameters (which are selected using the More option) during execution.
- Method stack details: Shows the stack information before the traced method is called.
After method tracing starts, the Start Tracing button changes to Stop Tracing. After you click Stop Tracing, EDAS restores the traced method to the initial state (state prior to enhancement) and records tracing information in the instance dimension. Next time you go to the method tracing page, the last tracing information is displayed.
If you modify tracing items (for example, method name) after tracing stops and then click Start Tracing, the modified information is submitted and tracing starts based on the latest submitted information.