Buried point processing method and device, equipment and storage medium

By converting the business code and buried point configuration code into AST and inserting buried point functions, the problem of mixing buried point logic and business logic is solved, the readability and maintainability of the code are improved, and the buried point logic and business logic are realized. independent execution.

CN118963724APending Publication Date: 2024-11-15BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411025773.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-29
Publication Date
2024-11-15

AI Technical Summary

Technical Problem

In the prior art, the mixed point logic and business logic lead to low readability and maintainability of the code, making it difficult to maintain and modify independently.

Method used

By receiving the business code and buried point configuration code input by the user, it is converted into an abstract syntax tree (AST) structure, and an instrumentation array is generated, inserting buried point functions into the AST of the business code, generating updated business code, supporting decoupling, and supporting decoupling The business code and buried point configuration code processing.

Benefits of technology

Improve the readability and maintainability of business code and buried-point-related code, ensuring independent execution and maintenance of buried-point logic and business logic.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118963724A_ABST
    Figure CN118963724A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to a burying point processing method and device, equipment and a storage medium. The method comprises the steps that a service code and a burying point configuration code input by a user are received; the business code and the burying point configuration code are converted into AST, the AST is analyzed, an instrumentation array is generated, and the instrumentation array comprises context information, burying point event names and burying point event reporting parameters; and generating an AST of a corresponding burying point function based on the burying point event name and the burying point event reporting parameter which have the corresponding relationship, and inserting the AST of the burying point function into the AST of the service code based on the context information to obtain an updated AST. Visibly, the embodiment of the invention not only can support a user to input the decoupled business code and the burying point configuration code to improve the readability and maintainability of the business code and the burying point related code, but also can support processing of the decoupled business code and the burying point configuration code to generate the business code with the burying point logic to improve the user experience. Therefore, execution of the burying point logic and the business logic is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data processing technology, and in particular to a method, device, equipment and storage medium for processing buried points. Background Art

[0002] Tracking refers to inserting code or tools into an application to record the behavior and attributes of certain events. For example, in a user login scenario, data such as the login username and number of logins can be collected.

[0003] In the related art, in order to obtain business code with tracking logic, tracking events are usually written directly into the business code. However, the code written in this way is prone to the problem of mixing business logic and tracking logic, does not require developers to maintain the business code, and has low readability. Summary of the invention

[0004] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a point-of-care processing method, device, equipment and storage medium, which can not only support users to input decoupled business code and point-of-care configuration code to improve the readability and maintainability of the business code, but also support the processing of decoupled business code and point-of-care configuration code to generate business code with point-of-care logic.

[0005] In a first aspect, an embodiment of the present disclosure provides a method for processing buried points, the method comprising:

[0006] Receive the service code and the burying point configuration code input by the user; wherein the burying point configuration code includes the burying point event name, the burying point event triggering time and the burying point event reporting parameters with corresponding relationships;

[0007] The business code and the embedding configuration code are converted into an abstract syntax tree AST structure, and the AST of the business code and the embedding configuration code are parsed to generate a plug array; wherein the plug array includes context information with a corresponding relationship, the embedding event name and the embedding event reporting parameter, and the context information is used to identify the plug position of the corresponding embedding function in the AST of the business code;

[0008] Based on the corresponding embedding event name and the embedding event reporting parameters, an AST of a corresponding embedding function is generated, and based on the corresponding context information, the AST of the embedding function is inserted into the AST of the business code to obtain an updated AST; wherein the updated AST is used to convert into an updated business code, and the updated business code includes the embedding function.

[0009] In an optional implementation manner, the receiving of the service code and the embedding configuration code input by the user includes:

[0010] Receive a business code and a tracking point configuration code input based on a preset code template; wherein the business code and the tracking point configuration code in the preset code template are in a decoupled state.

[0011] In an optional embodiment, the triggering timing of the embedding event includes a target business function, and the type of the triggering timing of the embedding event includes a first type of timing and / or a second type of timing, the first type of timing is used to indicate that the corresponding embedding function is triggered and executed before the target business function, and the second type of timing is used to indicate that the corresponding embedding function is triggered and executed after the target business function.

[0012] In an optional implementation manner, before generating the instrumentation array, the method further includes:

[0013] Based on preset verification conditions, the burying point event name, the burying point event triggering timing and the burying point event reporting parameters in the burying point configuration code are verified respectively; wherein, the preset verification conditions include rationality verification conditions and / or existence verification conditions.

[0014] In an optional implementation manner, before converting the business code and the embedding configuration code into an abstract syntax tree AST structure, the method further includes:

[0015] Based on the preset mapping rules, the burying point event reporting parameters and the burying point event triggering timing in the burying point configuration code are mapped respectively; wherein the preset mapping rules are used to standardize the type of the burying point event reporting parameters and the format of the burying point event triggering timing.

[0016] In an optional implementation, the generating of the instrumentation array by parsing the AST of the business code and the instrumentation configuration code includes:

[0017] Traversing the AST of the business code, and resolving the function names corresponding to the nodes in the AST of the business code according to the function call path, to obtain a function name resolution result;

[0018] Parse the AST of the tracking configuration code, and match the tracking event triggering timing obtained by the analysis with the function name analysis result to generate context information;

[0019] An instrumentation array is generated based on the context information.

[0020] In an optional implementation manner, the triggering timing of the buried event obtained by the analysis is matched with the result of the function name analysis to generate context information, including:

[0021] Match the triggering timing of the buried event obtained by the analysis with the parsing result of the function name to obtain a matching result;

[0022] Context information is generated according to the variable declaration or variable assignment corresponding to the matching result and the matching result.

[0023] In an optional implementation, after inserting the AST of the embedded function into the AST of the business code based on the corresponding context information to obtain the updated AST, the method further includes:

[0024] The updated AST is converted into an updated business code, and the updated business code is compiled to obtain an executable business code.

[0025] In a second aspect, the present disclosure provides a buried point processing device, the device comprising:

[0026] A receiving module, used to receive a business code and a burying point configuration code input by a user; wherein the burying point configuration code includes a burying point event name, a burying point event triggering time, and a burying point event reporting parameter having a corresponding relationship;

[0027] A generation module, used to convert the business code and the embedding configuration code into an abstract syntax tree AST structure, and generate a plug array by parsing the AST of the business code and the embedding configuration code; wherein the plug array includes context information with a corresponding relationship, the embedding event name and the embedding event reporting parameter, and the context information is used to identify the plug position of the corresponding embedding function in the AST of the business code;

[0028] An insertion module is used to generate an AST of a corresponding embedding function based on the embedding event name and the embedding event reporting parameters having a corresponding relationship, and insert the AST of the embedding function into the AST of the business code based on the corresponding context information to obtain an updated AST; wherein the updated AST is used to convert into an updated business code, and the updated business code contains the embedding function.

[0029] In a third aspect, an embodiment of the present disclosure further provides an electronic device, comprising: a processor; a memory for storing executable instructions of the processor; the processor is used to read the executable instructions from the memory and execute the instructions to implement a buried point processing method as provided in an embodiment of the present disclosure.

[0030] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program is used to execute the point-of-use processing method provided in the embodiment of the present disclosure.

[0031] Compared with the prior art, the technical solution provided by the embodiments of the present disclosure has the following advantages:

[0032] In the tracking point processing method provided by the embodiment of the present disclosure, first, a business code and a tracking point configuration code input by a user are received, wherein the tracking point configuration code includes a tracking point event name, a tracking point event triggering time and a tracking point event reporting parameter with a corresponding relationship; then, the business code and the tracking point configuration code are converted into AST, and a plug-in array is generated by parsing the AST of the business code and the tracking point configuration code, wherein the plug-in array includes context information with a corresponding relationship, a tracking point event name and a tracking point event reporting parameter, and the context information is used to identify the plug-in position of the corresponding tracking point function in the AST of the business code; then, based on the tracking point event name and the tracking point event reporting parameter with a corresponding relationship, the AST of the corresponding tracking point function is generated, and based on the corresponding context information, the AST of the tracking point function is inserted into the AST of the business code to obtain an updated AST. It can be seen that the embodiments of the present disclosure can not only support users to input decoupled business codes and burying point configuration codes to improve the readability and maintainability of business codes and burying point related codes, but also support the processing of decoupled business codes and burying point configuration codes to generate business codes with burying point logic, thereby ensuring the execution of burying point logic and business logic. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.

[0034] Figure 1 A flowchart of a method for processing buried points provided by an embodiment of the present disclosure;

[0035] Figure 2 A schematic diagram of a flow chart for performing tracking processing using a code plug-in provided in an embodiment of the present disclosure;

[0036] Figure 3 A schematic diagram of a point tracking process provided by an embodiment of the present disclosure;

[0037] Figure 4 A schematic diagram of the structure of a buried point processing device provided in an embodiment of the present disclosure;

[0038] Figure 5A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0039] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0040] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.

[0041] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0042] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0043] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0044] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0045] Some technical concepts or noun concepts involved in this article are explained:

[0046] Tracking refers to inserting code or tools into an application to record the behavior and attributes of certain events. For example, in a user login scenario, data such as the login user name and number of logins can be collected and reported.

[0047] In the related art, in order to obtain business code with tracking logic, tracking events are usually written directly into the business code. However, the code written in this way is prone to the problem of mixing business logic and tracking logic, does not require developers to maintain the business code, and has low readability.

[0048] Therefore, how to improve the readability and maintainability of business codes and tracking-related codes is a technical problem that needs to be solved urgently.

[0049] In order to improve the readability and maintainability of business codes, the tracking point processing method provided in the embodiments of the present disclosure can support developers to input decoupled business codes and tracking point configuration codes, so that when modifying the business codes later, it is only necessary to modify the logic of the business codes without paying attention to the tracking point configuration codes, thereby improving the readability and maintainability of business codes and tracking point related codes.

[0050] Specifically, first, receive the business code and tracking configuration code input by the user, wherein the tracking configuration code includes tracking event names, tracking event triggering timings and tracking event reporting parameters with corresponding relationships; then, convert the business code and the tracking configuration code into AST, and generate a plug-in array by parsing the ASTs of the business code and the tracking configuration code, wherein the plug-in array includes context information with corresponding relationships, tracking event names and tracking event reporting parameters, and the context information is used to identify the plug-in position of the corresponding tracking function in the AST of the business code; then, based on the tracking event names and tracking event reporting parameters with corresponding relationships, generate the AST of the corresponding tracking function, and insert the AST of the tracking function into the AST of the business code based on the corresponding context information to obtain the updated AST.

[0051] It can be seen that the embodiments of the present disclosure can not only support users to input decoupled business codes and burying point configuration codes to improve the readability and maintainability of business codes and burying point related codes, but also support the processing of decoupled business codes and burying point configuration codes to generate business codes with burying point logic, thereby ensuring the execution of burying point logic and business logic.

[0052] Based on this, an embodiment of the present disclosure provides a method for processing buried points, which is introduced below in conjunction with a specific embodiment.

[0053] Figure 1 The present invention provides a flowchart of a method for processing buried points provided in an embodiment of the present invention. The method can be executed by a buried point processing device, wherein the device can be implemented by software and / or hardware and can generally be integrated in an electronic device. Figure 1 As shown, the method includes:

[0054] S101: Receive the service code and tracking configuration code input by the user.

[0055] Among them, the burying point configuration code includes a burying point event name, a burying point event triggering time and a burying point event reporting parameter that have a corresponding relationship.

[0056] The tracking point processing method provided in the embodiment of the present disclosure can be applied to a code development platform. For example, the tracking point processing method provided in the embodiment of the present disclosure can be deployed in the code development platform in the form of a plug-in, and the tracking point processing of the user input code can be implemented by running the plug-in.

[0057] In the disclosed embodiments, the business code contains the core logic of the application, which is related to specific business functions. The business code is responsible for implementing business-related logic, such as user login, data display, etc. The tracking point configuration code is used to configure the definition and triggering logic of tracking point events. Specifically, the tracking point configuration code may include tracking point event names, tracking point event triggering timings, and tracking point event reporting parameters that have corresponding relationships. The tracking point event name is used to represent the name of the reported tracking point event, such as a verification pass event, a verification failure event, a successful login event, etc. The tracking point event reporting parameters refer to the parameters corresponding to the reported tracking point events, such as the user name, user ID, IP address, and other parameters corresponding to the successful login event.

[0058] The triggering timing of the tracking event is used to characterize the timing of triggering the reporting of the tracking event, that is, before which business function or object the tracking event is triggered, or after which business function or object the tracking event is triggered. For example, the tracking event is triggered after a successful login to collect and report data such as the user name and user ID, or the tracking event is triggered at the start of a function execution, or at the end of a function execution, to collect and report the execution time data of the function.

[0059] It can be seen that the embodiment of the present disclosure decouples the business code and the tracking configuration code, making it easier for developers to maintain the business code. Modifying the tracking configuration code will not affect the business logic, and it can also achieve more flexible insertion, modification or deletion of tracking events.

[0060] In an optional implementation, the triggering timing of the embedding event includes a target business function, which refers to a business function in the business code that triggers the reporting of the embedding event. The type of the triggering timing of the embedding event includes at least one of a first type of timing and a second type of timing, wherein the first type of timing is used to indicate that the corresponding embedding function is triggered and executed before the target business function, and the second type of timing is used to indicate that the corresponding embedding function is triggered and executed after the target business function.

[0061] S102: Convert the business code and the embedding configuration code into an abstract syntax tree AST structure, and generate an instrumentation array by parsing the AST of the business code and the embedding configuration code.

[0062] Among them, the insertion array includes context information with corresponding relationships, the embedded event name and the embedded event reporting parameters, and the context information is used to identify the insertion position of the corresponding embedded function in the AST of the business code.

[0063] In the disclosed embodiment, after receiving the business code and the tracking configuration code input by the user, the business code and the tracking configuration code are converted into an abstract syntax tree AST, wherein AST (Abstract Syntax Tree) is a tree structure used to represent the abstract syntax structure of the code. Each node in the AST represents a structure in the code, such as an expression, statement, function, etc. The nodes are connected through a parent-child relationship to form a tree structure.

[0064] In the disclosed embodiment, the business code and the tracking configuration code are converted into AST, and the AST of the business code and the tracking configuration code are parsed to generate a stub array.

[0065] In practical applications, the business code and the tracking configuration code can be converted as a whole to obtain an AST, wherein the business code and the tracking configuration code can be two nodes or two branches in the AST. Further, the AST of the business code and the tracking configuration code is parsed to generate a stub array.

[0066] In the disclosed embodiment, the instrumentation array includes context information, instrumentation event names and instrumentation event reporting parameters with corresponding relationships, wherein the context information is also called context path or context path, which is used to identify the instrumentation position of the corresponding instrumentation function in the AST of the business code.

[0067] In an embodiment of the present disclosure, the type of the instrumentation array may include a first type array and a second type array. The first type array is used to indicate that the instrumentation function is inserted before the corresponding context, and the second type array is used to indicate that the instrumentation function is inserted after the corresponding context. Specifically, based on the type of the instrumentation array and the context information in the instrumentation array, it can be determined that the AST of the instrumentation function is to be inserted before or after the instrumentation position in the AST of the business code.

[0068] S103: Generate an AST of a corresponding embedding function based on the embedding event name and the embedding event reporting parameter having a corresponding relationship, and insert the AST of the embedding function into the AST of the business code based on the corresponding context information to obtain an updated AST.

[0069] The updated AST is used to convert into updated business code, and the updated business code includes the embedded function.

[0070] In the disclosed embodiment, since the burying point event name and the burying point event reporting parameters, as well as the correspondence between the two, have been defined in the burying point configuration code, after generating the insertion array, the AST of the corresponding burying point function can be generated directly based on the burying point event name and the burying point event reporting parameters with the corresponding relationship, wherein the AST of the burying point function is used to be inserted into the AST of the business code to implement the function of inserting the burying point in the business code.

[0071] In the disclosed embodiment, after generating the AST of the corresponding burying point function based on the burying point event name and the burying point event reporting parameters, the AST of the burying point function is inserted into the AST of the business code based on the context information corresponding to the burying point event name to obtain the updated AST.

[0072] In the disclosed embodiment, the updated AST is used to convert into the updated business code, and the updated business code includes the tracking function. It can be understood that the running effect of the updated business code is the same as the execution effect of the code coupling the business logic and the tracking logic in the related technology, and both realize the function of inserting the tracking function in the business code.

[0073] In an optional implementation, after inserting the AST of the embedded function into the AST of the business code to obtain the updated AST, the updated AST can also be converted into an updated business code, and the updated business code can be compiled to obtain an executable business code.

[0074] In the tracking point processing method provided by the embodiment of the present disclosure, first, a business code and a tracking point configuration code input by a user are received, wherein the tracking point configuration code includes a tracking point event name, a tracking point event triggering time and a tracking point event reporting parameter with a corresponding relationship; then, the business code and the tracking point configuration code are converted into AST, and a plug-in array is generated by parsing the AST of the business code and the tracking point configuration code, wherein the plug-in array includes context information with a corresponding relationship, a tracking point event name and a tracking point event reporting parameter, and the context information is used to identify the plug-in position of the corresponding tracking point function in the AST of the business code; then, based on the tracking point event name and the tracking point event reporting parameter with a corresponding relationship, the AST of the corresponding tracking point function is generated, and based on the corresponding context information, the AST of the tracking point function is inserted into the AST of the business code to obtain an updated AST. It can be seen that the embodiments of the present disclosure can not only support users to input decoupled business codes and burying point configuration codes to improve the readability and maintainability of business codes and burying point related codes, but also support the processing of decoupled business codes and burying point configuration codes to generate business codes with burying point logic, thereby ensuring the execution of burying point logic and business logic.

[0075] In an optional implementation, a business code and a tracking point configuration code input based on a preset code template may also be received, wherein the business code and the tracking point configuration code in the preset code template are in a decoupled state.

[0076] Since high-order functions can receive one or more functions as parameters, the above characteristics of high-order functions can be used to separate business logic functions (i.e. business codes) from point-of-care configuration functions (i.e. point-of-care configuration codes). Specifically, a custom aggregation function can be used as a preset code template, where the preset code template includes two parts, the first part is used to input the business code, and the second part is used to input the point-of-care configuration function. Exemplarily, the structure of the preset code template can be:

[0077] Preset code templates (

[0078] ()=>{ / / This is the business code},

[0079] ()=>{ / / Here is the embedding configuration code}, );

[0081] After completing the definition of the preset code template, the burying point configuration code is configured. Specifically, the burying point configuration code may include a burying point event name, a burying point event triggering timing, and a burying point event reporting parameter having a corresponding relationship.

[0082] In order to make the preset code template have better compatibility, the preset code template provided by the embodiment of the present disclosure can not only support configuration using functions, but also support configuration using objects.

[0083] In an optional implementation, before generating the stub array, the burying point event name, burying point event triggering timing and burying point event reporting parameters in the burying point configuration code may be verified separately based on preset verification conditions.

[0084] In the disclosed embodiment, the preset verification conditions include at least one of rationality verification conditions and existence verification conditions, wherein the rationality verification is used to verify whether the name of the buried event, the triggering timing of the buried event and the reporting parameters of the buried event meet the predetermined standards, such as whether they meet the specific data type or the specific format, etc., and the existence verification is used to verify whether the name of the buried event, the triggering timing of the buried event and the reporting parameters of the buried event are configured with parameter fields.

[0085] For example, assuming that the event tracking parameter supports types such as integers, strings, arrays, and objects, when performing a rationality check on the event tracking parameter, if it is determined that the reported parameter is an object of a data type such as an integer, string, or array, then the event tracking parameter passes the rationality check; if it is determined that the reported parameter is a function, then the event tracking parameter fails the rationality check.

[0086] After obtaining the tracking event reporting parameters and tracking event triggering timing in the tracking configuration code, it is also necessary to report the tracking event reporting parameters and tracking event triggering timing to the backend for processing. However, in the actual reporting process, the reported content may be different from the obtained content.

[0087] Therefore, before generating the insertion array, the embodiment of the present disclosure can also map the embedding event reporting parameters and embedding event triggering timing in the embedding configuration code based on preset mapping rules to obtain the type of embedding event reporting parameters that conforms to the reporting specifications, and the format of the embedding event triggering timing that conforms to the reporting specifications.

[0088] In the disclosed embodiment, the preset mapping rules are used to standardize the types of tracking point reporting parameters and the format of tracking point event triggering timing. For example, assuming that the collected tracking point event triggering timing is the start execution time information and end execution time information of a function, based on the preset mapping rules, after the tracking point event triggering timing is mapped, the actual reported content is the execution time information of the function.

[0089] like Figure 2FIG. 1 is a flow chart of a method for performing tracking processing using a code plug-in provided in an embodiment of the present disclosure. The code plug-in runs in a code development platform and may include a parsing module, a conversion module, and a generation module.

[0090] After receiving the business code and the tracking configuration code input by the user, the code development platform sends the business code and the tracking configuration code to the code plug-in in response to the user's code submission operation for the input business code and the tracking configuration code.

[0091] The code plug-in calls the parsing module to convert the business code and the tracking configuration code into an abstract syntax tree AST structure, and parses the AST of the business code and the tracking configuration code to generate a stub array.

[0092] The code plug-in calls the conversion module to map the point-of-care event reporting parameters and point-of-care event triggering timing in the point-of-care configuration code based on the preset mapping rules, and obtain the point-of-care event reporting and point-of-care event triggering timing that meet the specifications, and generate the AST of the corresponding point-of-care function based on the point-of-care event name and the point-of-care reporting parameters, and insert the AST of the point-of-care function into the AST of the business code based on the context information corresponding to the point-of-care event name to obtain the updated AST.

[0093] The code plug-in calls the generation module to convert the updated AST into the updated business code, and sends the updated business code to the compiler, which compiles the updated business code to obtain executable business code.

[0094] In actual applications, business codes may include different types of functions, such as synchronous function calls, asynchronous function calls, optional chain function calls, etc. After the business code is converted to AST, due to the different function call types, the function names in AST are also different, and different function names correspond to different nodes. Therefore, different function call types have different context information in the AST of the business code.

[0095] For example, assuming that the call types for function b in the business code include const a=b and direct call to b, when the corresponding embedded function is inserted before function b, since the node corresponding to the function call of type const a=b is related to const a, and the direct call to type b function call only needs to pay attention to the node where function b itself is located, obviously, the context information of the function call of type const a=b in the AST is not the same as the context information of the direct call to type b function call.

[0096] Therefore, in order to locate the insertion position of the embedded function more accurately, when traversing the AST of the business code, the function name corresponding to the node in the AST of the business code can be parsed according to the function call path to obtain the function name parsing result.

[0097] In the disclosed embodiment, the function name resolution result may carry the function name corresponding to any node and the function call path of the node in the business code AST. Exemplarily, when the current node is determined to be an identifier, such as a function name or a variable name, the identifier may be placed before the function call path to obtain the function resolution result, such as function A.path.

[0098] In the disclosed embodiment, after parsing the function name of each function in the AST of the business code, the AST of the tracking configuration code is parsed, and the tracking event triggering timing obtained by the analysis is matched with the function name parsing result to generate context information, and then generate a stub array based on the context information.

[0099] Since the trigger timing of the embedding event can be used to indicate before which business function the corresponding embedding function is triggered to execute, or after which function the corresponding embedding function is triggered to execute, after parsing the embedding event trigger timing, the function name in the embedding event trigger timing can be matched with the function name in the function name resolution result, and context information can be generated based on the successfully matched embedding event trigger timing and function name resolution result.

[0100] Exemplarily, assuming that the function parsing results include: A.path, B.path, C.path, and the analyzed triggering timing of the embedding event is "first type timing: function name A", and by matching "first type timing: function name A" with the above function parsing results, the context information of "first type timing-function name A.path" can be obtained, indicating that the embedding function is inserted before the node corresponding to the path A.path.

[0101] In an optional implementation, since variable declaration and variable assignment correspond to two different nodes in the AST, the corresponding function call paths are also different. Therefore, when generating context information based on the trigger timing of the embedded event and the function name parsing result, the variable declaration or variable assignment can also be distinguished.

[0102] Specifically, first traverse the AST of the business code, and parse the function names corresponding to the nodes in the AST of the business code according to the function call path to obtain the function name parsing results; then parse the AST of the tracking configuration code, and match the tracking event triggering timing obtained by the parsing with the function name parsing results to obtain the matching results; then generate context information based on the variable assignment or variable declaration corresponding to the matching results, and the matching results.

[0103] It can be seen that the embodiment of the present disclosure can parse the function name corresponding to the node in the AST of the business code according to the function call path, and obtain the function name resolution result, which is used to generate context information to further improve the accuracy of locating the buried function.

[0104] like Figure 3 As shown, it is a schematic diagram of a tracking point configuration process provided by an embodiment of the present disclosure.

[0105] First, the business code and the tracking point configuration code input by the user are received, wherein the tracking point configuration code includes the tracking point event name, the tracking point event triggering time and the tracking point event reporting parameters with corresponding relationships.

[0106] Then the business code and the tracking configuration code are converted into an abstract syntax tree AST structure, and the AST of the business code and the tracking configuration code are parsed. In addition, when parsing the AST, the tracking event name, tracking event triggering time and tracking event reporting parameters in the tracking configuration code can be verified based on preset verification conditions (rationality verification conditions and / or existence verification conditions); after passing the verification, the tracking event reporting parameters and tracking event triggering time in the tracking configuration code are mapped based on preset mapping rules.

[0107] Then, the AST of the business code is traversed, and the function names corresponding to the nodes in the AST of the business code are parsed according to the function call path to obtain the function name parsing results; the AST of the tracking configuration code is parsed, and the tracking event triggering timing obtained by the parsing is matched with the function name parsing results to generate context information; then, the stub array is generated based on the context information.

[0108] In addition, the triggering timing of the embedded event obtained by the analysis can be matched with the function name analysis result to obtain the matching result, and then the context information is generated based on the variable declaration or variable assignment corresponding to the matching result and the matching result, and then the stub array is generated based on the context information.

[0109] Based on the corresponding embedding event name and embedding event reporting parameters, the AST of the corresponding embedding function is generated, and based on the corresponding context information, the AST of the embedding function is inserted into the AST of the business code to obtain the updated AST.

[0110] The updated AST is converted into the updated business code, and the updated business code is compiled to obtain the executable business code.

[0111] It can be seen that the embodiments of the present disclosure can not only support users to input decoupled business codes and burying point configuration codes to improve the readability and maintainability of business codes and burying point related codes, but also support the processing of decoupled business codes and burying point configuration codes to generate business codes with burying point logic, thereby ensuring the execution of burying point logic and business logic.

[0112] In order to implement the above embodiments, the present disclosure also proposes a buried point processing device. Figure 4 This is a schematic diagram of the structure of a buried point processing device provided by an embodiment of the present disclosure. The device can be implemented by software and / or hardware and can generally be integrated into an electronic device. Figure 4 As shown, the device comprises:

[0113] The receiving module 401 is used to receive the service code and the burying point configuration code input by the user; wherein the burying point configuration code includes the burying point event name, the burying point event triggering time and the burying point event reporting parameter with corresponding relationship;

[0114] A generation module 402 is used to convert the business code and the embedding configuration code into an abstract syntax tree AST structure, and generate a plug array by parsing the AST of the business code and the embedding configuration code; wherein the plug array includes context information with a corresponding relationship, the embedding event name and the embedding event reporting parameter, and the context information is used to identify the plug position of the corresponding embedding function in the AST of the business code;

[0115] Insertion module 403 is used to generate the AST of the corresponding burying point function based on the burying point event name and the burying point event reporting parameters with a corresponding relationship, and insert the AST of the burying point function into the AST of the business code based on the corresponding context information to obtain an updated AST; wherein the updated AST is used to convert into an updated business code, and the updated business code contains the burying point function.

[0116] In an optional implementation manner, the receiving module includes:

[0117] The receiving submodule is used to receive the business code and the burying point configuration code input based on the preset code template; wherein the business code and the burying point configuration code in the preset code template are in a decoupled state.

[0118] In an optional embodiment, the triggering timing of the embedding event includes a target business function, and the type of the triggering timing of the embedding event includes a first type of timing and / or a second type of timing, the first type of timing is used to indicate that the corresponding embedding function is triggered and executed before the target business function, and the second type of timing is used to indicate that the corresponding embedding function is triggered and executed after the target business function.

[0119] In an optional implementation, the device further includes:

[0120] A verification module is used to verify the tracking event name, the tracking event triggering timing and the tracking event reporting parameters in the tracking configuration code based on preset verification conditions; wherein the preset verification conditions include rationality verification conditions and / or existence verification conditions.

[0121] In an optional implementation, the device further includes:

[0122] A mapping processing module is used to map the event reporting parameters and the event triggering timing in the event configuration code based on preset mapping rules; wherein the preset mapping rules are used to standardize the type of the event reporting parameters and the format of the event triggering timing.

[0123] In an optional implementation manner, the generating module includes:

[0124] A parsing submodule, used to traverse the AST of the business code, and parse the function name corresponding to the node in the AST of the business code according to the function call path to obtain the function name parsing result;

[0125] The first generation submodule is used to parse the AST of the tracking configuration code, and match the tracking event triggering timing obtained by the analysis with the function name parsing result to generate context information;

[0126] The second generating submodule is used to generate a plug array based on the context information.

[0127] In an optional implementation manner, the first generating submodule is specifically used to:

[0128] Match the triggering timing of the buried event obtained by the analysis with the parsing result of the function name to obtain a matching result;

[0129] Context information is generated according to the variable declaration or variable assignment corresponding to the matching result and the matching result.

[0130] In an optional implementation, the device further includes:

[0131] The compiling and processing module is used to convert the updated AST into updated business code, and compile the updated business code to obtain executable business code.

[0132] First, receive the business code and the point-burying configuration code input by the user, wherein the point-burying configuration code includes the point-burying event name, the point-burying event triggering time and the point-burying event reporting parameter with a corresponding relationship; then, convert the business code and the point-burying configuration code into AST, and generate a plug array by parsing the AST of the business code and the point-burying configuration code, wherein the plug array includes the context information with a corresponding relationship, the point-burying event name and the point-burying event reporting parameter, and the context information is used to identify the plug position of the corresponding point-burying function in the AST of the business code; then, based on the point-burying event name and the point-burying event reporting parameter with a corresponding relationship, generate the AST of the corresponding point-burying function, and insert the AST of the point-burying function into the AST of the business code based on the corresponding context information to obtain the updated AST. It can be seen that the embodiment of the present disclosure can not only support the user to input decoupled business code and point-burying configuration code to improve the readability and maintainability of the business code and the point-burying related code, but also support the processing of the decoupled business code and the point-burying configuration code to generate a business code with point-burying logic, thereby ensuring the execution of the point-burying logic and the business logic.

[0133] The buried point processing device provided in the embodiments of the present disclosure can execute the buried point processing method provided in any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.

[0134] In order to implement the above embodiments, the present disclosure also proposes a computer program product, including a computer program / instruction, which implements the buried point processing method in the above embodiments when the computer program / instruction is executed by a processor.

[0135] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure.

[0136] The following specific reference Figure 5 , which shows a schematic diagram of the structure of an electronic device 1000 suitable for implementing the embodiment of the present disclosure. The electronic device 1000 in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0137] like Figure 5 As shown, the electronic device 1000 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1008 into a random access memory (RAM) 1003. In the RAM 1003, various programs and data required for the operation of the electronic device 1000 are also stored. The processing device 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.

[0138] Typically, the following devices may be connected to the I / O interface 1005: an input device 1006 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 1007 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1008 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 may allow the electronic device 1000 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 5 The electronic device 1000 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0139] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 1009, or installed from the storage device 1008, or installed from the ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the buried point processing method of the embodiment of the present disclosure are executed.

[0140] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may 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 of computer-readable storage media may include, but are not limited to: 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 the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium 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. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0141] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.

[0142] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0143] The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by the electronic device, the electronic device: receives the business code and the embedding configuration code input by the user, wherein the embedding configuration code includes the embedding event name, the embedding event triggering time and the embedding event reporting parameters with a corresponding relationship; converts the business code and the embedding configuration code into AST, and generates a plug-in array by parsing the AST of the business code and the embedding configuration code, wherein the plug-in array includes context information with a corresponding relationship, the embedding event name and the embedding event reporting parameters, and the context information is used to identify the plug-in position of the corresponding embedding function in the AST of the business code; based on the embedding event name and the embedding event reporting parameters with a corresponding relationship, generates the AST of the corresponding embedding function, and inserts the AST of the embedding function into the AST of the business code based on the corresponding context information to obtain the updated AST. It can be seen that the embodiments of the present disclosure can not only support users to input decoupled business codes and burying point configuration codes to improve the readability and maintainability of business codes and burying point related codes, but also support the processing of decoupled business codes and burying point configuration codes to generate business codes with burying point logic, thereby ensuring the execution of burying point logic and business logic.

[0144] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages ​​or a combination thereof, including, but not limited to, 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 cases involving 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., through the Internet using an Internet service provider).

[0145] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0146] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a unit does not, in some cases, limit the unit itself.

[0147] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0148] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, 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 foregoing.

[0149] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.

[0150] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.

[0151] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.

Claims

1. A method for processing buried points, characterized in that: include: Receive the service code and the burying point configuration code input by the user; wherein the burying point configuration code includes the burying point event name, the burying point event triggering time and the burying point event reporting parameters with corresponding relationships; The business code and the embedding configuration code are converted into an abstract syntax tree AST structure, and the AST of the business code and the embedding configuration code are parsed to generate a plug array; wherein the plug array includes context information with a corresponding relationship, the embedding event name and the embedding event reporting parameter, and the context information is used to identify the plug position of the corresponding embedding function in the AST of the business code; Based on the corresponding embedding event name and the embedding event reporting parameters, an AST of a corresponding embedding function is generated, and based on the corresponding context information, the AST of the embedding function is inserted into the AST of the business code to obtain an updated AST; wherein the updated AST is used to convert into an updated business code, and the updated business code includes the embedding function.

2. The method according to claim 1, characterized in that The receiving of the business code and the embedding configuration code input by the user includes: Receive a business code and a tracking point configuration code input based on a preset code template; wherein the business code and the tracking point configuration code in the preset code template are in a decoupled state.

3. The method according to claim 1, characterized in that The triggering timing of the embedding event includes a target business function, and the type of the triggering timing of the embedding event includes a first type of timing and / or a second type of timing. The first type of timing is used to indicate that the corresponding embedding function is triggered and executed before the target business function, and the second type of timing is used to indicate that the corresponding embedding function is triggered and executed after the target business function.

4. The method according to claim 1, characterized in that Before generating the instrumentation array, the method further includes: Based on preset verification conditions, the burying point event name, the burying point event triggering timing and the burying point event reporting parameters in the burying point configuration code are verified respectively; wherein, the preset verification conditions include rationality verification conditions and / or existence verification conditions.

5. The method according to claim 1, characterized in that Before generating the instrumentation array, the method further includes: Based on the preset mapping rules, the burying point event reporting parameters and the burying point event triggering timing in the burying point configuration code are mapped respectively; wherein the preset mapping rules are used to standardize the type of the burying point event reporting parameters and the format of the burying point event triggering timing.

6. The method according to claim 1, characterized in that The step of generating a plug array by parsing the AST of the business code and the embedding configuration code includes: Traversing the AST of the business code, and resolving the function names corresponding to the nodes in the AST of the business code according to the function call path, to obtain a function name resolution result; Parse the AST of the tracking configuration code, and match the tracking event triggering timing obtained by the analysis with the function name analysis result to generate context information; An instrumentation array is generated based on the context information.

7. The method according to claim 6, characterized in that The triggering timing of the buried event obtained by the analysis is matched with the result of the function name analysis to generate context information, including: Match the triggering timing of the buried event obtained by the analysis with the parsing result of the function name to obtain a matching result; Context information is generated according to the variable declaration or variable assignment corresponding to the matching result and the matching result.

8. The method according to claim 1, characterized in that: After inserting the AST of the embedded function into the AST of the business code based on the corresponding context information to obtain the updated AST, the method further includes: The updated AST is converted into an updated business code, and the updated business code is compiled to obtain an executable business code.

9. A buried point processing device, characterized in that: The device comprises: A receiving module, used to receive a business code and a burying point configuration code input by a user; wherein the burying point configuration code includes a burying point event name, a burying point event triggering time, and a burying point event reporting parameter having a corresponding relationship; A generation module, used to convert the business code and the embedding configuration code into an abstract syntax tree AST structure, and generate a plug array by parsing the AST of the business code and the embedding configuration code; wherein the plug array includes context information with a corresponding relationship, the embedding event name and the embedding event reporting parameter, and the context information is used to identify the plug position of the corresponding embedding function in the AST of the business code; An insertion module is used to generate an AST of a corresponding embedding function based on the embedding event name and the embedding event reporting parameters having a corresponding relationship, and insert the AST of the embedding function into the AST of the business code based on the corresponding context information to obtain an updated AST; wherein the updated AST is used to convert into an updated business code, and the updated business code contains the embedding function.

10. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing instructions executable by the processor; The processor is used to read the executable instructions from the memory and execute the instructions to implement the buried point processing method described in any one of claims 1-8 above.

11. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and the computer program is used to execute the point-of-use processing method described in any one of claims 1-8 above.

12. A computer program product, characterized in that The computer program product includes a computer program / instruction, and when the computer program / instruction is executed by a processor, the method for processing buried points as described in any one of claims 1-8 is implemented.

Citation Information

Cited By

  • Real-time data read-write method of on-chip logic analyzer and related device

    CN119849393A