Hello friends of the headlines~
Today brings you the second issue of Inspur Haiyue low-code platform inBuilder Open Source Community Edition Feature Recommended Series - Use program tracing tools to capture application logs!
01 Overview
In project development, it is inevitable to use logs. Although the absence of logs will not affect the correct operation of the project, a project without a log can be said to be incomplete. The role of logs in debugging, error or exception location, and data analysis is self-evident. The program tracing tool can track the various operations that occur in the application and the call relationship between them at runtime, so that we can quickly find the location of the error and the error message. In addition, the program tracing tool can also view the call link and time consumption of the operation, and can be targeted for performance problems. Next, let me take you through how to use this tool!
02 Function menu location
First of all, let's clarify the location of the "Program Trace Viewer" function menu: system public > operation and maintenance monitoring> trace debugging> program trace viewer
Program Interface:
03 Usage steps
The Program Trace Viewer is turned off by default, and any operations will not be logged, and trace data can only be recorded and viewed after tracing is turned on in the Program Trace Viewer page.
03-1 Start tracking
On the Program Trace Viewer page, click the Start Tracing button. Once clicked, the tracking settings sidebar will automatically pop up. Prefabrication schemes can be selected in the tracking settings sidebar.
There are three levels of prefabricated solutions: simple, standard, and detailed. The higher the scenario level, the more comprehensive the trace.
Once you're sure, click the Start Tracking button.
The function button in the upper right corner of the page changes to the following state:
Indicates that tracking has been started, after which the actions performed by the current user will be recorded.
03-2 Refresh trace results
After starting the trace, click the [Refresh] button, you will see the tracking call chain record that has been carried out so far, as follows:
On the left is a list of track records. Each record represents a chain of calls, arranged in chronological order at the time of the call, with the most recent occurrence at the top. Where red indicates that there is an error in the call chain.
On the right are the details of a single track record. There are four different views: List view, tree view, table view, and log
a). List view: shows the call relationship of each node (also known as span and span) in the call chain.
The wrong node is shown in red.
In the preceding diagram, there are three nodes in the trace. The first node is an external service call, and the second and third nodes indicate that an SQL call has occurred within the external service call.
Click the call node, and the sidebar of the call node details will pop up, which contains the details of the calling node, such as the request URL, service unit, time consumption, error stack, and so on. As shown in the following figure:
b). Tree diagram: shows the call relationship between the service units in the call chain.
Take the above call chain as an example, which contains only one service unit. As shown in the following figure:
In the cross-SU call scenario, the tree structure is shown in the following figure:
c). Table view: Displays the details and hierarchical relationship of each call node in a tabular form.
d). Log: View the application logs in the current user request call link.
03-3 Trace result filtering
In the Tracking interface, click the Tracking Settings button, and the Settings sidebar will pop up after clicking.
You can change the presentation according to your situation.
03-4 View the executed SQL messages
To view the actual execution statement of SQL, you can perform the following operation:
03-5 Review the exception stack
If an exception occurs in the call, the corresponding calling node and its parent node will be marked in red, click the corresponding node to view the stack information of the exception, you can operate as shown in the following figure:
03-6 Keyword query
After you start tracking, there is a search box at the top of the page, where you can enter keywords to search for related tracking records, such as table name, request path, etc. After entering a keyword search, only eligible tracking records will be displayed in the track record list on the left, and trail records that do not meet the criteria in the track record details on the right will be grayed out, and keywords will be highlighted in the sidebar of the call node details:
03-7 Export
After the tracking is complete, you can click the Export button to export the current tracking records to a file. The import function can then read the file and view the saved traces. The file is encrypted by default when exporting, record the key information, and enter it when importing.
03-8 Single export
If you want to export a record separately, you can move the mouse over the details header of this record and click the [Export] button that appears, as shown in the following figure:
Enter the inBuilder Community (https://ibc.inspures.com/), you can download and install inBuilder Open Source Community Edition for free, learn and experience the above development process for free, and get started!