CN116302917A - Flow recording method and device, storage medium and electronic equipment - Google Patents

Flow recording method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN116302917A
CN116302917A CN202211098089.0A CN202211098089A CN116302917A CN 116302917 A CN116302917 A CN 116302917A CN 202211098089 A CN202211098089 A CN 202211098089A CN 116302917 A CN116302917 A CN 116302917A
Authority
CN
China
Prior art keywords
function
program
tested
flow
objective function
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211098089.0A
Other languages
Chinese (zh)
Inventor
张锐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alipay Hangzhou Information Technology Co Ltd
Original Assignee
Alipay Hangzhou Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alipay Hangzhou Information Technology Co Ltd filed Critical Alipay Hangzhou Information Technology Co Ltd
Priority to CN202211098089.0A priority Critical patent/CN116302917A/en
Publication of CN116302917A publication Critical patent/CN116302917A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3624Software debugging by performing operations on the source code, e.g. via a compiler
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/316Aspect-oriented programming techniques
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Computing Systems (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the specification determines a function to be tested in a service application program and a tangent point of the function to be injected with a tangent plane program, and then the tangent plane program is injected into the function to acquire parameters corresponding to the objective function in the process of calling the function by the service application program through the tangent plane program so as to record the flow. In the method, the section program is decoupled from the service application program, and the system resource used when the section program records the flow is irrelevant to the system resource for executing the service application program, so that the operation of the section program does not occupy the resource for operating the service application program, and the section program can record the flow on the basis of ensuring that the service application program normally executes the service, thereby improving the efficiency of recording the flow.

Description

Flow recording method and device, storage medium and electronic equipment
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and apparatus for recording traffic, a storage medium, and an electronic device.
Background
In an automatic test scene, regression test or pressure test is carried out on the application system, so that the safety and stability of the application system can be verified. The regression test or the pressure test can test the application interface of the application system to prevent the application interface from having problems such as revealing user privacy data.
The flow recording method adopted in the prior art has lower efficiency of recording the flow.
Disclosure of Invention
An embodiment of the present disclosure provides a method, an apparatus, a storage medium, and an electronic device for recording a flow, so as to partially solve the problems in the prior art.
The embodiment of the specification adopts the following technical scheme:
the flow recording method provided by the specification comprises the following steps:
determining an objective function in a service application program and determining a tangent point of the objective function, which needs to be injected with a tangent plane program for flow recording;
injecting the tangent plane program into the objective function according to the tangent point;
and in the running process of the service application program, acquiring parameters corresponding to the objective function in the process of calling the objective function by the service application program through the tangent plane program so as to record the flow.
Optionally, determining a tangent point in the objective function, where the tangent plane procedure needs to be injected, specifically includes:
detecting a code starting position and a code ending position of the objective function;
and determining a tangent point to be injected into the tangent plane program in the objective function according to the code starting position and the code ending position.
Optionally, collecting, by the tangent plane program, parameters corresponding to the objective function in the process that the service application program calls the objective function, specifically including:
collecting the incoming parameters of the objective function when the business application program calls the objective function through a tangent plane program injected into the code starting position of the objective function;
and acquiring a return value after the objective function is executed based on the input parameter through a tangent plane program injected into a code end position in the objective function, and storing the input parameter and the return value.
Optionally, the step of storing the incoming parameter and the return value specifically includes:
and storing the incoming parameters and the return value in a structured data format.
Optionally, the method further comprises:
receiving a flow playback request;
According to the flow playback request, determining a function to be tested in a service application program and target flow which is required to be played back for the function to be tested;
updating the historical input parameters contained in the target flow into the function to be tested through a tangent plane program injected into the function to be tested, executing the function to be tested based on the historical input parameters, obtaining a target return value after executing the function to be tested, and testing the function to be tested according to the target return value.
Optionally, updating the historical input parameters included in the target flow into the function to be tested through a tangent plane program injected into the function to be tested, which specifically includes:
updating the historical input parameters contained in the target flow into the function to be tested through a tangent plane program injected into the code starting position in the function to be tested;
executing the function to be tested based on the historical input parameters to obtain a target return value after executing the function to be tested, wherein the method specifically comprises the following steps:
after the function to be tested is executed based on the historical input parameters, acquiring a target return value after the function to be tested is executed through a tangent plane program injected into the code end position in the function to be tested.
Optionally, according to the target return value, testing the function to be tested specifically includes:
comparing the target return value with a historical return value contained in the target flow;
if the target return value is the same as the historical return value, determining that the function to be tested is normal;
and if the target return value is different from the historical return value, determining that the function to be tested is abnormal.
The flow recording device provided in the present specification includes:
the determining module is used for determining an objective function in the service application program and determining a tangent point of the objective function, which is needed to be injected with a tangent plane program for flow recording;
the injection module is used for injecting the tangent plane program into the objective function according to the tangent point;
and the flow recording module is used for acquiring parameters corresponding to the objective function in the process of calling the objective function by the service application program through the tangent plane program in the running process of the service application program so as to record the flow.
A computer readable storage medium is provided in the present specification, where the storage medium stores a computer program, and the computer program implements the above-mentioned flow recording method when executed by a processor.
The electronic device provided by the specification comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor realizes the flow recording method when executing the program.
The above-mentioned at least one technical scheme that this description embodiment adopted can reach following beneficial effect:
in the embodiment of the specification, an objective function in a service application program and a tangent point in the objective function, in which a tangent plane program needs to be injected, are determined, and then the tangent plane program is injected into the objective function, so that parameters corresponding to the objective function in the process that the objective function is called by the service application program are collected through the tangent plane program, and flow recording is performed. In the method, the section program is decoupled from the service application program, and the system resource used when the section program records the flow is irrelevant to the system resource for executing the service application program, so that the operation of the section program does not occupy the resource for operating the service application program, and the section program can record the flow on the basis of ensuring that the service application program normally executes the service, thereby improving the efficiency of recording the flow.
Drawings
The accompanying drawings, which are included to provide a further understanding of the specification, illustrate and explain the exemplary embodiments of the present specification and their description, are not intended to limit the specification unduly. Attached at
In the figure:
fig. 1 is a flow chart of a flow recording method according to an embodiment of the present disclosure;
FIG. 2 is a schematic diagram of a procedure for injecting a slice into a function according to an embodiment of the present disclosure;
FIG. 3 is a flow chart of a function test method according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of a flow recording device according to an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the present specification more apparent, the technical solutions of the present specification will be clearly and completely described below with reference to specific embodiments of the present specification and corresponding drawings. It will be apparent that the described embodiments are only some, but not all, of the embodiments of the present specification. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are intended to be within the scope of the present disclosure.
The following describes in detail the technical solutions provided by the embodiments of the present specification with reference to the accompanying drawings.
In the embodiment of the present disclosure, the service traffic is recorded and played back through a section procedure related to the security section, so as to perform a pressure test, a regression test, or locate an occasional problem.
The above-mentioned security facet refers to a method for dynamically adding or modifying a facet program for implementing a security facet service in the running logic of a service application without modifying the service application by adopting a facet-oriented programming (Aspect-oriented Programming, AOP) manner. The method and the system have the advantages that the program for realizing the safe cut-plane service is decoupled from the service application program while the safe cut-plane service is realized, so that the development iteration problem caused by high coupling is avoided.
The procedure of cutting plane here is the enhancement procedure for realizing the safe cutting plane service based on the service operation logic. The method can inject the cutting program into the corresponding cutting point of the service application program in a cutting programming-oriented mode, and the cutting program is triggered to be executed in the process of executing the service application program, so that the required safe cutting service function is realized.
While the business application program executes the business, the business application program generally executes the business by calling between functions. Thus, any function in the business application may be used as a cut-in point for the tangent-plane procedure, i.e., the tangent-plane point described above, and the tangent-plane procedure may be injected into the corresponding tangent-plane point. And when the service application program is executed to the tangent point, namely, the function of the service application program corresponding to the tangent point is called, executing the tangent plane program injected at the tangent point.
In general, there is high reusability of code responsible for the process of injecting a slice program into a tangent point, and therefore, a program implementing this process is generally abstracted into one service module, i.e., a slice base. The section base can acquire the section program to be deployed and the section point in the service application program from a third party providing the security section service, is environment-friendly after the application container is started and injects the corresponding section program at the section point of the service application program.
The business application may be a business application that provides business services in a server of a business platform. The service may be a service provided by a server of the service platform to a user, such as a query service, a payment service, and the like. The business service may also be a business service provided by a certain server of the business platform to other servers, such as a settlement business, etc.
It will be understood from the foregoing description that, in order to decouple the procedure of the security tangential service from the service application, the procedure of the security tangential service and the service application are interwoven in a manner facing to the tangential programming, but are parallel to each other and can be maintained independently when the service is executed. Thus, unlike the service provider of the service application, a third party providing the security facet service may manage content related to the security facet service through the management platform, e.g., configuration of security facet service management policies, version iterations of the facet procedure, deployment rule configuration of the facet procedure, etc. Of course, the security cut-plane service may be provided by a third party or may be provided by a service provider.
When the management and control platform manages the content related to the security cut-plane service, various configuration information, such as configuration of various strategies, deployment rule configuration of the cut-plane program and the like, can be recorded through configuration files. The tangent plane base can complete the deployment of the tangent plane program according to the configuration file, or the control platform can realize the safe tangent plane service according to the configuration file.
In practical applications, a service provider is typically provided with a machine room comprising several physical machines or physical servers, through which the physical resources required by the service application are provided. Of course, a business application may not require all of the physical resources of the entire physical machine, and thus, multiple virtual hosts (virtual hosts) will typically also run on a physical machine through virtualization techniques. The virtual hosts are mutually independent and share partial physical resources of physical machines. The application container may then be deployed in the virtual host and the business application is run through the application container. An application container typically contains physical resources, such as CPU, memory, etc., allocated to the application container, and a runtime environment, such as an Operating System (OS) or other runtime environment data, such as a Serial Number (SN) Number of the container, an allocated IP (Influential Property), an application name, tenant, environment variable, etc., provided to the application container. Business applications may be deployed in an application container to execute a business.
In the scenario of executing the service based on the security facet, the service provider or the server of the third party providing the security facet service may provide a management and control platform, manage the content related to the security facet service through the management and control platform, and deploy the facet base in the application container, and inject the facet program into the service application program in the service application container through the facet base, so as to provide support of the security facet service for the application container of the service provider.
Thus, the slice base may be deployed in advance in the application container of the service provider. In general, when an application container is started, an operating system provided for the application container may be evoked, and a pre-deployed tangent plane base is operated, through which tangent points of a tangent plane program and a service application program are obtained from a management and control platform, and the tangent plane program is injected into the application container at the tangent point of the service application program. In addition, the tangent plane base can also obtain tangent points of the tangent plane program and the service application program from the management and control platform in the execution process of the service application program, and inject the tangent plane program into the tangent point of the service application program in the application container.
Of course, how the tangent plane base obtains the information needed by the deployment tangent plane procedure from the management and control platform can be set according to the requirement. For example, the required information can be actively pulled from the control platform according to the configuration file, or the control platform can actively issue the required information to enable the section base to receive the required information.
After the cutting procedure is injected into the cutting point of the service application program, the service application program can trigger the cutting procedure in the execution process, thereby realizing the corresponding safe cutting service function.
In the embodiment of the present specification, the function implemented by the section procedure is: traffic recording and playback. The broad definition of flow is: requests and responses generated by the business application running process. The definition of traffic at the code level is: the business application program generates various parameters in the process of calling each function. The various parameters include at least: the incoming parameters of the function, the return values of the function, etc.
Next, flow recording and flow playback will be described, respectively.
Fig. 1 is a schematic flow chart of a flow recording method provided in the present specification, including:
s100: and determining an objective function in the service application program and determining a tangent point of the objective function, which is needed to be injected with a tangent plane program for flow recording.
S102: and injecting the tangent plane program into the objective function according to the tangent point.
S104: and in the running process of the service application program, acquiring parameters corresponding to the objective function in the process of calling the objective function by the service application program through the tangent plane program so as to record the flow.
In the embodiment of the present disclosure, the method for recording traffic is applied to a server, where the server is configured to execute a service, and the service may include: payment services, inquiry services, etc. The server runs the service application program in the process of executing the service, and various functions are called in the process of running the service application program so as to realize the service function. The business application program is composed of a plurality of functions, and each function is composed of a plurality of code sentences.
In the embodiment of the present disclosure, before recording the traffic during the running process of the service application, the slice program for implementing the traffic recording and playback function needs to be injected into the service application.
Specifically, the server responds to the request of flow recording and playback, determines a tangent plane program for flow recording and playback, and determines a tangent point of injection of the tangent plane program. Then, according to the tangent point, the tangent plane procedure is injected to the position corresponding to the tangent point. The slice program may be a code block written in a code language such as Java, node. Js, c#, c++, or the like. The tangent point of the injection tangent plane procedure may refer to the location of the code statement in the function that needs to be tested.
When determining the tangent point of the injection tangent plane program, the objective function to be tested in the service application program can be determined first, and then the position of the code statement to be injected into the tangent plane program in the objective function can be determined as the tangent point.
Further, after determining the objective function to be tested, the starting position of the code statement of the objective function may be detected first as the code starting position, and the ending position of the code statement of the objective function may be detected as the code ending position. And then determining the tangent point of the objective function, which needs to be injected into the tangent plane program, according to the code starting position and the code ending position.
Specifically, the code start position and the code end position may be respectively used as the tangent points of the injection tangent plane procedure. The position corresponding to the nth code sentence after the code starting position can be used as the tangent point of the injection tangent plane program, and the position corresponding to the nth code sentence before the code ending position can be used as the tangent point of the injection tangent plane program, wherein N is a positive integer.
After determining the tangent point, the tangent plane procedure is injected into the objective function at a location corresponding to the tangent point. As shown in fig. 2.
In fig. 2, in the function fun1, "info=xxx; "is the code starting position of function fun1," Return info; "is the code end position of the function fun 1. The position between the code start position and the second code statement may be referred to as the tangent point sigBefore, and the position between the code end position and the penultimate code statement may be referred to as the tangent point sigReturn.
After the tangent plane program is injected into the objective function, parameters corresponding to the objective function in the process of calling the objective function by the business application program (i.e. parameters generated by the objective function in the process of calling the objective function by the business application program) are collected through the tangent plane program in the running process of the business application program, so that flow recording is performed.
Specifically, in the running process of the service application program, the service application program collects the incoming parameters of the incoming target function when the service application program calls the target function through the section program injected into the code starting position in the target function, and records the collection time for collecting the incoming parameters. And then, acquiring a return value after the target function is executed based on the input parameter by a section program injected into the code end position in the target function, and recording the acquisition time of acquiring the return value. As shown in fig. 2. Finally, the incoming parameters and return values are saved.
In fig. 2, time=t1 at the tangent point sigbetue represents an incoming parameter that is entered when the tangent plane program collects the service application call function fun1 at time t1, and time=t2 at the tangent point sigReturn represents a return value after the tangent plane program collects the execution function fun1 at time t 2.
In the embodiment of the specification, the tangent plane program only collects the input parameters of the calling function and the return values after the function is executed, so that the collected data volume is reduced, and the collection efficiency of the tangent plane program can be increased, namely, the flow recording efficiency is improved. In addition, the section program is decoupled from the service application program, and the system resource used by the section program in the flow recording process is irrelevant to the system resource for executing the service application program, so that the running of the section program does not occupy the resource for running the service application program, and the section program can record the flow on the basis of ensuring that the service application program normally executes the service, thereby improving the flow recording efficiency of the section program and the execution efficiency of the service application program.
In addition, before the flow recording, the control platform sends a flow recording request to the server, and after the server receives the flow recording request, the tangent plane program injected in the objective function is switched to a flow recording state based on the flow recording request. And then, recording the flow by the section program in the running process of the service application program.
Or the server detects whether the current moment is in a first period in real time, wherein the first period can be a period of flow corresponding to the objective function in the process that the tangent plane program acquisition service application program calls the objective function. And if the current moment is in the first period, switching the section program to a flow recording state.
The server can respond to the configuration information by manual configuration, and the tangent plane program injected in the objective function is switched to the flow recording state.
In addition, when the incoming parameters and return values are saved, the incoming parameters and return values may be saved in a structured data format. Such as: JSON, etc. In this way, the storage amount can be reduced without occupying too much memory space.
Since the recorded incoming parameters and return values of the flow are required for verification of subsequent playback of the flow, an association relationship between the incoming parameters and return values in the same function needs to be established when the incoming parameters and return values are saved.
Specifically, for each objective function in the business application program, the identification of the tangent plane program injected into the objective function is determined. Then, when the business application program calls the objective function, the association relation between the identification of the tangent plane program for collecting the input parameters and the input parameters is established. Similarly, an association relationship between the identification of the tangent plane procedure for collecting the return value and the return value is established. And finally, according to the acquisition time of acquiring the input parameters and the acquisition time of acquiring the return values, determining the corresponding relation between the input parameters and the return values corresponding to the objective function in the process of calling the objective function by the service application program in each calling period.
After the flow recording is performed on the objective function, the problem can be manually checked based on the recorded flow, or the recorded flow is used as training data to train the objective model. The target model may refer to a model for executing a target service, among other things.
After the flow recording is performed on the objective function, the flow playback can be performed based on the recorded flow, and the objective function in the service application program is tested to judge whether the operation of the objective function is abnormal or not. Wherein the testing may comprise: pressure testing, regression testing, etc.
Next, a method of testing a function by the security cut will be described.
Fig. 3 is a schematic flow chart of a function test method provided in the present specification, including:
s300: a traffic playback request is received.
S302: and determining a function to be tested in the service application program and target flow which is required to be played back for the function to be tested according to the flow playback request.
S304: updating the historical input parameters contained in the target flow into the function to be tested through a tangent plane program injected into the function to be tested, executing the function to be tested based on the historical input parameters, obtaining a target return value after executing the function to be tested, and testing the function to be tested according to the target return value.
In the embodiment of the present specification, the method of function test is applied to a server for executing a service. When regression testing, pressure testing or positioning of occasional problems are needed, the management and control platform sends a flow playback request to the server. The flow regression request carries function index, playback time period and the like. And then, the server determines a function to be tested in the service application program and target flow which needs to be played back aiming at the function to be tested according to the received flow playback request. And finally, updating the historical input parameters contained in the target flow into the function to be tested through a tangent plane program injected into the function to be tested so as to execute the function to be tested based on the historical input parameters, obtaining a target return value after the function to be tested is executed, and testing the function to be tested according to the target return value. The function to be tested may refer to a function to be tested currently, and may include an objective function of prerecorded flow.
When determining a function to be tested in the service application program and a target flow to be played back aiming at the function to be tested according to the flow playback request, determining the function to be tested in the service application program according to a function index carried in the flow playback request. And then determining the flow corresponding to the function to be tested in the process that the service application program historically calls the function to be tested from the pre-collected flows. And then, according to the playback time period carried in the flow playback request and the acquisition time corresponding to each flow, determining the target flow which accords with the playback time period from the flows corresponding to the function to be tested in the process of historically calling the function to be tested from the service application program, and issuing the target flow to a tangent plane program injected into the function to be tested. The target flow at least comprises a history input parameter and a history return value.
When the target flow is issued to the tangent plane program of the function to be tested, the target flow can be issued to the tangent plane program of the code starting position of the function to be tested. Meanwhile, the section program of the initial position of the injection code in the function to be tested can be switched to the flow playback state.
Then, updating the historical input parameters contained in the target flow into the function to be tested through a tangent plane program injected into the code starting position in the function to be tested. The business application program executes the function to be tested based on the historical input parameters, and after the function to be tested is executed based on the historical input parameters, the target return value after the function to be tested is executed is acquired through a tangent plane program injected into the code end position of the function to be tested.
Finally, whether the function to be tested runs abnormally or not can be judged according to the target return value and the historical return value contained in the target flow.
Specifically, when the historical return value is a parameter acquired when the function to be tested runs normally, the target return value can be compared with the historical return value contained in the target flow. If the target return value is the same as the historical return value, determining that the function to be tested is normal, namely, the function to be tested runs normally; if the target return value is different from the historical return value, determining that the function to be tested is abnormal, namely that the function to be tested runs abnormally.
In addition, after the method is adopted, when the historical return value is the parameter acquired when the function to be tested runs normally, whether the function to be tested runs abnormally can be judged according to the difference between the target return value and the historical return value contained in the target flow. If the difference between the target return value and the historical return value is smaller than a preset threshold value, determining that the function to be tested is normal, namely, the function to be tested runs normally; if the difference between the target return value and the historical return value is not smaller than the preset threshold value, determining that the function to be tested is abnormal, namely that the function to be tested runs abnormally.
It should be noted that, since the historical return value may be a parameter collected when the function to be tested runs abnormally, the range of checking the abnormal function may be narrowed by comparing the target return value with the historical return value. Only when the historical return value is determined to be the parameter acquired when the function to be tested runs normally, the function with the abnormality can be accurately judged, namely, the function with the abnormality can be positioned. After detecting the function with the abnormality, the function with the abnormality may be processed to restore the operation of the function with the abnormality to normal.
In addition, before the section program performs the flow playback, the section program of the code start position of the function to be tested needs to be switched to the flow playback state.
Specifically, when the server receives the flow playback request, the server may switch the tangent plane program of the start position of the injection code in the function to be tested to the flow playback state according to the flow playback request. Or, by manual configuration, the server responds to the configuration information to switch the tangent plane program injected to the code starting position in the function to be tested to the flow recording state.
In addition to the above method, the server may detect in real time whether the current time is in a second period, where the second period may refer to a period of time during which the slice procedure plays back traffic. And if the current moment is in the second period, determining a function to be tested carried in the flow playback request, and switching a section program injected to the code starting position in the function to be tested to a flow playback state. And then, acquiring the target flow aiming at the function to be tested from a database with the flow acquired in advance, and issuing the target flow to the function to be tested and injecting the target flow into a section program of the code starting position. And finally, updating the historical input parameters contained in the target flow into the function to be tested through the tangent plane program, executing the function to be tested based on the historical input parameters, obtaining a target return value after executing the function to be tested, and testing the function to be tested according to the target return value.
As can be seen from the methods shown in fig. 1 and 3, the present disclosure determines an objective function in a service application program and a tangent point in the objective function, where the tangent point needs to be injected into the objective function, and then injects the tangent point into the objective function, so as to collect parameters corresponding to the objective function in a process that the objective function is called by the service application program through the tangent point, so as to record flow. After the flow is recorded, a function to be tested in the service application program and target flow which needs to be played back aiming at the function to be tested are determined. And updating the historical input parameters contained in the target flow into the function to be tested through the tangent plane program so as to execute the function to be tested based on the historical input parameters, and obtaining a target return value after executing the function to be tested. In the method, the section program is decoupled from the service application program, and the system resource used when the section program records the flow is irrelevant to the system resource for executing the service application program, so that the operation of the section program does not occupy the resource for operating the service application program, and the section program can record the flow on the basis of ensuring that the service application program normally executes the service, thereby improving the efficiency of recording the flow. In addition, the tangent plane program only records the input parameters and the return value after executing the function, thereby improving the efficiency of flow recording. During function test, the recorded flow is stored in a structured data format, so that flow playback can be performed without analyzing the flow, and the efficiency of flow playback and function test is improved. In addition, the manual writing of test case codes is not needed, the cost is reduced, and automatic testing is realized.
The above method for recording the flow provided in the embodiments of the present specification further provides a corresponding device, a storage medium, and an electronic apparatus based on the same concept.
Fig. 4 is a schematic structural diagram of a flow recording device according to an embodiment of the present disclosure, where the device includes:
a determining module 401, configured to determine an objective function in a service application program and determine a tangent point in the objective function, where a tangent plane program for flow recording needs to be injected;
an injection module 402, configured to inject the tangent plane procedure into the objective function according to the tangent point;
and the flow recording module 403 is configured to collect, during the operation of the service application program, parameters corresponding to the objective function during the process of calling the objective function by the service application program through the tangent plane program, so as to record the flow.
Optionally, the determining module 401 is specifically configured to detect a code start position and a code end position of the objective function; and determining a tangent point to be injected into the tangent plane program in the objective function according to the code starting position and the code ending position.
Optionally, the flow recording module 403 is specifically configured to collect, by a tangent plane program injected into a code start position in the objective function, an incoming parameter that is incoming to the objective function when the service application program calls the objective function; and acquiring a return value after the objective function is executed based on the input parameter through a tangent plane program injected into a code end position in the objective function, and storing the input parameter and the return value.
Optionally, the flow recording module 403 is specifically configured to store the incoming parameter and the return value in a structured data format.
Optionally, the apparatus further comprises: a function test module 404;
a function test module 404, configured to receive a flow playback request; according to the flow playback request, determining a function to be tested in a service application program and target flow which is required to be played back for the function to be tested; updating the historical input parameters contained in the target flow into the function to be tested through a tangent plane program injected into the function to be tested, executing the function to be tested based on the historical input parameters, obtaining a target return value after executing the function to be tested, and testing the function to be tested according to the target return value.
Optionally, the function test module 404 is specifically configured to update the historical input parameters included in the target flow into the function to be tested by injecting a tangent plane program of a code starting position in the function to be tested; after the function to be tested is executed based on the historical input parameters, acquiring a target return value after the function to be tested is executed through a tangent plane program injected into the code end position in the function to be tested.
Optionally, the function test module 404 is specifically configured to compare the target return value with a historical return value included in the target flow; if the target return value is the same as the historical return value, determining that the function to be tested is normal; and if the target return value is different from the historical return value, determining that the function to be tested is abnormal.
The present specification also provides a computer readable storage medium storing a computer program which when executed by a processor is operable to perform the flow recording method provided in fig. 1 above.
Based on the flow recording method shown in fig. 1, the embodiment of the present disclosure further provides a schematic structural diagram of the unmanned device shown in fig. 5. At the hardware level, as in fig. 5, the unmanned device includes a processor, an internal bus, a network interface, a memory, and a non-volatile storage, although it may include hardware required for other services. The processor reads the corresponding computer program from the nonvolatile memory into the memory and then runs the program to implement the flow recording method shown in fig. 1.
Of course, other implementations, such as logic devices or combinations of hardware and software, are not excluded from the present description, that is, the execution subject of the following processing flows is not limited to each logic unit, but may be hardware or logic devices.
In the 90 s of the 20 th century, improvements to one technology could clearly be distinguished as improvements in hardware (e.g., improvements to circuit structures such as diodes, transistors, switches, etc.) or software (improvements to the process flow). However, with the development of technology, many improvements of the current method flows can be regarded as direct improvements of hardware circuit structures. Designers almost always obtain corresponding hardware circuit structures by programming improved method flows into hardware circuits. Therefore, an improvement of a method flow cannot be said to be realized by a hardware entity module. For example, a programmable logic device (Programmable Logic Device, PLD) (e.g., field programmable gate array (Field Programmable Gate Array, FPGA)) is an integrated circuit whose logic function is determined by the programming of the device by a user. A designer programs to "integrate" a digital system onto a PLD without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Moreover, nowadays, instead of manually manufacturing integrated circuit chips, such programming is mostly implemented by using "logic compiler" software, which is similar to the software compiler used in program development and writing, and the original code before the compiling is also written in a specific programming language, which is called hardware description language (Hardware Description Language, HDL), but not just one of the hdds, but a plurality of kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), lava, lola, myHDL, PALASM, RHDL (Ruby Hardware Description Language), etc., VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog are currently most commonly used. It will also be apparent to those skilled in the art that a hardware circuit implementing the logic method flow can be readily obtained by merely slightly programming the method flow into an integrated circuit using several of the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer readable medium storing computer readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable logic controllers, and embedded microcontrollers, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, atmel AT91SAM, microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic of the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller in a pure computer readable program code, it is well possible to implement the same functionality by logically programming the method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers, etc. Such a controller may thus be regarded as a kind of hardware component, and means for performing various functions included therein may also be regarded as structures within the hardware component. Or even means for achieving the various functions may be regarded as either software modules implementing the methods or structures within hardware components.
The system, apparatus, module or unit set forth in the above embodiments may be implemented in particular by a computer chip or entity, or by a product having a certain function. One typical implementation is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being functionally divided into various units, respectively. Of course, the functions of each element may be implemented in one or more software and/or hardware elements when implemented in the present specification.
It will be appreciated by those skilled in the art that embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the present specification may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present description can take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
The present description is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the specification. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises the element.
It will be appreciated by those skilled in the art that embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the present specification may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present description can take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
The description may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for system embodiments, since they are substantially similar to method embodiments, the description is relatively simple, as relevant to see a section of the description of method embodiments.
The foregoing is merely exemplary of the present disclosure and is not intended to limit the disclosure. Various modifications and alterations to this specification will become apparent to those skilled in the art. Any modifications, equivalent substitutions, improvements, or the like, which are within the spirit and principles of the present description, are intended to be included within the scope of the claims of the present description.

Claims (10)

1. A method of traffic recording, the method comprising:
determining an objective function in a service application program and determining a tangent point of the objective function, which needs to be injected with a tangent plane program for flow recording;
injecting the tangent plane program into the objective function according to the tangent point;
and in the running process of the service application program, acquiring parameters corresponding to the objective function in the process of calling the objective function by the service application program through the tangent plane program so as to record the flow.
2. The method of claim 1, determining a tangent point in the objective function at which the tangent plane procedure needs to be injected, comprising:
detecting a code starting position and a code ending position of the objective function;
and determining a tangent point to be injected into the tangent plane program in the objective function according to the code starting position and the code ending position.
3. The method of claim 2, wherein the step of collecting, by the tangent plane program, parameters corresponding to the objective function in the process that the business application program calls the objective function specifically includes:
collecting the incoming parameters of the objective function when the business application program calls the objective function through a tangent plane program injected into the code starting position of the objective function;
and acquiring a return value after the objective function is executed based on the input parameter through a tangent plane program injected into a code end position in the objective function, and storing the input parameter and the return value.
4. A method according to claim 3, wherein the saving of the incoming parameters and the return values comprises:
and storing the incoming parameters and the return value in a structured data format.
5. The method of claim 1, the method further comprising:
receiving a flow playback request;
according to the flow playback request, determining a function to be tested in a service application program and target flow which is required to be played back for the function to be tested;
updating the historical input parameters contained in the target flow into the function to be tested through a tangent plane program injected into the function to be tested, executing the function to be tested based on the historical input parameters, obtaining a target return value after executing the function to be tested, and testing the function to be tested according to the target return value.
6. The method of claim 5, wherein updating the historical parameters included in the target flow into the function under test by injecting a tangent plane procedure of the function under test specifically comprises:
updating the historical input parameters contained in the target flow into the function to be tested through a tangent plane program injected into the code starting position in the function to be tested;
executing the function to be tested based on the historical input parameters to obtain a target return value after executing the function to be tested, wherein the method specifically comprises the following steps:
After the function to be tested is executed based on the historical input parameters, acquiring a target return value after the function to be tested is executed through a tangent plane program injected into the code end position in the function to be tested.
7. The method according to claim 5, wherein the function to be tested is tested according to the target return value, specifically comprising:
comparing the target return value with a historical return value contained in the target flow;
if the target return value is the same as the historical return value, determining that the function to be tested is normal;
and if the target return value is different from the historical return value, determining that the function to be tested is abnormal.
8. A flow recording device comprising:
the determining module is used for determining an objective function in the service application program and determining a tangent point of the objective function, which is needed to be injected with a tangent plane program for flow recording;
the injection module is used for injecting the tangent plane program into the objective function according to the tangent point;
and the flow recording module is used for acquiring parameters corresponding to the objective function in the process of calling the objective function by the service application program through the tangent plane program in the running process of the service application program so as to record the flow.
9. A computer readable storage medium storing a computer program which, when executed by a processor, implements the method of any of the preceding claims 1-7.
10. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method of any of the preceding claims 1-7 when the program is executed.
CN202211098089.0A 2022-09-08 2022-09-08 Flow recording method and device, storage medium and electronic equipment Pending CN116302917A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211098089.0A CN116302917A (en) 2022-09-08 2022-09-08 Flow recording method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211098089.0A CN116302917A (en) 2022-09-08 2022-09-08 Flow recording method and device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN116302917A true CN116302917A (en) 2023-06-23

Family

ID=86813681

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211098089.0A Pending CN116302917A (en) 2022-09-08 2022-09-08 Flow recording method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN116302917A (en)

Similar Documents

Publication Publication Date Title
CN107066519B (en) Task detection method and device
CN107040576B (en) Information pushing method and device and communication system
CN110635962B (en) Abnormity analysis method and device for distributed system
CN110413286B (en) Application deployment method, device and equipment
CN115378735B (en) Data processing method and device, storage medium and electronic equipment
CN115185755A (en) Abnormity detection method and device, storage medium and electronic equipment
CN116305298B (en) Method and device for managing computing power resources, storage medium and electronic equipment
CN114510296B (en) Applet storage calling method, device and equipment
CN116048977B (en) Test method and device based on data reduction
CN116302917A (en) Flow recording method and device, storage medium and electronic equipment
CN115617668A (en) Compatibility testing method, device and equipment
CN115203050A (en) Method and device for determining dependency relationship of services
CN111368273B (en) Identity verification method and device
CN115344290A (en) Distributed storage grouping online upgrading method, device, terminal and medium
CN110908792B (en) Data processing method and device
CN111796864A (en) Data verification method and device
CN117555697B (en) Distributed training-oriented cache loading system, method, device and equipment
CN117421208A (en) Method, device, storage medium and equipment for determining unique page identifier
CN117806930A (en) Service link inspection method and device, storage medium and electronic equipment
CN113094047B (en) Method and device for processing webpage buttons, storage medium and processor
CN115828247B (en) Method, device and equipment for detecting abnormality of applet and readable storage medium
CN117519912B (en) Mirror image warehouse deployment method, device, storage medium and equipment
CN115904365B (en) Interface resource identification method, device, equipment and readable storage medium
CN116743550B (en) Processing method of fault storage nodes of distributed storage cluster
CN115344410B (en) Method and device for judging event execution sequence, storage medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination