Traffic playback method and device, computer equipment and storage medium
Through the traffic playback method, the recorded traffic is obtained and compared, which solves the problem of traditional inefficiency and realizes efficient online problem investigation and business monitoring.
Patent Information
- Application Number
- CN202311873839.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-30
- Publication Date
- 2025-07-04
AI Technical Summary
Traditional simulated online real service traffic testing is inefficient, online troubleshooting is difficult, and it is difficult to effectively verify system problems and function implementation.
Through the traffic playback method, the recorded traffic and response data of the target interface are obtained based on the recording traffic identification, and the traffic playback is performed. The recorded and playback data is compared using preset comparison rules, some fields are ignored, the playback results are displayed, and the analysis portal is provided.
It improves testing efficiency, facilitates and quickly conducts online problem investigation, supports real-time business monitoring and security risk assessment, and provides strong data support.
Smart Images

Figure CN120256284A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular, to a traffic playback method, apparatus, computer device, and storage medium. Background Art
[0002] With the development of computer technology, business requirements are constantly updated and iterated. More and more projects are facing the problem of technology reconstruction. To ensure that the constructed projects, systems, and servers can guarantee the stability of external services and also take into account the performance of their own service reconstruction, effective testing needs to be carried out before reconstruction to verify and ensure system problems and function implementation.
[0003] In traditional technologies, testing is carried out by simulating test data generated by real online business traffic. However, it is very difficult to troubleshoot online faults in this way, resulting in low testing efficiency. Summary of the Invention
[0004] Based on this, in view of the above technical problems, it is necessary to provide a traffic playback method, apparatus, computer device, computer-readable storage medium, and computer program product that can improve testing efficiency.
[0005] In a first aspect, this application provides a traffic playback method, including:
[0006] Based on the recorded traffic identifier carried in the traffic playback task, obtain the recorded traffic corresponding to the target interface and the first response data corresponding to the recorded traffic;
[0007] Perform traffic playback on the target interface based on the recorded traffic corresponding to the target interface to obtain second response data;
[0008] Compare the first response data and the second response data according to a preset comparison rule, and determine the playback result corresponding to the target interface based on the comparison result; the preset comparison rule is used to indicate that some fields are ignored during the comparison process;
[0009] Display the playback result corresponding to the target interface and the analysis entry corresponding to the playback result;
[0010] In response to a trigger operation on the analysis entry, display analysis data for analyzing the playback result.
[0011] In a second aspect, this application also provides a traffic playback apparatus, including:
[0012] A first response data acquisition module, configured to obtain the recorded traffic corresponding to the target interface and the first response data corresponding to the recorded traffic based on the recorded traffic identifier carried in the traffic playback task;
[0013] A second response data acquisition module, configured to perform traffic playback on the target interface based on the recorded traffic corresponding to the target interface, and obtain second response data;
[0014] A comparison module, configured to compare the first response data and the second response data according to a preset comparison rule, and determine a playback result corresponding to the target interface based on the comparison result; the preset comparison rule is used to indicate ignoring some fields during the comparison process;
[0015] A playback result display module, configured to display the playback result corresponding to the target interface and an analysis entry corresponding to the playback result;
[0016] A playback result analysis module, configured to display analysis data for analyzing the playback result in response to a trigger operation on the analysis entry.
[0017] In a third aspect, the present application further provides a computer device, including a memory and a processor, where the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0018] Based on the recorded traffic identifier carried in the traffic playback task, obtain the recorded traffic corresponding to the target interface and the first response data corresponding to the recorded traffic;
[0019] Perform traffic playback on the target interface based on the recorded traffic corresponding to the target interface, and obtain second response data;
[0020] Compare the first response data and the second response data according to a preset comparison rule, and determine a playback result corresponding to the target interface based on the comparison result; the preset comparison rule is used to indicate ignoring some fields during the comparison process;
[0021] Display the playback result corresponding to the target interface and an analysis entry corresponding to the playback result;
[0022] In response to a trigger operation on the analysis entry, display analysis data for analyzing the playback result.
[0023] In a fourth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0024] Based on the recorded traffic identifier carried in the traffic playback task, obtain the recorded traffic corresponding to the target interface and the first response data corresponding to the recorded traffic;
[0025] Perform traffic playback on the target interface based on the recorded traffic corresponding to the target interface, and obtain second response data;
[0026] Compare the first response data and the second response data according to a preset comparison rule, and determine the playback result corresponding to the target interface based on the comparison result; the preset comparison rule is used to indicate that some fields are to be ignored during the comparison process;
[0027] Display the playback result corresponding to the target interface and the analysis entry corresponding to the playback result;
[0028] In response to a trigger operation on the analysis entry, display analysis data for analyzing the playback result.
[0029] In a fifth aspect, the present application also provides a computer program product, including a computer program, which when executed by a processor implements the following steps:
[0030] Based on the recorded traffic identifier carried in the traffic playback task, obtain the recorded traffic corresponding to the target interface and the first response data corresponding to the recorded traffic;
[0031] Perform traffic playback on the target interface based on the recorded traffic corresponding to the target interface to obtain second response data;
[0032] Compare the first response data and the second response data according to a preset comparison rule, and determine the playback result corresponding to the target interface based on the comparison result; the preset comparison rule is used to indicate that some fields are to be ignored during the comparison process;
[0033] Display the playback result corresponding to the target interface and the analysis entry corresponding to the playback result;
[0034] In response to a trigger operation on the analysis entry, display analysis data for analyzing the playback result.
[0035] The above traffic playback method, device, computer device, storage medium, and computer program product obtain the recorded traffic corresponding to the target interface and the first response data corresponding to the recorded traffic based on the recorded traffic identifier carried in the traffic playback task, perform traffic playback on the target interface based on the recorded traffic corresponding to the target interface to obtain the second response data, compare the first response data and the second response data according to a preset comparison rule, determine the playback result corresponding to the target interface based on the comparison result, where the preset comparison rule is used to indicate ignoring some fields during the comparison, display the playback result corresponding to the target interface and the analysis entry corresponding to the playback result, and in response to a trigger operation for the analysis entry, display the analysis data for analyzing the playback result. Since traffic playback can be performed based on the recorded traffic, the playback ability can be provided for users to directly perform business regression testing on the traffic. Since the playback result and the visualization analysis page can be displayed, it provides strong data support for online problem troubleshooting, real-time business monitoring planning, and security risk assessment, and can facilitate and quickly perform online problem troubleshooting, thus significantly improving the testing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] To more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following will briefly introduce the drawings required for use in the description of the embodiments or related technologies. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0037] Figure 1 It is an application environment diagram of the traffic playback method in some embodiments;
[0038] Figure 2 It is a flowchart of the traffic playback method in some embodiments;
[0039] Figure 3 It is a schematic diagram of the display page of the playback result in some embodiments;
[0040] Figure 4 It is a schematic diagram of the display page of the analysis data in some embodiments;
[0041] Figure 5 It is a schematic flowchart of the steps for displaying the playback result in some embodiments;
[0042] Figure 6 It is a schematic diagram of the interaction page corresponding to the traffic playback task in some embodiments;
[0043] Figure 7 It is a schematic diagram of the task details page in some embodiments;
[0044] Figure 8Schematic diagram of the comparison rule configuration page in some embodiments;
[0045] Figure 9 Schematic diagram of the page for creating a task in some embodiments;
[0046] Figure 10 Schematic diagram of the page for creating a task in some other embodiments;
[0047] Figure 11 Schematic diagram of the page for creating a playback rule in some embodiments;
[0048] Figure 12 Logical architecture diagram of the traffic playback method in some embodiments;
[0049] Figure 13 General flow schematic diagram of the traffic playback method in some embodiments;
[0050] Figure 14 Structural block diagram of the traffic playback device in some embodiments;
[0051] Figure 15 Internal structure diagram of a computer device in some embodiments;
[0052] Figure 16 Internal structure diagram of a computer device in some embodiments. Detailed implementation manners
[0053] In order to make the objectives, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0054] The traffic playback method provided by the embodiments of the present application can be executed by a computer device, which can be a terminal or a server, or a system composed of a terminal and a server, and is implemented through the interaction between the terminal and the server. Taking the traffic playback method of the present application implemented through the interaction between the terminal and the server as an example, the traffic playback method provided by the embodiments of the present application can be applied to, for example Figure 1In the application environment shown. Among them, the terminal 102 can be used as a task management end, and the server 104 can be used as a task execution end. The task execution end is used to execute tasks, and the task management end is used to manage tasks. There can be multiple task execution ends, and multiple means at least two. The task management end communicates with the task execution end through a wired or wireless network. Among them, the terminal can be, but is not limited to, various personal computers, laptop computers, smart phones, tablet computers, Internet of Things devices, and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, etc. The portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server can be implemented by an independent server or a server cluster composed of multiple servers.
[0055] The task management end can generate a traffic playback task and send the generated traffic playback task to the task execution end. After receiving the traffic playback task, the task execution end obtains the recorded traffic corresponding to the target interface and the first response data corresponding to the recorded traffic based on the recorded traffic identifier carried in the traffic playback task, performs traffic playback on the target interface based on the recorded traffic corresponding to the target interface to obtain the second response data, compares the first response data and the second response data according to a preset comparison rule, determines the playback result corresponding to the target interface based on the comparison result. Among them, the preset comparison rule is used to indicate that some fields are ignored during the comparison process. The task execution end returns the playback result to the task management end. The task management end 102 can display the playback result corresponding to the target interface and the analysis entry corresponding to the playback result, and in response to a trigger operation for the analysis entry, display the analysis data for analyzing the playback result.
[0056] In an exemplary embodiment, as Figure 2 shown, a traffic playback method is provided, which is executed by a computer device and includes the following steps 202 to 210. Among them:
[0057] Step 202, based on the recorded traffic identifier carried in the traffic playback task, obtain the recorded traffic corresponding to the target interface and the first response data corresponding to the recorded traffic.
[0058] Step 204, perform traffic playback on the target interface based on the recorded traffic corresponding to the target interface to obtain the second response data.
[0059] Among them, the traffic playback task refers to a task used to indicate traffic playback. Traffic playback is based on recording traffic and playing it back in a specified environment. Recording traffic means recording the real traffic of user operations using an online entry. The traffic playback task can carry the interface identifier of the target interface. The interface identifier is used to uniquely identify an interface. For example, it can be the uniform resource locator (URL) of the interface. The traffic playback task can also carry a recorded traffic identifier, and the recorded traffic of the target interface can be retrieved from the database through the recorded traffic identifier.
[0060] Specifically, the computer device can determine the target interface based on the interface identifier in the traffic playback task, obtain the recorded traffic of the target interface and the corresponding first response data based on the recorded traffic identifier in the traffic playback task from the database. The computer device can further perform traffic playback on the target interface based on the recorded traffic corresponding to the target interface to obtain the second response data.
[0061] It can be understood that multiple interface identifiers can be carried in a traffic playback task, so as to specify traffic playback on multiple target interfaces. These target interfaces belong to the same deployment unit, that is, the same application.
[0062] Step 206: Compare the first response data and the second response data according to a preset comparison rule, and determine the playback result corresponding to the target interface based on the comparison result; the preset comparison rule is used to indicate that some fields are ignored during the comparison process.
[0063] Among them, the preset comparison rule refers to a comparison rule set in advance. The comparison rule contains interface description information, which can be used to indicate that some fields are ignored during the comparison process of traffic playback on the interface indicated by the interface description information. The ignored fields can be configured during the rule configuration process.
[0064] Specifically, the recorded traffic corresponding to each recorded traffic identifier indicates one or more target interfaces. The computer device can further obtain the corresponding preset comparison rule according to the interface description information of these interfaces, and then compare the second response data obtained by playback with the first response data corresponding to the recorded traffic according to the preset comparison rule. If the comparison is consistent, a playback result of successful playback can be obtained. If the comparison is inconsistent, a playback result of failed playback can be obtained.
[0065] In some embodiments, the computer device can store the playback result in the database.
[0066] Step 208: Display the playback result corresponding to the target interface and the analysis entry corresponding to the playback result.
[0067] The analysis entry refers to an entry that can enter a display page of analysis data in response to a user's trigger operation. The analysis entry can specifically be a control in the display page where the playback result is located.
[0068] Specifically, after obtaining the playback result obtained by the traffic playback, the computer device displays the playback result, and at the same time, corresponding to the playback result, the analysis entrance and the analysis entrance can also be displayed. Figure 3 , is a schematic diagram of a playback result display page in some embodiments, in which the playback results of multiple target interfaces and the start time and end time of traffic playback for each interface are displayed. Corresponding to each interface, a "Playback Details" mark is also displayed, which is the analysis entry.
[0069] Step 210: In response to a trigger operation on the analysis entry, display analysis data analyzed on the playback result.
[0070] The trigger operation refers to a preset operation acting on the analysis entry. The preset operation can be a touch operation, a cursor operation, a key operation or a voice operation. The touch operation can be a touch click operation, a touch press operation or a touch slide operation, and the touch operation can be a single-point touch operation or a multi-point touch operation; the cursor operation can be an operation of controlling the cursor to click or an operation of controlling the cursor to press; the key operation can be a virtual key operation or a physical key operation, etc.
[0071] Specifically, the computer device may display analysis data analyzed for the playback result in response to a trigger operation for the analysis entry.
[0072] In some embodiments, the playback results can be analyzed by using the open source sandbox-repeater comparison tool to compare and analyze the response data of the recorded traffic with the response data obtained by playback. Figure 4 , is a schematic diagram of a display page for analyzing data in some embodiments, in which the original response content and the replayed response content are displayed, and the difference comparison of the response results between the original response content and the replayed response content is displayed. By providing a visual analysis page, the traffic playback can be viewed line by line and compared with the recorded data, providing strong data support for online problem troubleshooting, real-time business monitoring planning, and security risk assessment.
[0073] The above traffic playback method obtains the recorded traffic corresponding to the target interface and the first response data corresponding to the recorded traffic based on the recorded traffic identifier carried in the traffic playback task, performs traffic playback on the target interface based on the recorded traffic corresponding to the target interface to obtain second response data, compares the first response data and the second response data according to a preset comparison rule, determines the playback result corresponding to the target interface based on the comparison result. The preset comparison rule is used to indicate that some fields are ignored during the comparison, and display the analysis data for analyzing the playback result. Since traffic playback can be performed based on the recorded traffic, the playback ability can be provided to allow users to directly perform business regression testing on the traffic. Since the playback result and the visualization analysis page can be displayed, it provides strong data support for online problem troubleshooting, real-time business monitoring planning, and security risk assessment, and can facilitate and quickly perform online problem troubleshooting, thus significantly improving the testing efficiency.
[0074] In an exemplary embodiment, as Figure 5 shown, step 204 includes steps 502 to 506. Among them:
[0075] Step 502, display the interaction page corresponding to the traffic playback task, and display the task details entry in the interaction page.
[0076] Specifically, the computer device can display the interaction page corresponding to the traffic playback task. In this interaction page, a playback task list can be displayed. The playback task list includes multiple traffic playback tasks, and each traffic playback task is correspondingly displayed with a task details entry.
[0077] For example, referring to Figure 6 , it is a schematic diagram of the interaction page corresponding to the traffic playback task in some embodiments. Multiple traffic playback tasks are displayed in this interaction page. Each traffic playback task corresponds to a different record ID, and this record ID is used to identify the recorded traffic corresponding to this traffic playback task. Each traffic playback task is correspondingly displayed with a "Task Details" mark, and this mark is the task details entry.
[0078] Optionally, in the interaction page corresponding to the traffic playback task, the task status of each traffic playback task can also be displayed. Continuing to refer to Figure 6 , where the task status can be "Playing" or "Completed".
[0079] Optionally, on the interaction page corresponding to the exile replay task, for each traffic replay task, a re - replay mark can also be displayed. The re - replay mark can be a control for triggering re - performing the traffic replay. Re - performing the traffic replay can be re - performing the traffic replay when the traffic replay is successful, or re - performing the traffic replay when the traffic replay fails. Exemplarily, in these two cases, different re - replay marks can be displayed separately, so as to better facilitate users to perform traffic replay for the traffic replay task. Continuing to refer to Figure 6 , where the "re - replay" operation mark can trigger re - performing the traffic replay when the traffic replay is successful, and the "failed replay" operation mark can trigger re - performing the traffic replay when the traffic replay fails.
[0080] Step 504, in response to a first trigger operation for the task details entry, display the replay details viewing entry corresponding to at least one target interface.
[0081] Specifically, when the user triggers an operation on the task details entry corresponding to any traffic replay task in the task list, the computer device can respond to this trigger operation and display the task details page. In this page, display all the interface lists under the traffic replay task corresponding to the task details entry triggered by this trigger operation, and a replay details viewing entry is correspondingly displayed for each interface identifier in the interface list.
[0082] Illustrate by example, refer to Figure 7 , which is a schematic diagram of the task details page in some embodiments. In the task details page, the replay progress, status, and the operation mark of "replay details" for each interface are displayed, and this mark is the replay details viewing entry.
[0083] Step 506, in response to a second trigger operation for any replay details viewing entry, display the replay result of the target interface corresponding to the replay details viewing entry and the analysis entry corresponding to the replay result.
[0084] Specifically, when the user triggers an operation on the replay details viewing entry corresponding to any interface in the task details page, the computer device can respond to this trigger operation and display the replay result of the target interface corresponding to the replay details viewing entry triggered by this trigger operation and the analysis entry corresponding to the replay result.
[0085] In the above - mentioned embodiments, through the first trigger operation for the task details entry and the second trigger operation for the replay details viewing entry, the replay result of the target interface corresponding to the replay details viewing entry triggered by the second trigger operation and the analysis entry corresponding to the replay result can be displayed. The operation is simple, which improves the interaction efficiency during the traffic replay process.
[0086] In some embodiments, the replay details viewing entry is displayed on the task details display page; the method further includes: displaying at least one replay mark corresponding to each target interface on the task details display page; in response to a third trigger operation on any one of the replay marks, determining the target interface corresponding to the replay mark targeted by the third trigger operation; and replaying the traffic based on the recorded traffic corresponding to the determined target interface.
[0087] Among them, the replay mark can be a control for triggering re-traffic replay. Re-traffic replay can be re-traffic replay in the case of traffic replay failure, or can be re-traffic replay in the case of traffic replay failure. Exemplarily, in these two cases, different replay marks can be displayed separately, so as to better facilitate users to perform traffic replay.
[0088] Specifically, the computer device can display at least one replay mark corresponding to each target interface on the task details display page. When the user performs a trigger operation on any one of the traffic replay marks, the computer device can, in response to the trigger operation, determine the target interface corresponding to the replay mark affected by the trigger operation as the target interface for which traffic replay needs to be performed, and then can re-play the traffic based on the recorded traffic of the target interface.
[0089] Continue to refer to Figure 7 , the interface with the interface address "XXXXXXXXX2" corresponds to two replay marks. Among them, the "Replay" operation mark can trigger re-traffic replay in the case of successful traffic replay, and the "Failed Replay" operation mark can trigger re-traffic replay in the case of traffic replay failure. When the user performs a trigger operation on any one of them, the computer device can re-play the traffic based on the recorded traffic of the interface "XXXXXXXXX2".
[0090] Exemplarily, when the traffic playback method of the present application is jointly executed by the task execution end and the task management end, the task management end may display a re-playback mark corresponding to at least one target interface on the task details display page. Further, the task management end may, in response to a third trigger operation for any re-playback mark, send a re-playback instruction to the task execution end. The re-playback instruction is used to instruct the task execution end to re-perform traffic playback based on the recorded traffic of the target interface corresponding to the re-playback mark targeted by the third trigger operation. Specifically, the task management end may display a re-playback mark corresponding to the target interface on the task details display page. When the user triggers an operation on the traffic playback mark, the task management end may, in response to the trigger operation, send a re-playback instruction to the task execution end. The re-playback instruction may carry the interface identifier of the target interface. Thus, after receiving the re-playback instruction, the task execution end may determine the target interface for which traffic playback is required based on the interface identifier, and then re-perform traffic playback based on the recorded traffic of the target interface.
[0091] In the above embodiment, since a re-playback mark is provided on the task details page, it is convenient for the user to trigger re-traffic playback, so that the user can efficiently verify the work results, further improve the test efficiency, and increase the accuracy and reliability of test verification, providing a data basis for security assessment sharing.
[0092] In some embodiments, the preset comparison rule is created through a comparison rule creation step. The comparison rule creation step includes: obtaining a preset comparison rule template, where the comparison rule template includes a comparison rule description item and an interface description item; determining the target field type and the target field corresponding to the target field type through the comparison rule description item; determining the interface description information of the target interface through the interface description item; and determining the preset comparison rule based on the target field type, the target field corresponding to the target field type, and the interface description information. The preset comparison rule is used to indicate that during the traffic playback process of the target interface, the comparison of the target field corresponding to the target field type is ignored.
[0093] Specifically, the computer device can obtain a preset comparison rule template, which includes a comparison rule description item and an interface description item. The computer device can display the comparison rule template, and guide the user to configure the rule through the comparison rule description item included in the comparison rule template. During the configuration process, the user can specify the target field type and the target field corresponding to the target field type, so that the computer device can determine the specified target field type and the target field corresponding to the target field type. The user is guided to configure the interface description information through the interface description item included in the comparison rule template, so that the computer device can determine the interface description information of the target interface. Finally, the computer device can determine a preset comparison rule based on the target field type, the target field corresponding to the target field type, and the interface description information. The preset comparison rule is used to indicate that during the traffic playback of the target interface, the comparison of the target field corresponding to the target field type is ignored.
[0094] In the above embodiment, by obtaining a preset comparison rule template, the target field type, the target field, the interface description information, etc. can be quickly determined through the comparison rule template, so that a preset comparison rule can be quickly generated, improving the creation efficiency of the comparison rule.
[0095] In some embodiments, the interface description item includes a first environment description item, an interface type item, and an interface address item. Determining the interface description information of the target interface through the interface description item includes: determining the first environment description information corresponding to the target interface through the first environment description item; determining the interface type corresponding to the target interface through the interface type item; determining the interface address corresponding to the target interface through the interface address item; and determining the interface description information based on the first environment description information, the interface type, and the interface address.
[0096] Specifically, the interface description item includes an environment description item, an interface type item, and an interface address item. The computer device can guide the user to configure the environment information through the environment description item, so as to determine the first environment description information corresponding to the target interface. The user is guided to configure the interface type through the interface type item, so as to determine the interface type corresponding to the target interface. The user is guided to configure the interface address through the interface address item, so as to determine the interface address corresponding to the target interface. Finally, the interface description information is determined based on the first environment description information, the interface type, and the interface address.
[0097] For example, referring to Figure 8 , is a schematic diagram of a comparison rule configuration page in some embodiments. Environment information such as system code and deployment unit, and information such as interface path and interface type can be configured on this rule configuration page. These are the interface description information. In addition, comparison rule description information can also be configured. See Figure 8The table in , where the rule type represented by "Ignore" is the target rule type, and the fields in the rule details corresponding to the target rule type are the targets corresponding to the target field type. Here, $ represents the return value object, data represents a field in the return value object, and result is a field in data and is a set.
[0098] In the above embodiments, since the interface description item includes an environment description item, an interface type item, and an interface address item, the first environment description information, the interface type, and the interface address can be determined. Finally, the interface description information is determined based on the first environment description information, the interface type, and the interface address, making the interface description information richer, so that the target interface can be described more accurately, and the preset comparison rules can be obtained more accurately during the traffic playback process.
[0099] In some embodiments, traffic playback is performed on the target interface based on the recorded traffic corresponding to the target interface to obtain second response data, including: obtaining a playback rule based on the playback rule identifier carried in the traffic playback task; performing traffic playback according to the playback rule based on the recorded traffic corresponding to the target interface to obtain second response data.
[0100] Among them, the playback rule refers to the rule used to indicate which environment the traffic playback specifically plays back to. One or more playback rules can be set by the user before generating the task, so that one of the playback rules can be selected when generating the traffic playback task.
[0101] In this embodiment, when the computer device generates a traffic playback task, it can carry a recorded traffic identifier and a playback rule identifier in the traffic playback task. Thus, when executing the traffic playback task, the recorded traffic corresponding to the target interface can be obtained according to the recorded traffic identifier, the playback rule can be obtained according to the playback rule identifier, and traffic playback is performed based on the recorded traffic corresponding to the target interface in the environment indicated by the playback rule to obtain second response data.
[0102] In the above embodiments, since the traffic playback task carries a recorded traffic identifier and a playback rule identifier, the traffic playback can be performed according to the playback rule, improving the flexibility and accuracy of the traffic playback.
[0103] In some embodiments, the above traffic playback method further includes: displaying a recorded traffic selection control and a playback rule selection control; in response to a selection operation on the recorded traffic selection control, determining the recorded traffic identifier corresponding to the selected recorded traffic; in response to a selection operation on the playback rule selection control, determining the playback rule identifier corresponding to the selected playback rule; creating a traffic playback task based on the recorded traffic identifier and the playback rule identifier.
[0104] Specifically, the computer device can display a recording traffic selection control and a playback rule selection control. When the user performs a triggering operation on the recording traffic selection control, a list of recording traffic identifiers can be displayed. The user can select one of the recording traffic identifiers from the list, and the computer device can display the selected recording traffic identifier in the display box of the recording traffic selection control. The user can further perform a triggering operation on the playback rule selection control, and the computer device can further obtain the playback rules corresponding to the deployment unit to which the selected recording traffic identifier belongs, and display the playback rule identifiers of these playback rules in the drop-down list of the playback rule selection control. When the user selects one of the playback rule identifiers, the computer device can create a traffic playback task based on the selected recording traffic identifier and playback rule identifier.
[0105] For example, referring to Figure 9 , for the schematic diagram of the task creation page in some embodiments, where the "associated recording record" control is the recording traffic selection control. By selecting a recording record from the drop-down list, the traffic to be played back is the traffic recorded by this recording task. The "playback rule" control is the playback rule selection control. By selecting a configured playback rule from the drop-down list, the playback rule includes environmental information, request domain names, etc. In this embodiment, on the task creation page, the name of the traffic playback task can also be customized. In addition, a recording task can record the traffic data of multiple interfaces, and the selection of interfaces can also be provided on this page.
[0106] In some embodiments, the computer device can also display a list of traffic recording records. The user can click on the playback of one of the traffic recording records to enter the task creation page, where the user can create a traffic playback task for the clicked traffic recording record. For example, referring to Figure 10 , when the user clicks on "Recording 1" in the traffic recording record list, they can enter the task creation page as shown in Figure 10 .
[0107] In the above embodiments, since the recording traffic identifier can be selected through the recording traffic selection control, and the playback rule identifier can be selected through the playback rule selection control, and then a traffic playback task can be created based on the recording traffic identifier and the playback rule identifier, the creation efficiency of the traffic playback task is improved.
[0108] In some embodiments, the above method further includes: the playback rule is created through a playback rule creation step, and the playback rule creation step includes: obtaining a preset playback rule template, where the playback rule template includes a rule identifier item and a second environment description item; determining the playback rule identifier through the rule identifier item; determining the second environment description information corresponding to the environment to which the traffic playback needs to be replayed through the second environment description item; and generating a playback rule according to the playback rule identifier and the second environment description information.
[0109] Specifically, the computer device can obtain a preset playback rule template, which includes a rule identification item and a second environment description item. The computer device can display the rule identification item and the second environment description item. The user can input a playback rule identification through the rule identification item, so that the computer device can determine the playback rule identification. The user can also input environment description information through the second environment description item, so that the computer device can determine the second environment description information corresponding to the environment to which the traffic playback needs to be replayed. Furthermore, according to the playback rule identification and the second environment description information, a playback rule is generated.
[0110] For example, referring to Figure 11 , in some embodiments, it is a schematic diagram of a playback rule creation page. The "rule name" input box is the rule identification item for inputting a custom rule name. The "system code" input box, "environment label" input box, "deployment unit" input box, and "domain name" input box are the second environment description items. The "system code" input box is used to input the unique identifier of the system information, which is used to uniquely identify the system to which the recorded / played-back traffic belongs. The "environment label" input box is used to input an environment label indicating production or testing. The environment label PRD indicating the production environment or the environment label SIT indicating the test environment can be input. The "deployment unit" input box is used to input the name of the application to be replayed. The "domain name" input box is used to input the environment domain name. The complete interface address is the environment domain name concatenated with the interface path of the recorded traffic. Among them, the system code, environment label, and deployment unit input are the environment information.
[0111] In the above embodiments, the computer device can determine the playback rule identification and environment description information through the preset playback rule template, and thus generate a playback rule according to the playback rule identification and the environment description information, improving the generation efficiency of the playback rule.
[0112] In some embodiments, referring to Figure 12 , in some specific embodiments, it is a logical architecture diagram of a traffic playback method, including a business layer, a data layer, and a database. Among them, the task management end and the task execution end are in the business layer. The task management end can configure the opponent rules, playback tasks, comparison rules, etc. and view the playback details. The task execution end can perform traffic pulling, rule pulling, and traffic playback, and generate a playback record. The data layer and the database together implement data storage.
[0113] In some embodiments, referring to Figure 13 , in some specific embodiments, it is a schematic diagram of the overall process of the traffic playback method. Referring to Figure 13, the user can create replay rules, create comparison rules, create replay tasks, and then perform multi-threaded replay. The obtained replay response data is stored in Kafka. Further, the replay result can be obtained based on the comparison rules in MySQL, and the replay result is further stored in MySQL. During the replay process, the replay process statistics can also be performed, and information such as the counted quantity is also stored in MySQL. The user can query the replay tasks, replay details, etc. from MySQL.
[0114] It should be understood that although the steps in the flowcharts involved in the above embodiments are shown in sequence according to the arrows, these steps do not necessarily need to be executed in the order indicated by the arrows. Unless there is a clear indication in this article, the execution of these steps has no strict order limit, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages. These steps or stages do not necessarily need to be executed at the same moment, but can be executed at different moments. The execution order of these steps or stages does not necessarily need to be sequential, but can be executed alternately or in turn with at least a part of other steps or steps or stages in other steps.
[0115] Based on the same inventive concept, the embodiments of the present application also provide a traffic replay device for implementing the traffic replay method involved above. The implementation solution provided by this device to solve problems is similar to the implementation solution described in the above method. Therefore, the specific limitations in one or more embodiments of the following traffic replay devices can refer to the limitations on the traffic replay method in the above text, and will not be repeated here.
[0116] In an exemplary embodiment, as Figure 14 shown, a traffic replay device 1400 is provided, including:
[0117] A first response data acquisition module 1402, configured to acquire the recorded traffic corresponding to the target interface and the first response data corresponding to the recorded traffic based on the recorded traffic identifier carried in the traffic replay task;
[0118] A second response data acquisition module 1404, configured to perform traffic replay on the target interface based on the recorded traffic corresponding to the target interface to obtain second response data;
[0119] A comparison module 1406, configured to compare the first response data and the second response data according to a preset comparison rule, and determine the replay result corresponding to the target interface based on the comparison result; the preset comparison rule is used to indicate ignoring some fields during the comparison process;
[0120] The playback result display module 1408 is configured to display the playback result corresponding to the target interface and the analysis entry corresponding to the playback result;
[0121] The playback result analysis module 1410 is configured to display the analysis data for analyzing the playback result in response to a trigger operation on the analysis entry.
[0122] The above-mentioned traffic playback device obtains the recorded traffic corresponding to the target interface and the first response data corresponding to the recorded traffic based on the recorded traffic identifier carried in the traffic playback task, performs traffic playback on the target interface based on the recorded traffic corresponding to the target interface to obtain the second response data, compares the first response data and the second response data according to a preset comparison rule, determines the playback result corresponding to the target interface based on the comparison result. The preset comparison rule is used to indicate that some fields are ignored during the comparison process, display the playback result corresponding to the target interface and the analysis entry corresponding to the playback result, and display the analysis data for analyzing the playback result in response to a trigger operation on the analysis entry. Since traffic playback can be performed based on the recorded traffic, the playback ability can be provided for users to directly perform business regression testing on the traffic. Since the playback result and the visualization analysis page can be displayed, it provides strong data support for online problem troubleshooting, real-time business monitoring planning, and security risk assessment, and can facilitate and quickly perform online problem troubleshooting, thus significantly improving the testing efficiency.
[0123] In some embodiments, the above-mentioned traffic playback device further includes a comparison rule creation module, which is configured to obtain a preset comparison rule template, where the comparison rule template includes a comparison rule description item and an interface description item; determine the target field type and the target field corresponding to the target field type through the comparison rule description item; determine the interface description information of the target interface through the interface description item; determine the preset comparison rule based on the target field type, the target field corresponding to the target field type, and the interface description information. The preset comparison rule is used to indicate that the comparison of the target field corresponding to the target field type is ignored during the traffic playback process of the target interface.
[0124] In some embodiments, the interface description item includes a first environment description item, an interface type item, and an interface address item. The comparison rule creation module is further configured to determine the first environment description information corresponding to the target interface through the first environment description item in the interface description item; determine the interface type corresponding to the target interface through the interface type item in the interface description item; determine the interface address corresponding to the target interface through the interface address item in the interface description item; determine the interface description information based on the first environment description information, the interface type, and the interface address..
[0125] In some embodiments, the second response data acquisition module is further configured to: obtain a playback rule based on the playback rule identifier carried in the traffic playback task; perform traffic playback according to the playback rule based on the recorded traffic corresponding to the target interface, and obtain second response data.
[0126] In some embodiments, the above traffic playback device further includes: a playback rule creation module, configured to obtain a preset playback rule template, where the playback rule template includes a rule identifier item and a second environment description item; determine a playback rule identifier through the rule identifier item; determine second environment description information corresponding to the environment to which the traffic playback needs to be replayed through the second environment description item; and generate a playback rule according to the playback rule identifier and the second environment description information.
[0127] In some embodiments, the playback result display module is further configured to display an interaction page corresponding to the traffic playback task, and display a task details entry on the interaction page; in response to a first trigger operation on the task details entry, display at least one playback details viewing entry corresponding to the target interface; and in response to a second trigger operation on any one of the playback details viewing entries, display the playback result of the target interface corresponding to the playback details viewing entry and an analysis entry corresponding to the playback result.
[0128] In some embodiments, the playback details viewing entry is displayed on the task details display page; the playback result display module is further configured to display at least one re-playback mark corresponding to each target interface on the task details display page; in response to a third trigger operation on any one of the re-playback marks, determine the target interface corresponding to the re-playback mark targeted by the third trigger operation; and re-perform traffic playback based on the recorded traffic corresponding to the determined target interface.
[0129] Each module in the above traffic playback device can be implemented in whole or in part by software, hardware, and their combination. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above respective modules.
[0130] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as Figure 15As shown in the figure. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O), and a communication interface. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store relevant data during the traffic playback process. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals through a network connection. When the computer program is executed by the processor, it realizes the traffic playback method provided by the embodiments of the present application.
[0131] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as Figure 16 shown in the figure. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit, and an input device. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface, the display unit, and the input device are connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals in a wired or wireless manner. The wireless manner can be implemented through WIFI, a mobile cellular network, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it realizes the traffic playback method provided by the embodiments of the present application. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covering the display screen, or a button, a trackball, or a touchpad provided on the housing of the computer device, or an external keyboard, touchpad, or mouse, etc.
[0132] Those skilled in the art can understand that Figure 15 、 Figure 16The structure shown is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements. In an exemplary embodiment, a computer device is provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, the steps of the traffic playback method in any of the above embodiments are implemented.
[0133] In some embodiments, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the traffic playback method in any of the above embodiments are implemented.
[0134] In some embodiments, a computer program product is provided, including a computer program. When the computer program is executed by a processor, the steps of the traffic playback method in any of the above embodiments are implemented.
[0135] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with relevant regulations.
[0136] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memories. Non-volatile memories can include read-only memory (ROM), magnetic tapes, floppy disks, flash memories, optical memories, high-density embedded non-volatile memories, resistive random access memories (ReRAMs), magnetoresistive random access memories (MRAMs), ferroelectric random access memories (FRAMs), phase change memories (PCMs), graphene memories, etc. Volatile memories can include random access memory (RAM) or external cache memories, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in the present application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in the present application can be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logics, data processing logics based on quantum computing, etc., without limitation.
[0137] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope recorded in this specification.
[0138] The above-described embodiments merely represent several implementation manners of the present application. Their descriptions are relatively specific and detailed, but they should not be construed as limiting the patent scope of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.
Claims
1. A traffic playback method, characterized in that, The method includes: Based on the recorded traffic identifier carried in the traffic playback task, obtain the recorded traffic corresponding to the target interface and the first response data corresponding to the recorded traffic; Perform traffic playback on the target interface based on the recorded traffic corresponding to the target interface to obtain second response data; Compare the first response data and the second response data according to a preset comparison rule, and determine the playback result corresponding to the target interface based on the comparison result; the preset comparison rule is used to indicate that some fields are ignored during the comparison process; Display the playback result corresponding to the target interface and the analysis entry corresponding to the playback result; In response to a trigger operation on the analysis entry, display the analysis data for analyzing the playback result.
2. The method according to claim 1, characterized in that The preset comparison rule is created through a comparison rule creation step, and the comparison rule creation step includes: Obtain a preset comparison rule template, where the comparison rule template includes a comparison rule description item and an interface description item; Determine the target field type and the target field corresponding to the target field type through the comparison rule description item; Determine the interface description information of the target interface through the interface description item; Based on the target field type, the target field corresponding to the target field type, and the interface description information, determine a preset comparison rule, which is used to indicate that the comparison of the target field corresponding to the target field type is ignored during the traffic playback process of the target interface.
3. The method according to claim 2, wherein The interface description item includes a first environment description item, an interface type item, and an interface address item. The determining of the interface description information of the target interface through the interface description item includes: Determine the first environment description information corresponding to the target interface through the first environment description item; Determine the interface type corresponding to the target interface through the interface type item; Determine the interface address corresponding to the target interface through the interface address item; Determine the interface description information based on the first environment description information, the interface type, and the interface address.
4. The method according to claim 1, wherein The performing of traffic playback on the target interface based on the recorded traffic corresponding to the target interface to obtain second response data includes: Obtain a playback rule based on the playback rule identifier carried in the traffic playback task; Perform traffic playback according to the playback rule based on the recorded traffic corresponding to the target interface to obtain the second response data.
5. The method according to claim 4, wherein The playback rule is created through a playback rule creation step, and the playback rule creation step includes: Obtain a preset playback rule template, where the playback rule template includes a rule identifier item and a second environment description item; Determine the playback rule identifier through the rule identifier item; Determine the second environment description information corresponding to the environment to which the traffic playback needs to be replayed through the second environment description item; Generate the playback rule according to the playback rule identifier and the second environment description information.
6. The method according to claim 1, wherein The displaying of the playback result corresponding to the target interface and the analysis entry corresponding to the playback result includes: Display the interactive page corresponding to the traffic playback task, and display a task details entry on the interactive page; In response to a first trigger operation for the task details entry, display a playback details viewing entry corresponding to at least one target interface; In response to a second trigger operation for any playback details viewing entry, display the playback result of the target interface corresponding to the playback details viewing entry and an analysis entry corresponding to the playback result.
7. The method according to claim 6, wherein The playback details viewing entry is displayed on the task details display page; the method further includes: Display a re-playback mark corresponding to each of the at least one target interface on the task details display page; In response to a third trigger operation for any of the re-playback marks, determine the target interface corresponding to the re-playback mark targeted by the third trigger operation; Re-perform traffic playback based on the recorded traffic corresponding to the determined target interface.
8. A traffic playback device, characterized in that, The apparatus includes: A first response data acquisition module, configured to acquire the recorded traffic corresponding to the target interface and the first response data corresponding to the recorded traffic based on the recorded traffic identifier carried in the traffic playback task; A second response data acquisition module, configured to perform traffic playback on the target interface based on the recorded traffic corresponding to the target interface to obtain second response data; A comparison module, configured to compare the first response data and the second response data according to a preset comparison rule, and determine the playback result corresponding to the target interface based on the comparison result; the preset comparison rule is used to indicate that some fields are ignored during the comparison process; A playback result display module, configured to display the playback result corresponding to the target interface and an analysis entry corresponding to the playback result; A playback result analysis module, configured to display analysis data for analyzing the playback result in response to a trigger operation for the analysis entry.
9. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, the steps of the method according to any one of claims 1 to 7 are implemented.
11. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, the steps of the method according to any one of claims 1 to 7 are implemented.