A program problem locating method, device, electronic device and storage medium

By recording and reporting the input parameters and output results of programs in the production environment in the application, the problems of high cost, high risk and low efficiency of program problem positioning in the prior art are solved, and efficient and accurate problem positioning and troubleshooting are achieved.

CN113760696BActive Publication Date: 2025-02-21BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010628352.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-07-01
Publication Date
2025-02-21
Estimated Expiration
2040-07-01

AI Technical Summary

Technical Problem

In the prior art, the program problems are positioned in the production environment with high cost, high risk, low efficiency and low accuracy.

Method used

By detecting the trigger operation of the preset service during the application operation, executing the service code and recording the input parameters and output results of the target method function, then reporting these data to the server for storage, so as to subsequent troubleshooting and positioning.

Benefits of technology

It realizes low-cost, low-risk, efficient and accurate positioning and investigation of production environment problems, eliminates data dependence on external services, and provides real and accurate problem data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113760696B_ABST
    Figure CN113760696B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a method, device, electronic device and storage medium for locating program problems. The method includes: during the operation of an application, if a trigger operation on a preset service is detected, the function of the preset service is implemented by executing the service code of the preset service, and the input parameters and output results of the target method function in the service code are recorded; the recorded input parameters and output results of the target method function are reported to the server for storage, so as to troubleshoot and locate the operation problems of the preset service according to the stored content. Through the technical solution of the embodiment of the present invention, the flow data at the time when the problem occurs in the production environment is recorded, as well as the on-site snapshot, and stored, which quickly provides the problem data required for reproduction, eliminates the data dependence on external services, and achieves the effect of low-cost, low-risk, efficient and accurate positioning and troubleshooting of problems in the production environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to computer technology, and in particular to a program problem locating method, apparatus, device and storage medium. Background Art

[0002] When problems occur in a software system in a production environment, i.e., an online operating environment, they are usually very hidden and require precise investigation and location of the cause of the problem in order to locate the location of the code that caused the problem.

[0003] At present, there are two main solutions for accurately troubleshooting and locating the cause of the problem. One is to reproduce the program code in the development environment or test environment and use local development tools to debug and troubleshoot separately. The other is to add functional code to implement log printing in the program and then redeploy the program to the production environment so that the program can perform log printing operations when running in the production environment, and then developers can troubleshoot and locate the problem based on the logs.

[0004] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:

[0005] The above two screening and positioning solutions both have the problems of high cost, high risk, low efficiency and low accuracy. Summary of the invention

[0006] The embodiments of the present invention provide a method, apparatus, device and storage medium for locating program problems, so as to record the flow data at the time when the problem occurs in the production environment, as well as the on-site snapshot, and store them, so as to quickly provide the problem data required for reproduction, eliminate the data dependence on external services, and achieve the effect of low-cost, low-risk, efficient and accurate positioning and troubleshooting of problems in the production environment.

[0007] In a first aspect, an embodiment of the present invention provides a method for locating a program problem, the method comprising:

[0008] During the running process of the application, if a triggering operation on a preset service is detected, the function of the preset service is implemented by executing the service code of the preset service, and the input parameters and output results of the target method function in the service code are recorded;

[0009] The recorded input parameters and output results of the target method function are reported to the server for storage, so as to troubleshoot and locate the operation problems of the preset service according to the stored content.

[0010] In a second aspect, an embodiment of the present invention further provides a method for locating a program problem, the method comprising:

[0011] When debugging a service code of a preset service in an application, obtaining input parameters and output results of a target method function in the service code from a server; wherein the input parameters and output results are recorded during the online operation of the application;

[0012] According to the obtained input parameters and output results of the target method function, the operation problem of the preset service is investigated and located.

[0013] In a third aspect, an embodiment of the present invention further provides a program problem locating device, the device comprising:

[0014] An information recording module is used to implement the function of the preset service by executing the service code of the preset service if a triggering operation on the preset service is detected during the operation of the application, and record the input parameters and output results of the target method function in the service code;

[0015] The first troubleshooting and locating module is used to report the recorded input parameters and output results of the target method function to the server for storage, so as to troubleshoot and locate the operation problem of the preset service according to the stored content.

[0016] In a fourth aspect, an embodiment of the present invention further provides a program problem location device, the device comprising:

[0017] An information acquisition module, used to acquire input parameters and output results of a target method function in the service code from a server when debugging the service code of a preset service in the application; wherein the input parameters and output results are recorded during the online operation of the application;

[0018] The second troubleshooting and locating module is used to troubleshoot and locate the operation problem of the preset service according to the obtained input parameters and output results of the target method function.

[0019] In a fifth aspect, an embodiment of the present invention further provides an electronic device, the electronic device comprising:

[0020] one or more processors;

[0021] A memory for storing one or more programs;

[0022] When the one or more programs are executed by the one or more processors, the one or more processors implement any program problem locating method described in any one of the embodiments of the present invention.

[0023] In a sixth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the program problem locating methods described in the embodiments of the present invention.

[0024] The technical solution of the embodiment of the present invention is that during the operation of the application program, when the user performs a trigger operation on a certain service, the server can execute the service code of the service to implement the function of the service, and record the input parameters and output results of the target method function in the service code of the service, so as to record the traffic data at the time when the problem occurs in the production environment, as well as the on-site snapshot, so as to achieve the effect of quickly providing the problem data required for reproduction, eliminating the data dependence on external services, and the data is real data, no manual preparation is required, and it is more authentic. After the input parameters and output results of the target method function of the preset service are written into the preset storage area for recording, the recorded input parameters and output results of the target method function are reported to the server for storage, so as to facilitate the subsequent troubleshooting and location of the operation problems of the stored preset service, thereby achieving the effect of low-cost, low-risk, efficient and accurate location and troubleshooting of problems in the production environment. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0026] Figure 1 is a flow chart of a method for locating a program problem provided in Embodiment 1 of the present invention;

[0027] Figure 2 Schematic diagram of the execution flow of the program problem location method provided in the first embodiment of the present invention;

[0028] Figure 3 It is a schematic diagram of the module structure of the program problem location method provided in the first embodiment of the present invention;

[0029] Figure 4 is a flow chart of a method for locating a program problem provided by Embodiment 2 of the present invention;

[0030] Figure 5 is a flow chart of a method for locating a program problem provided by Embodiment 3 of the present invention;

[0031] Figure 6 It is a schematic diagram of a model structure of a program problem location method provided in Embodiment 3 of the present invention;

[0032] Figure 7 Schematic diagram of the execution flow of the program problem location method provided in the third embodiment of the present invention;

[0033] Figure 8 is a flowchart of a method for locating a program problem provided in Embodiment 3 of the present invention;

[0034] Fig. 9 Schematic diagram of the model structure of another program problem location method provided in the third embodiment of the present invention;

[0035] Fig.10 is a schematic diagram of the structure of a program problem location device provided by a fourth embodiment of the present invention;

[0036] Fig.11 is a schematic diagram of the structure of a program problem location device provided in Embodiment 5 of the present invention;

[0037] Fig.12 It is a structural schematic diagram of an electronic device provided in Embodiment 6 of the present invention. DETAILED DESCRIPTION

[0038] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.

[0039] Embodiment 1

[0040] Figure 1 This is a flowchart of a program problem location method provided in Embodiment 1 of the present invention. This embodiment is applicable to the case of troubleshooting and locating problem data during the operation of an application program. The method can be executed by a program problem location method device, which can be implemented by software and / or hardware and integrated into a terminal with an application program. The method specifically includes the following steps:

[0041] S110. During the running of the application, if a triggering operation on a preset service is detected, the function of the preset service is implemented by executing the service code of the preset service, and the input parameters and output results of the target method function in the service code are recorded.

[0042] Exemplarily, the application program may be any application program, for example, it may be a client program of an e-commerce website, such as the JD application program.

[0043] The preset service can be any pre-set service, for example, it can be a service for submitting an order in the JD application. The triggering operation of the preset service can be a click operation on a certain control in the page. For example, taking the preset service as a service for submitting an order, the triggering operation of the preset service can be that the user clicks the "Submit Order" control in the JD application.

[0044] The target method function may be a method function in the service code that executes the preset service. The target method function here may include the entry method function of the preset service and other method functions called and executed by the entry method function. The entry method function here may be a main function of the preset service. Each service has an entry method function. When a service is triggered, the entry method function of the service is called. The other method functions here may be other method functions related to the service. For example, taking the preset service as the service for submitting an order as an example, when the user clicks the "Submit Order" control, the "Submit Order" service will have a corresponding entry method function. Other method functions may be functions for generating order numbers, functions for deducting inventory, functions for order entry, etc.

[0045] The input parameter can be, for example, when a user clicks to purchase a product, the user clicks the quantity control behind the product, and the input parameter for purchasing the service is generated in the service code. The output result can be the result obtained by calculating the input parameter through the target method function based on the input parameter. For example, taking the target method function as an addition function, when the user clicks the quantity control behind the product, for example, the user clicks the control twice, and each time the control is clicked, the quantity is increased by 1, then the input parameter 1 will be generated in the service code, and the target method function will be executed. The target method function will add the two input parameters 1 to get the output result, which is 2.

[0046] During the operation of the application, when the user performs a trigger operation on a service, the server can execute the service code of the service to implement the function of the service, and record the input parameters and output results of the target method function in the service code of the service. In this way, the traffic data at the time when the problem occurs in the production environment can be recorded, as well as the on-site snapshot, so as to quickly provide the problem data needed for reproduction and eliminate the data dependence on external services. Moreover, the data is real data and does not require manual preparation, so it is more authentic.

[0047] S120: reporting the recorded input parameters and output results of the target method function to the server for storage, so as to troubleshoot and locate the operation problems of the preset service according to the stored content.

[0048] Exemplary, reference Figure 2The execution flow diagram of the program problem locating method is as follows: based on the user's triggering operation on the preset service, the input parameters and output results of the target method function of the preset service are recorded, and the recorded input parameters and output results of the target method function are received, and written into the preset storage area for recording, and the recorded input parameters and output results of the target method function are reported to the server for storage. For example, they can be reported to the database of the server, for example, they can be stored in common databases such as HBase, ElasticSearch or MySQL, so that the subsequent operation problems of the preset service based on the storage can be investigated and located, thereby achieving the effect of low-cost, low-risk, efficient and accurate location and troubleshooting of problems in the production environment.

[0049] It should be noted that the reference Figure 3 The module structure diagram of the program problem location method described above, when recording the input parameters and output results of the target method function of the preset service, the input parameters and output results of the entry method function in the preset service and other method functions called and executed by the entry method function can be recorded and collected based on the traffic recorder, first temporarily stored in the local memory buffer, and then reported to the traffic dumper through the background thread. The traffic recorder needs to be deployed and embedded in the business system, and its internal is pure memory and asynchronous operation, which has almost no impact on system performance.

[0050] The traffic dumper can be responsible for receiving the entry method function in the preset service collected by the traffic recorder, as well as the input parameters and output results of other method functions called and executed by the entry method function, and storing them in the database. The traffic dumper can support common databases such as HBase, ElasticSearch and MySQL. This is a separate program.

[0051] Optionally, reporting the recorded input parameters and output results of the target method function to the server for storage may specifically include: reporting the recorded input parameters and output results of the target method function, and a trace ID assigned to the triggering operation to the server for storage.

[0052] Exemplarily, the tracking identifier here may be an identifier configured for a trigger operation of a preset service, and the identifier may be used to distinguish for which service the user has performed a trigger operation and the trigger time of the trigger operation.

[0053] Each time a user triggers a service, a tracking identifier is assigned to the trigger operation, so that the trigger time of the service corresponding to the stored input parameters and output results of the target method function can be distinguished based on the tracking identifier. The tracking identifier here can be a tracking ID, for example.

[0054] The technical solution of the embodiment of the present invention is that during the operation of the application program, when the user performs a trigger operation on a certain service, the server can execute the service code of the service to implement the function of the service, and record the input parameters and output results of the target method function in the service code of the service, so as to record the traffic data at the time when the problem occurs in the production environment, as well as the on-site snapshot, so as to achieve the effect of quickly providing the problem data required for reproduction, eliminating the data dependence on external services, and the data is real data, no manual preparation is required, and it is more authentic. After the input parameters and output results of the target method function of the preset service are written into the preset storage area for recording, the recorded input parameters and output results of the target method function are reported to the server for storage, so as to facilitate the subsequent troubleshooting and location of the operation problems of the stored preset service, thereby achieving the effect of low-cost, low-risk, efficient and accurate location and troubleshooting of problems in the production environment.

[0055] Embodiment 2

[0056] Figure 4 A flowchart of a program problem locating method provided for Embodiment 2 of the present invention, the embodiment of the present invention can be combined with each optional scheme in the above embodiments. In the embodiment of the present invention, optionally, the recording of the input parameters and output results of the target method function in the service code includes: writing the input parameters of the entry method function to a preset storage area by executing the input parameter recording code preset at the beginning position in the entry method function; for each other method function called and executed by the entry method function, writing the input parameters of the other method functions to a preset storage area by executing the input parameter recording code preset at the beginning position in the other method functions, and writing the output results of the other method functions to a preset storage area by executing the running result recording code preset at the end position in the other method functions; writing the output result of the entry method function to a preset storage area by executing the running result recording code preset at the end position in the entry method function.

[0057] like Figure 4 As shown, the method of the embodiment of the present invention specifically includes the following steps:

[0058] S210: During the running of the application program, if a triggering operation on a preset service is detected, the function of the preset service is implemented by executing the service code of the preset service.

[0059] S220. Write the input parameters of the entry method function into a preset storage area by executing the input parameter recording code preset at the beginning position of the entry method function; for each other method function called and executed by the entry method function, write the input parameters of the other method functions into a preset storage area by executing the input parameter recording code preset at the beginning position of the other method functions, and write the output results of the other method functions into the preset storage area by executing the operation result recording code preset at the end position of the other method functions; write the output result of the entry method function into the preset storage area by executing the operation result recording code preset at the end position of the entry method function.

[0060] Exemplarily, the input parameter recording code may be a program code for recording the input parameters, and the input parameters to be recorded may be recorded according to the program code.

[0061] Similarly, the running result recording code can be a program code for recording the output result obtained after the input parameters are calculated by the target method function. According to the program code, the output result obtained by the input parameters calculated by the target method function can be recorded.

[0062] It should be noted that at the beginning of the entry method function of each service, and other functions called and executed by the entry function, there is a code for recording input parameters. This code can be used to record the input parameters of the entry method function of the service and other functions called and executed by the entry function. Similarly, at the end of the entry method function of the service, and other functions called and executed by the entry function, there is also a running result recording code. This code can be used to record the output results calculated by the entry method function and other method functions called and executed by the entry method function of the service, respectively, for the input parameters of the entry method function of the service and other functions called and executed by the entry function.

[0063] The preset storage area may be a pre-set storage area that can store an entry method function of a service, as well as input parameters and output results of other functions called and executed by the entry function.

[0064] Each service has a thread to execute the target method function corresponding to the service, and each thread has its corresponding storage area. Therefore, the preset storage area here can also be understood as the memory area corresponding to the thread where the target method function of a service is located.

[0065] It should be noted that after the input parameters of the entry method function are written into the preset storage area, the other method functions executed by the entry method function call are executed. For each other method function executed by the entry method function call, when executing the input parameter recording code pre-set at the beginning position in other method functions, the input parameter recording code pre-set at the beginning position in other method functions is executed in the order in which the entry method function calls to execute other method functions. That is, first execute the input parameter recording code pre-set at the beginning position of one of the method functions, and then execute the running result recording code pre-set at the end position of the function in the method function. Then execute the input parameter recording code pre-set at the beginning position of another method function, and then execute the running result recording code pre-set at the end position of the function in the method function. And so on, until all other method function calls are executed.

[0066] For example, if the preset service is a service for submitting an order, there is an entry method function in the service, and other method functions executed by the entry method call. The other method functions here are three functions: the function for generating order numbers, the function for deducting inventory, and the function for order entry, and the execution order of these three functions is: the function for generating order numbers - the function for deducting inventory - the function for order entry. When recording the input parameters and output results of the target method function in the service code, first execute the input parameter recording code pre-set at the beginning of the entry method function of the service for submitting an order, and write the input parameter recording code at the beginning of the entry method function into the storage area of ​​the thread corresponding to the order submission. Then execute the input parameter recording code pre-set at the beginning of the function for generating an order number, write the input parameter recording code at the beginning of the function for generating an order number into the storage area of ​​the thread corresponding to the order submission, and then execute the running result recording code pre-set at the end of the function for generating an order number, and write the running result recording code at the end of the function for generating an order number into the storage area of ​​the thread corresponding to the order submission. Then execute the input parameter recording code pre-set at the beginning of the function of deducting inventory, and write the input parameter recording code at the beginning of the function of deducting inventory into the storage area of ​​the thread corresponding to the order submission. Then execute the running result recording code pre-set at the end of the function of deducting inventory, and write the running result recording code at the end of the function of deducting inventory into the storage area of ​​the thread corresponding to the order submission. Then execute the input parameter recording code pre-set at the beginning of the function of order entry, and write the input parameter recording code at the beginning of the function of order entry into the storage area of ​​the thread corresponding to the order submission. Then execute the running result recording code pre-set at the end of the function of order entry into the storage area, and write the running result recording code at the end of the function of order entry into the storage area of ​​the thread corresponding to the order submission. Finally, execute the running result recording code pre-set at the end of the entry method function of the service of submitting orders, and write the running result recording code at the end of the entry method function into the storage area of ​​the thread corresponding to the order submission.

[0067] It should be noted that when writing the input parameters and output results of the target method function of the preset service into the preset storage area, the input parameters and output results of the target method function of the preset service can be written into the stack of the preset service in sequence. For example, in the above example, the input parameter recording code of the entry method function for submitting an order is first written into the stack of the service thread; then the input parameter recording code and the running result recording code of the function for generating an order number are sequentially written into the stack of the service thread; then the input parameter recording code and the running result recording code of the function for deducting inventory are sequentially written into the stack of the service thread; then the input parameter recording code and the running result recording code of the function for entering an order into the warehouse are sequentially written into the stack of the service thread; finally, the running result recording code of the entry method function for submitting an order is written into the stack of the service thread.

[0068] In this way, the input parameters and output results of the target method function of the preset service are recorded in an orderly manner, as well as the on-site snapshot, ensuring that the input parameters and output results of the target method function of the preset service are recorded completely. At the same time, it also achieves the effect of quickly providing all the problem data required for reproduction, eliminating the data dependence on external services, and the data is real data, no manual preparation is required, and it is more authentic.

[0069] S230: reporting the recorded input parameters and output results of the target method function to the server for storage, so as to troubleshoot and locate the operation problems of the preset service according to the stored content.

[0070] The technical solution of the embodiment of the present invention ensures that the input parameters and output results of the target method function of the preset service are fully recorded by recording the input parameters and output results of the target method function of the preset service in an orderly manner and taking on-site snapshots. At the same time, it also achieves the effect of quickly providing all the problem data required for reproduction, eliminating the data dependence on external services, and the data is real data, does not need to be manually prepared, and is more authentic.

[0071] Embodiment 3

[0072] Figure 5 This is a flowchart of a program problem location method provided in Embodiment 3 of the present invention. This embodiment is applicable to the case of troubleshooting and locating problem data during the operation of an application program. The method can be executed by a program problem location method device, which can be implemented by software and / or hardware and integrated into a terminal with an application program. The method specifically includes the following steps:

[0073] S310. When debugging the service code of a preset service in an application, the input parameters and output results of the target method function in the service code are obtained from the server; wherein the input parameters and output results are recorded during the online operation of the application.

[0074] Exemplarily, the application program may be any application program, for example, it may be a client program of an e-commerce website, such as the JD application program.

[0075] The preset service may be any pre-set service, for example, a service for submitting an order in the JD application.

[0076] The target method function may be a method function in the service code that executes the preset service. The target method function here may include the entry method function of the preset service and other method functions called and executed by the entry method function. The entry method function here may be a main function of the preset service. Each service has an entry method function. When a service is triggered, the entry method function of the service is called. The other method functions here may be other method functions related to the service. For example, taking the preset service as the service for submitting an order as an example, when the user clicks the "Submit Order" control, the "Submit Order" service will have a corresponding entry method function. Other method functions may be functions for generating order numbers, functions for deducting inventory, functions for order entry, etc.

[0077] An input parameter can be, for example, when a user clicks to purchase a product, the user clicks on the quantity control behind the product, and the input parameter for purchasing the service is generated in the service code. The output result can be the result obtained by calculating the input parameter through the target method function based on the input parameter. For example, taking the target method function as a plus function, when the user clicks on the quantity control behind the product, for example, the user clicks on the control twice, and each time the control is clicked, the quantity is increased by 1, then the input parameter 1 will be generated in the service code, and the target method function will be executed. The target method function will add the input parameter 1 twice to get the output result, which is 2. The input parameters and output results here are all recorded during the online operation of the application.

[0078] When a problem occurs during the online operation of an application, the service code of the preset service in the application needs to be debugged to find the specific location of the problem code. Therefore, it is necessary to first obtain the service code of the preset service of the application running the problem. Since the input parameters and output results of the target method function in the service code of the preset service can be recorded during the online operation of the application, the input parameters and output results of the target method function in the service code can be obtained from the server. This allows for subsequent debugging of the input parameters and output results of the obtained target function.

[0079] Optionally, the obtaining of the input parameters and output results of the target method function in the service code from the server may specifically be: sending a recording information query request to the server, the recording information query request including an input tracking identifier, so that the server calls a preset recording data query service according to the tracking identifier to obtain the input parameters and output results of the target method function corresponding to the tracking identifier; and receiving the input parameters and output results of the target method function returned by the server.

[0080] Exemplarily, the recording information query request may be a request command for querying recording information, for example, it may be a request command for querying the input parameters and output results of a target method function in a service for submitting an order in JD.com.

[0081] The tracking identifier may be an identifier configured for the trigger operation of a preset service, and the identifier may be used to distinguish the service for which the user has performed the trigger operation and the trigger time.

[0082] The preset recorded data query service may be a pre-set service for querying recorded data.

[0083] refer to Figure 6 The module structure diagram of the program problem location method described above takes the preset service as the service for submitting an order as an example. When the user clicks the "Submit Order" control, the operation of the service for submitting an order is triggered, and a tracking identifier is configured for the submitting order service. For example, the tracking identifier is 123X, and the user enters the tracking identifier into the preset recording data query service system. The preset recording data query service system can return the input parameters and output results of the target method function of the service corresponding to the tracking identifier to the user end according to the tracking identifier entered by the user. In this way, the data recorded in the production environment can be reproduced in the development environment, which solves the problem that the data needs to be prepared manually in the development environment in the prior art, causing the risk of polluting normal user data or being misused by normal users or being used by malicious users, and the prepared data cannot truly reflect the real scene. The embodiment of the present invention can repeatedly use the data recorded in the production environment, which will not cause additional risks to the production environment, reduce the risk and cost of subsequent data debugging, and improve the efficiency and accuracy of the subsequent problem data investigation and location.

[0084] It should be noted that the recording data query service provides query functions for recording information and is provided to the local development environment in the form of HTTP REST services to facilitate local development environment integration. This is a separate program that can also be deployed in conjunction with the traffic data dumper.

[0085] S320: According to the input parameters and output results of the obtained target method function, the operation problems of the preset service are investigated and located.

[0086] Exemplary, reference Figure 7 The execution flow diagram of the program problem location method is as follows: after obtaining the input parameters and output results of the target method function, the input parameters and output results of the target method function are restored, i.e., reproduced, and the input parameters and output results of the reproduced target method function are debugged to find the data with running problems. In this way, the recorded data of the reproduced production environment is used to debug it, which reduces the risk and cost of data debugging and improves the efficiency and accuracy of subsequent troubleshooting and location of problem data.

[0087] Optionally, based on the obtained input parameters and output results of the target method function, the operation problems of the preset service are troubleshooted and located, specifically: the obtained input parameters of the entry method function are input into the entry method function to trigger the execution of the service code; the first other method function called and executed by the entry method function is used as the current method function, and the obtained input parameters and output results of the current method function are output to determine whether the current method function is the problem code based on the output content; if a trigger operation to continue debugging is detected, the next other method function called and executed is used as the current method function, and the operation of outputting the obtained input parameters and output results of the current method function is returned to execute.

[0088] Exemplarily, the current method function may be a method function currently being debugged.

[0089] Taking the preset service for submitting an order as an example, if the service has an entry method function and other method functions called and executed by the entry method, the other method functions here are three functions: a function for generating an order number, a function for deducting inventory, and a function for entering the order into the warehouse. The execution order of these three functions is: function for generating an order number - function for deducting inventory - function for entering the order into the warehouse.

[0090] After obtaining the input parameters and output results of the target method function of the order submission service, the input parameters of the entry method function in the target method function are input into the entry method function to trigger the execution of the service code of the order submission service. The first other method function called by the entry method function, that is, the function of generating the order number, is used as the current method function, and the input parameters and output results of the function of generating the order number are output, so that the user can determine whether the function of generating the order number is a problematic code based on the output input parameters and output results of the function of generating the order number. If not, continue to debug the next other method function, that is, the function of deducting inventory, as the current method function, and the input parameters and output results of the function of deducting inventory are output, so that the user can determine whether the function of deducting inventory is a problematic code based on the output input parameters and output results of the function of deducting inventory. If not, then use the function of entering the order into the warehouse as the current method function to determine whether the input parameters and output results of the function of entering the order into the warehouse are problematic codes.

[0091] If the current method function is determined to be problematic based on the input parameters and output results of the output current method function, then there is no need to determine whether the input parameters and output results of other subsequent method functions are problematic. For example, if the function that generates order numbers is determined to be problematic based on the input parameters and output results of the output function that generates order numbers, then there is no need to determine whether the input parameters and output results of the function that deducts inventory and the input parameters and output results of the function that puts orders into storage are problematic.

[0092] It should be noted that it is the programmer who determines whether the input parameters and output results of the current method function are problematic codes. When the programmer determines that the input parameters and output results of the current method function are correct, the programmer executes a trigger operation to continue debugging the next other method function; if the programmer determines that the input parameters and output results of the current method function are problematic, the programmer executes the debugging work of the target method function of the service to end.

[0093] It should be noted that if Figure 6 As shown, when debugging the input parameters and output results of the target method function, the simulator is used to debug the input parameters and output results of the target method function. The simulator intercepts other method functions called by the entry method function in the program code to be debugged through aspect-oriented programming (Aspect Oriented Programming, AOP), obtains the corresponding recording data from the preset recording data query service system according to the tracking identifier, and directly returns the method result recorded at that time without executing the actual method call, thereby eliminating the dependence on other interface methods of the development environment.

[0094] This orderly judgment of whether the entry method function and other method functions called and executed by the entry method function are problematic codes ensures the complete debugging of the target method function of the preset service.

[0095] It should be noted that the technical solutions of the above-mentioned embodiment 1, embodiment 2 and the embodiment of the present invention can be combined, that is, the input parameters and output results of the target method function of the preset service are recorded in the production environment, and the recorded input parameters and output results of the target method function of the preset service are debugged in the development environment. Figure 8 The technical solution of the flowchart of the program problem location method described above, similarly, the module structure diagram of the program problem location method of the above-mentioned embodiment 1, embodiment 2 and the embodiment of the present invention is combined to form the following Fig. 9 A schematic diagram of the model structure of the program problem locating method.

[0096] The technical solution of the embodiment of the present invention is to obtain the input parameters and output results of the target method function in the service code from the server when debugging the service code of the preset service in the application, and to troubleshoot and locate the operation problems of the preset service according to the obtained input parameters and output results of the target method function. In this way, the data recorded in the production environment can be reproduced in the development environment, which solves the problem that the data in the prior art needs to be prepared manually in the development environment, causing the risk of polluting normal user data or being misused by normal users or being exploited by malicious users, and the prepared data cannot truly reflect the real scene. The data recorded in the production environment can be repeatedly used without generating additional risks to the production environment. The recorded data of the reproduced production environment is used to debug it, which reduces the risk and cost of data debugging and improves the efficiency and accuracy of troubleshooting and locating subsequent problem data.

[0097] The following is an embodiment of a program problem locating device provided by an embodiment of the present invention. The device and the program problem locating methods of the above-mentioned embodiments belong to the same inventive concept. For details not described in detail in the embodiment of the program problem locating device, reference can be made to the embodiment of the above-mentioned program problem locating method.

[0098] Embodiment 4

[0099] Fig.10 This is a schematic diagram of the structure of the program problem location device provided by the fourth embodiment of the present invention, such as Fig.10 As shown, the device includes: an information recording module 610 and a first screening and positioning module 620.

[0100] The information recording module 610 is used to implement the function of the preset service by executing the service code of the preset service if a triggering operation on the preset service is detected during the operation of the application, and record the input parameters and output results of the target method function in the service code;

[0101] The first troubleshooting and locating module 620 is used to report the recorded input parameters and output results of the target method function to the server for storage, so as to troubleshoot and locate the operation problem of the preset service according to the stored content.

[0102] Optionally, the target method function includes: an entry method function of the preset service, and other method functions called and executed by the entry method function.

[0103] Based on the technical solution of the embodiment of the present invention, the information recording module 610 is specifically used for:

[0104] Writing the input parameters of the entry method function into a preset storage area by executing the input parameter recording code preset at the beginning of the entry method function;

[0105] For each other method function called and executed by the entry method function, the input parameters of the other method function are written into the preset storage area by executing the input parameter recording code preset at the beginning position of the other method function, and the output results of the other method function are written into the preset storage area by executing the operation result recording code preset at the end position of the other method function;

[0106] By executing the running result recording code preset at the end position of the entry method function, the output result of the entry method function is written into the preset storage area.

[0107] Optionally, the preset storage area is a memory area corresponding to the thread where the target method function is located.

[0108] Based on the technical solution of the embodiment of the present invention, the first investigation and positioning module 620 is specifically used for:

[0109] The recorded input parameters and output results of the target method function, and the tracking identifier assigned to the triggering operation are reported to the server for storage.

[0110] Optionally, the application is a client program of an e-commerce website.

[0111] The program problem locating device provided in the embodiment of the present invention can execute the method provided in any of the first and second embodiments of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0112] It is worth noting that in the embodiment of the above-mentioned program problem locating device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.

[0113] Embodiment 5

[0114] Fig.11 This is a schematic diagram of the structure of the program problem location device provided in the fifth embodiment of the present invention, as shown in FIG. Fig.11 As shown, the device includes: an information acquisition module 710 and a second screening and positioning module 720.

[0115] The information acquisition module 710 is used to obtain the input parameters and output results of the target method function in the service code from the server when debugging the service code of the preset service in the application; wherein the input parameters and output results are recorded during the online operation of the application;

[0116] The second troubleshooting and locating module 720 is used to troubleshoot and locate the operation problem of the preset service according to the obtained input parameters and output results of the target method function.

[0117] Optionally, the target method function includes: an entry method function of the preset service, and other method functions called and executed by the entry method function.

[0118] Based on the technical solution of the embodiment of the present invention, the second investigation and positioning module 720 is specifically used for:

[0119] Inputting the acquired input parameters of the entry method function into the entry method function to trigger the execution of the service code;

[0120] The first other method function called and executed by the entry method function is taken as the current method function, and the input parameters and output results of the current method function are output to determine whether the current method function is a problematic code based on the output content; if a trigger operation to continue debugging is detected, the next other method function called and executed is taken as the current method function, and the operation of outputting the input parameters and output results of the current method function is returned to be executed.

[0121] Based on the technical solution of the embodiment of the present invention, the information acquisition module 710 is specifically used for:

[0122] Sending a recording information query request to the server, wherein the recording information query request includes an input tracking identifier, so that the server calls a preset recording data query service according to the tracking identifier to obtain input parameters and output results of a target method function corresponding to the tracking identifier;

[0123] Receive the input parameters and output results of the target method function returned by the server.

[0124] The program problem locating device provided in the embodiment of the present invention can execute the method provided in the third embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0125] It is worth noting that in the embodiment of the above-mentioned program problem locating device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.

[0126] Embodiment 6

[0127] Fig.12 A schematic diagram of the structure of an electronic device provided in Embodiment 6 of the present invention. Fig.12 A block diagram of an exemplary electronic device 12 suitable for use in implementing embodiments of the present invention is shown. Fig.12 The electronic device 12 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0128] like Fig.12 As shown, the electronic device 12 is in the form of a general purpose computing device. The components of the electronic device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that connects various system components (including the system memory 28 and the processing unit 16).

[0129] Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. By way of example, these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.

[0130] The electronic device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device 12, including volatile and non-volatile media, removable and non-removable media.

[0131] The system memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The electronic device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Fig.12 not shown, usually called a "hard drive"). Although Fig.12 Not shown in the figure, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The system memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present invention.

[0132] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. Program modules 42 generally perform the functions and / or methods of the embodiments described herein.

[0133] The electronic device 12 may also communicate with one or more external devices 14 (e.g., keyboards, pointing devices, displays 24, etc.), may communicate with one or more devices that enable a user to interact with the electronic device 12, and / or may communicate with any device that enables the electronic device 12 to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may be performed via an input / output (I / O) interface 22. Furthermore, the electronic device 12 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 20. As shown, the network adapter 20 communicates with other modules of the electronic device 12 via a bus 18. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0134] The processing unit 16 executes various functional applications and data processing by running the program stored in the system memory 28, for example, implementing a program problem location method provided by the embodiment of the present invention, the method comprising:

[0135] During the running process of the application, if a triggering operation on a preset service is detected, the function of the preset service is implemented by executing the service code of the preset service, and the input parameters and output results of the target method function in the service code are recorded;

[0136] The recorded input parameters and output results of the target method function are reported to the server for storage, so as to troubleshoot and locate the operation problems of the preset service according to the stored content. And / or,

[0137] When debugging a service code of a preset service in an application, obtaining input parameters and output results of a target method function in the service code from a server; wherein the input parameters and output results are recorded during the online operation of the application;

[0138] According to the obtained input parameters and output results of the target method function, the operation problem of the preset service is investigated and located.

[0139] Of course, those skilled in the art can understand that the processor can also implement the technical solution of the method for determining the reserved inventory amount provided in any embodiment of the present invention.

[0140] Embodiment 7

[0141] Embodiment 7 of the present invention provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the program problem location method steps as described in any embodiment of the present invention are implemented. The method includes:

[0142] During the running process of the application, if a triggering operation on a preset service is detected, the function of the preset service is implemented by executing the service code of the preset service, and the input parameters and output results of the target method function in the service code are recorded;

[0143] The recorded input parameters and output results of the target method function are reported to the server for storage, so as to troubleshoot and locate the operation problems of the preset service according to the stored content. And / or,

[0144] When debugging a service code of a preset service in an application, obtaining input parameters and output results of a target method function in the service code from a server; wherein the input parameters and output results are recorded during the online operation of the application;

[0145] According to the obtained input parameters and output results of the target method function, the operation problem of the preset service is investigated and located.

[0146] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.

[0147] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0148] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0149] Computer program code for performing the operations of the present invention may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0150] It should be understood by those skilled in the art that the modules or steps of the present invention described above can be implemented by a general-purpose computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, optionally, they can be implemented by a program code executable by a computer device, so that they can be stored in a storage device and executed by the computing device, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.

[0151] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

[0152] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. A method for locating a program problem, characterized in that: include: During the running process of the application, if a triggering operation on a preset service is detected, the function of the preset service is implemented by executing the service code of the preset service, and the input parameters and output results of the target method function in the service code are recorded; The output result is a result obtained by calculating the input parameter through the target method function; The target method function includes: the entry method function of the preset service, and other method functions called and executed by the entry method function; the preset service is any service in the application; Reporting the recorded input parameters and output results of the target method function to the server for storage, so as to troubleshoot and locate the operation problem of the preset service according to the stored content; The recording of the input parameters and output results of the target method function in the service code includes: Writing the input parameters of the entry method function into a preset storage area by executing the input parameter recording code preset at the beginning of the entry method function; For each other method function called and executed by the entry method function, the input parameters of the other method function are written into the preset storage area by executing the input parameter recording code preset at the beginning position of the other method function, and the output results of the other method function are written into the preset storage area by executing the operation result recording code preset at the end position of the other method function; By executing the running result recording code preset at the end position of the entry method function, the output result of the entry method function is written into the preset storage area.

2. The method according to claim 1, characterized in that: The preset storage area is the memory area corresponding to the thread where the target method function is located.

3. The method according to claim 1, characterized in that Reporting the recorded input parameters and output results of the target method function to the server for storage includes: The recorded input parameters and output results of the target method function, and the tracking identifier assigned to the triggering operation are reported to the server for storage.

4. The method according to any one of claims 1 to 3, characterized in that The application program is a client program of an e-commerce website.

5. A method for locating a program problem, characterized in that: include: When debugging the service code of a preset service in an application, the input parameters and output results of the target method function in the service code are obtained from the server; wherein the input parameters and output results are recorded during the online operation of the application; the output result is the result obtained by calculating the input parameters by the target method function; the target method function includes: the entry method function of the preset service, and other method functions called and executed by the entry method function; the preset service is any service in the application; According to the obtained input parameters and output results of the target method function, troubleshoot and locate the operation problem of the preset service; The step of recording the input parameters and output results during the online operation of the application program includes: Writing the input parameters of the entry method function into a preset storage area by executing the input parameter recording code preset at the beginning of the entry method function; For each other method function called and executed by the entry method function, the input parameters of the other method function are written into the preset storage area by executing the input parameter recording code preset at the beginning position of the other method function, and the output results of the other method function are written into the preset storage area by executing the operation result recording code preset at the end position of the other method function; By executing the running result recording code preset at the end position of the entry method function, the output result of the entry method function is written into the preset storage area.

6. The method according to claim 5, characterized in that According to the input parameters and output results of the target method function, the operation problem of the preset service is checked and located, including: Inputting the acquired input parameters of the entry method function into the entry method function to trigger the execution of the service code; The first other method function called and executed by the entry method function is taken as the current method function, and the input parameters and output results of the current method function are output to determine whether the current method function is a problematic code based on the output content; if a trigger operation to continue debugging is detected, the next other method function called and executed is taken as the current method function, and the operation of outputting the input parameters and output results of the current method function is returned to be executed.

7. The method according to claim 5, characterized in that Obtaining input parameters and output results of the target method function in the service code from the server, including: Sending a recording information query request to the server, wherein the recording information query request includes an input tracking identifier, so that the server calls a preset recording data query service according to the tracking identifier to obtain input parameters and output results of a target method function corresponding to the tracking identifier; Receive the input parameters and output results of the target method function returned by the server.

8. A program problem location device, characterized in that: include: An information recording module is used to implement the function of the preset service by executing the service code of the preset service if a triggering operation on the preset service is detected during the operation of the application, and record the input parameters and output results of the target method function in the service code; The output result is a result obtained by calculating the input parameter through the target method function; The target method function includes: the entry method function of the preset service, and other method functions called and executed by the entry method function; the preset service is any service in the application; A first troubleshooting and locating module, used to report the recorded input parameters and output results of the target method function to the server for storage, so as to troubleshoot and locate the operation problem of the preset service according to the stored content; The information recording module is specifically used to write the input parameters of the entry method function into a preset storage area by executing the input parameter recording code preset at the beginning position of the entry method function; For each other method function called and executed by the entry method function, the input parameters of the other method function are written into the preset storage area by executing the input parameter recording code preset at the beginning position of the other method function, and the output results of the other method function are written into the preset storage area by executing the operation result recording code preset at the end position of the other method function; By executing the running result recording code preset at the end position of the entry method function, the output result of the entry method function is written into the preset storage area.

9. A program problem location device, characterized in that: include: An information acquisition module is used to acquire input parameters and output results of a target method function in the service code from a server when debugging the service code of a preset service in an application; wherein the input parameters and output results are recorded during the online operation of the application; the output result is a result obtained by calculating the input parameters by the target method function; the target method function includes: an entry method function of the preset service, and other method functions called and executed by the entry method function; the preset service is any service in the application; A second troubleshooting and locating module is used to troubleshoot and locate the operation problem of the preset service according to the input parameters and output results of the target method function obtained; The step of recording the input parameters and output results during the online operation of the application program includes: Writing the input parameters of the entry method function into a preset storage area by executing the input parameter recording code preset at the beginning of the entry method function; For each other method function called and executed by the entry method function, the input parameters of the other method function are written into the preset storage area by executing the input parameter recording code preset at the beginning position of the other method function, and the output results of the other method function are written into the preset storage area by executing the operation result recording code preset at the end position of the other method function; By executing the running result recording code preset at the end position of the entry method function, the output result of the entry method function is written into the preset storage area.

10. An electronic device, characterized in that: The electronic device comprises: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the program problem locating method as described in any one of claims 1-4, and / or the program problem locating method as described in any one of claims 5-7.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the program implements the program problem locating method as described in any one of claims 1-4, and / or the program problem locating method as described in any one of claims 5-7.

Citation Information

Patent Citations

  • Method and system for automatically reproducing and positioning software error

    CN102184138A

  • Method for debugging storage software by using tracing function and analyzing tool

    CN106940681A