CN112115041B - Dynamic point embedding method and device for application program, storage medium and computer equipment - Google Patents

Dynamic point embedding method and device for application program, storage medium and computer equipment Download PDF

Info

Publication number
CN112115041B
CN112115041B CN202010783426.4A CN202010783426A CN112115041B CN 112115041 B CN112115041 B CN 112115041B CN 202010783426 A CN202010783426 A CN 202010783426A CN 112115041 B CN112115041 B CN 112115041B
Authority
CN
China
Prior art keywords
target
class file
name
data
file
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.)
Active
Application number
CN202010783426.4A
Other languages
Chinese (zh)
Other versions
CN112115041A (en
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.)
Beijing Shuidi Technology Group Co ltd
Original Assignee
Beijing Shuidi Technology Group 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 Beijing Shuidi Technology Group Co ltd filed Critical Beijing Shuidi Technology Group Co ltd
Priority to CN202010783426.4A priority Critical patent/CN112115041B/en
Publication of CN112115041A publication Critical patent/CN112115041A/en
Application granted granted Critical
Publication of CN112115041B publication Critical patent/CN112115041B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/362Software debugging
    • G06F11/3636Software debugging by tracing the execution of the program
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3409Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for performance assessment
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • 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)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Software Systems (AREA)
  • Stored Programmes (AREA)

Abstract

The application discloses a dynamic point burying method and device for an application program, a storage medium and computer equipment. The method comprises the following steps: acquiring the name of a target class file, the name of a target method, method parameters and buried point data; verifying the method parameters, acquiring a target method and a target class file according to the method parameters, the name of the target method and the name of the target class file, and transmitting the target method, the target class file and the buried point data to a target proxy; the target agent end intercepts and preprocesses the target method so as to set the target method into a state capable of being buried; the target agent terminal calls an interface at a corresponding position of the target method, reports buried point data, redefines the target class file and obtains the enhanced target class file; the target agent replaces the target class file with the enhanced target class file through the byte code enhancement technology so as to realize the dynamic embedding point of the application program. The method improves the embedded point efficiency of the application program.

Description

Dynamic point embedding method and device for application program, storage medium and computer equipment
Technical Field
The present application relates to the field of internet technologies, and in particular, to a method and apparatus for dynamically burying points in an application program, a storage medium, and a computer device.
Background
With the continuous development of internet technology, the importance of data is increasingly reflected. The data embedded point is used as a data acquisition mode, is an important circle on a chain for realizing data-driven product optimization and refined operation, and the direct target of the data embedded point is to realize omnibearing continuous tracking of user behaviors through the embedded point, clear user behavior tracks, grasp user characteristics and analyze key paths, provide accurate data for data analysis and provide directions for product optimization and refined operation.
In the distributed link tracking, in particular, the monitored application program needs to be embedded, when the application program is embedded, the code needs to be implanted in advance in the critical path and the critical code position of program execution, for example, the code is implanted before and after the execution of the method, then the original code is replaced by the code after the embedded point, and the service is restarted to enable the code after the embedded point to take effect, so that each point can only be determined when the program is started and cannot be dynamically modified when the program is running.
Disclosure of Invention
In view of the above, the present application provides a dynamic point embedding method, system, storage medium and computer device for an application program, which mainly aims to solve the technical problems of low point embedding efficiency and poor code stability of the application program.
According to a first aspect of the present application, there is provided a dynamic embedding method for an application program, the method comprising:
acquiring the name of a target class file, the name of a target method, method parameters and buried point data;
verifying the method parameters, acquiring a target method and a target class file according to the method parameters, the name of the target method and the name of the target class file, and transmitting the target method, the target class file and the buried point data to a target proxy;
the target agent end intercepts and preprocesses the target method so as to set the target method into a state capable of being buried;
the target agent end calls an interface at a corresponding position of the target method, reports buried point data, redefines the target class file and obtains the enhanced target class file;
the target agent replaces the target class file with the enhanced target class file through the byte code enhancement technology so as to realize the dynamic embedding point of the application program.
In one embodiment, before obtaining the name of the target class file, the name of the target method, the method parameters, and the buried data, the method further includes: acquiring all class files of the service where the target agent end is located; constructing a prefix tree of the class file, a prefix tree of the method and a prefix tree of the method parameters according to all class files of the service of the target agent end; and displaying the prefix tree of the class file, the prefix tree of the method and the prefix tree of the method parameter in the process of acquiring the name of the target class file, the name of the target method and the method parameter.
In one embodiment, if the buried data includes tag data and/or log data, then obtaining the buried data includes: acquiring at least one tag data and/or at least one log data, wherein the tag data comprises a tag name and a tag expression; the log data includes a log name and a log expression.
In one embodiment, verifying the method parameter, and obtaining the target method and the target class file according to the method parameter, the name of the target method, and the name of the target class file includes: judging whether the method parameters meet grammar rules or not, and judging whether the names of the target methods and the names of the target class files are matched or not; if the method parameters meet the grammar rules and the names of the target methods are matched with the names of the target class files, loading the target class files and the target methods according to the method parameters, the names of the target methods and the names of the target class files.
In one embodiment, the types of method parameters include one or more of objects, collections, object arrays, maps, objects, arrays, base data types, and wrapper classes.
In one embodiment, intercepting and preprocessing a target method includes: judging whether the target method is a static method or not; if the target method is a static method, statically intercepting a code segment of the target method, and preprocessing the intercepted code segment; if the target method is a non-static method, the instance intercepts the code segments of the target method and preprocesses the intercepted code segments.
In one embodiment, calling an interface at a corresponding position of a target method and reporting buried point data, including: and calling an interface at the front position or the rear position of the target method, and reporting the embedded point data to fill the embedded point data into the front position or the rear position of the target method.
According to a second aspect of the present application, there is provided a dynamic embedded point device for an application, the device comprising:
the data acquisition module is used for acquiring the name of the target class file, the name of the target method, the method parameters and the buried point data;
the file acquisition module is used for verifying the method parameters, acquiring the target method and the target class file according to the method parameters, the name of the target method and the name of the target class file, and transmitting the target method, the target class file and the embedded point data to the target proxy;
the preprocessing module is used for intercepting and preprocessing the target method so as to set the target method into a state of being buried;
the redefinition module is used for calling an interface at a corresponding position of the target method, reporting buried point data, redefining the target class file and obtaining an enhanced target class file;
and the file enhancement module is used for replacing the target class file with the enhanced target class file through a byte code enhancement technology so as to realize dynamic embedding of the application program.
In one embodiment, the device further comprises a prefix tree construction module and a prefix tree display module, wherein the file acquisition module is further used for acquiring all class files of the service where the target agent end is located; the prefix tree construction module is used for constructing prefix trees of class files, prefix trees of methods and prefix trees of method parameters according to all class files served by the target agent end; the prefix tree display module is used for displaying the prefix tree of the class file, the prefix tree of the method and the prefix tree of the method parameter in the process of acquiring the name of the target class file, the name of the target method and the method parameter.
According to a third aspect of the present application, there is provided a storage medium having stored thereon a computer program which, when executed by a processor, implements the dynamic point embedding method of the application program described above.
According to a fourth aspect of the present application, there is provided a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the dynamic point embedding method of the application program described above when executing the program.
The application provides a dynamic point burying method, a device, a storage medium and computer equipment of an application program, which are characterized in that firstly, the name of a target class file, the name of the target method, method parameters and point burying data are obtained, the obtained data are used for loading the description files of the target class and the target method, then the target method, the target class file and the point burying data are sent to a target agent end, the target method is intercepted and preprocessed at the target agent end, so that the target method is set to be in a state capable of being buried, then the point burying data are filled in a corresponding position of the target method in an interceptor, the target class file is redefined, the enhanced target class file is obtained, and finally, the target class file is replaced by the enhanced target class file through a byte code enhancement technology, so that the dynamic point burying of the application program is realized. According to the method, the embedded point data are implanted in the corresponding positions of the target method when the application program runs, and the target class file is redefined, so that the dynamic embedded point of the application program is realized, the embedded point efficiency and the embedded point accuracy of the application program are improved, the workload of embedded points is reduced, and the stability of codes is improved.
The foregoing description is only an overview of the present application, and is intended to be implemented in accordance with the teachings of the present application in order that the same may be more clearly understood and to make the same and other objects, features and advantages of the present application more readily apparent.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute a limitation on the application. In the drawings:
fig. 1 is a schematic flow chart of a dynamic point embedding method of an application program according to an embodiment of the present application;
FIG. 2 is a schematic flow chart of another method for dynamically embedding points in an application program according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a dynamic point burying device of an application program according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a dynamic point burying device of another application program according to an embodiment of the present application.
Detailed Description
The application will be described in detail hereinafter with reference to the drawings in conjunction with embodiments. It should be noted that, without conflict, the embodiments of the present application and features of the embodiments may be combined with each other.
In one embodiment, as shown in fig. 1, a method for dynamically embedding points in an application program is provided, and the method is applied to a computer device for illustration, and includes the following steps:
101. and acquiring the name of the target class file, the name of the target method, the method parameters and the buried point data.
The embedded point is a data acquisition mode, specifically, the embedded point is obtained by implanting codes into pages and positions corresponding to each event of user behaviors, and then reporting statistical data by using a data acquisition tool to realize data acquisition, wherein the embedded point data refers to the implanted codes or programs; class (Class) is the basis for implementing information encapsulation by object-oriented programming, each Class contains a data description and a set of methods for operating data or delivering messages, and Class files are also called byte code files, and refer to binary files in a specific format generated by compiling codes through a compiler; one class includes at least one method, where a method refers to a piece of program or code that can be run directly or that can be referenced by another piece of program or code, and includes information such as the name of the method, method parameters, and return values, in addition to the code used to implement business logic.
Specifically, the computer device may obtain data in a plurality of manners, for example, may obtain the name of the target class file, the name of the target method, the method parameter and the buried point data by batch importing the data, or may obtain the name of the target class file, the name of the target method, the method parameter and the buried point data input into the UI (User Interface) interface through an input device, such as a keyboard, a display or a touch screen, where the target class file and the target method refer to a class file and a method that a user needs to perform buried point respectively. In addition, the computer equipment can also acquire the name of the service, so as to determine the loading range of the class file; the computer equipment can also acquire the name of the embedded point file (namely the name of the file generated by the embedded point data, which is displayed in the link tracking), so that after the embedded point is embedded, the corresponding embedded point file is searched through the name of the embedded point file and information interpretation is carried out; the computer device may also obtain a method type, e.g. static or instance method, to select the corresponding interception method when performing the method interception.
It should be noted that, the execution body of the method provided in this embodiment may specifically be an application performance management (Application Performance Management & Monitoring, APM) system or a visual embedded point tool, where the system or the tool may implement real-time Monitoring of the performance of an application program and real-time management of a series of faults in the running process of the application program, and the application performance management system or the visual embedded point tool may run on any computer device such as a server side or an agent side.
102. And verifying the method parameters, acquiring the target method and the target class file according to the method parameters, the name of the target method and the name of the target class file, and transmitting the target method, the target class file and the embedded point data to the target proxy.
Specifically, after the computer device obtains the corresponding data, the obtained data may be checked and matched, for example, whether the name of the target method and the name of the target class file are matched, whether the parameter of the method accords with the grammar specification or not may be verified, if the name of the target method and the name of the target class file are matched, and if the parameter of the method accords with the grammar specification, the description files of the target class and the target method may be obtained through the class loader according to the parameter of the method, the name of the target method and the name of the target class file; if the name of the target method and the name of the target class file are not matched and/or the method parameters do not meet the grammar specification, the user is required to be prompted to refill data or to acquire the data again in other modes, and then the computer equipment can send the acquired target method, target class file and embedded data to the target proxy end.
In this embodiment, the application performance management system or the visual point burying tool for sending data may run on the target agent end, or may run on other devices, where the application performance management system or the visual point burying tool at the front end is mainly used to collect data and load files, and the target agent end runs with an application program, and may directly process the received data and implement dynamic point burying of the application program through data processing.
103. The target agent end intercepts and preprocesses the target method to set the target method to a state that can be buried.
Specifically, after the target agent end obtains the description files of the target class and the target method, the target method can be intercepted and preprocessed through the interceptor, and when the target method is preprocessed, if the target method is set to be in a state of not being buried, some parameters of the target method need to be correspondingly modified, so that the target method is set to be in a state of being buried. In addition, for different methods, different interceptors may be used to intercept, and the location of interception may be determined according to the actual scenario, which is not specifically limited in this embodiment.
104. The target agent terminal calls an interface at a corresponding position of the target method, reports the embedded point data, redefines the target class file and obtains the enhanced target class file.
Specifically, after intercepting the target method, the target agent end can call a corresponding interface on a front position or a rear position of the target method through an interceptor, fill the embedded point data on the front position or the rear position of the target method, redefine the target class file after filling is finished, and obtain the enhanced target class file.
105. The target agent replaces the target class file with the enhanced target class file through the byte code enhancement technology so as to realize the dynamic embedding point of the application program.
Specifically, the target agent end can dynamically replace the target class file with the enhanced target class file through a byte code enhancement technology, so that the dynamic embedding point of the application program is realized. The byte code enhancement technology refers to a mode of modifying an original byte code file in the operation period after the byte code file is generated, and the original byte code file is processed by adopting the byte code enhancement technology, so that dynamic updating of the byte code file can be realized in the operation process of an application program. Further, in the whole process of embedding the point, the application program can run continuously, and after embedding the point, the application program can output a corresponding embedded point file, so that the method parameters or return values focused by the user are collected into the embedded point file in the form of embedded point data, and then, in the process of running the application program, the user can query the embedded point file through a UI interface of an application performance management system or a visual embedded point tool, and perform information interpretation according to the embedded point data in the embedded point file, so as to obtain relevant information of running the application program.
According to the dynamic point burying method for the application program, firstly, the name of a target class file, the name of a target method, method parameters and point burying data are obtained, the obtained data are loaded into description files of the target class and the target method, then the target method, the target class file and the point burying data are sent to a target agent end, the target method is intercepted and preprocessed in the target agent end to enable the target method to be set into a state capable of being buried, then the point burying data are filled into corresponding positions of the target method in an interceptor, the target class file is redefined to obtain an enhanced target class file, and finally the target class file is replaced with the enhanced target class file through a byte code enhancement technology, so that dynamic point burying of the application program is achieved. According to the method, the embedded point data are implanted in the corresponding positions of the target method when the application program runs, and the target class file is redefined, so that the dynamic embedded point of the application program is realized, the embedded point efficiency and the embedded point accuracy of the application program are improved, the workload of embedded points is reduced, and the stability of codes is improved.
Further, as a refinement and extension of the specific implementation manner of the foregoing embodiment, in order to fully describe the implementation process of the embodiment, a dynamic point embedding method of an application program is provided, as shown in fig. 2, and the method includes the following steps:
201. and acquiring all class files of the service where the target agent end is located.
202. And constructing a prefix tree of the class file, a prefix tree of the method and a prefix tree of the method parameters according to all class files of the service of the target agent end.
203. And displaying the prefix tree of the class file, the prefix tree of the method and the prefix tree of the method parameter in the process of acquiring the name of the target class file, the name of the target method and the method parameter.
Specifically, before the application program performs dynamic point burying, the name of the service where the application program of the point burying is located can be firstly obtained, so that all class files of the service can be conveniently loaded, and according to the loaded class files, the prefix tree of the method and the prefix tree of the method parameters are constructed, so that in the process that a user inputs the name of the target class file, the name of the target method and the prefix tree of the method parameters, the prefix tree of the class file, the prefix tree of the method and the prefix tree of the method parameters are displayed, thereby providing an automatic completion function of the name, further reducing the workload of the user and improving the point burying efficiency.
It should be noted that, the execution body of the method provided in this embodiment may specifically be an application performance management (Application Performance Management & Monitoring, APM) system or a visual embedded point tool, where the system or the tool may implement real-time Monitoring of the performance of an application program and real-time management of a series of faults in the running process of the application program, and the application performance management system or the visual embedded point tool may run on any computer device such as a server side or an agent side.
204. And acquiring the name of the target class file, the name of the target method, the method parameters and the buried point data.
Specifically, the computer device may obtain data in a plurality of manners, for example, may obtain the name of the target class file, the name of the target method, the method parameter and the buried point data by batch importing the data, or may obtain the name of the target class file, the name of the target method, the method parameter and the buried point data input into the UI (User Interface) interface through an input device, such as a keyboard, a display or a touch screen, where the target class file and the target method refer to a class file and a method that a user needs to perform buried point respectively. In addition, the computer equipment can also acquire the name of the service, so as to determine the loading range of the class file; the computer equipment can also acquire the name of the embedded point file (namely the name of the file generated by the embedded point data, which is displayed in the link tracking), so that after the embedded point is embedded, the corresponding embedded point file is searched through the name of the embedded point file and information interpretation is carried out; the computer device may also obtain a method type, e.g. static or instance method, to select the corresponding interception method when performing the method interception.
In this embodiment, the types of the method parameters may include one or more of an Object (e.g., com. Shuidhu. Infra. Auto. Custom. Testreq), a collection (e.g., java. Util. List/java. Util. Set/java. Util. Map), an Object array (e.g., lcom. Shuidhu. Infra. Auto. Custom. Testreq; object java. Land. Object), map, object, array, basic data type (e.g., bootean/int/long), and a wrapper class (e.g., java. Land. Inter/java. Land. Long), i.e., the computer may obtain one or more types of the method parameters at the same time; the embedded point data may include at least one tag data and/or at least one log data, where the tag data includes a tag name and a tag expression, and the log data may include a log name and a log expression, where the method parameter or the return value focused by the user may be recorded in the embedded point file in the form of a tag or a log through the tag and the log, and specifically, the expression may also be a segment of a character string.
205. And verifying the method parameters, acquiring the target method and the target class file according to the method parameters, the name of the target method and the name of the target class file, and transmitting the target method, the target class file and the embedded point data to the target proxy.
Specifically, after the computer device obtains the corresponding data, the obtained data may be checked and matched, for example, whether the name of the target method and the name of the target class file are matched, whether the parameter of the method accords with the grammar specification or not may be verified, if the name of the target method and the name of the target class file are matched, and if the parameter of the method accords with the grammar specification, the description files of the target class and the target method may be obtained through the class loader according to the parameter of the method, the name of the target method and the name of the target class file; if the name of the target method and the name of the target class file are not matched and/or the method parameters do not meet the grammar specification, the user is required to be prompted to refill data or to acquire the data again in other modes, and then the computer equipment can send the acquired target method, target class file and embedded data to the target proxy end.
In this embodiment, the application performance management system or the visual point burying tool for sending data may run on the target agent end, or may run on other devices, where the application performance management system or the visual point burying tool at the front end is mainly used to collect data and load files, and the target agent end runs with an application program, and may directly process the received data and implement dynamic point burying of the application program through data processing.
206. The target agent end intercepts and preprocesses the target method to set the target method to a state that can be buried.
Specifically, after the target agent end obtains the description files of the target class and the target method, the target method can be intercepted and preprocessed through the interceptor, and when the target method is preprocessed, if the target method is set to be in a state of not being buried, some parameters of the target method need to be correspondingly modified, so that the target method is set to be in a state of being buried. In this embodiment, in the process of intercepting the target method, whether the target method is a static method may be first determined, if the target method is a static method, a code segment of the target method may be intercepted by a static interception manner, and the intercepted code segment may be preprocessed, and if the target method is a non-static method, the code segment of the target method may be intercepted by an instance interception manner, and the intercepted code segment may be preprocessed.
207. The target agent terminal calls an interface at a corresponding position of the target method, reports the embedded point data, redefines the target class file and obtains the enhanced target class file.
Specifically, after intercepting the target method, the target agent end can call a corresponding interface on a corresponding position of the target method through the interceptor, fill the buried data into the corresponding position of the target method, redefine the target class file after filling is finished, and obtain the enhanced target class file. In this embodiment, the interface may be specifically called at a front position or a rear position of the target method, and the embedded point data may be reported, so as to fill the embedded point data into the front position or the rear position of the target method.
208. The target agent replaces the target class file with the enhanced target class file through the byte code enhancement technology so as to realize the dynamic embedding point of the application program.
Specifically, the target agent end can dynamically replace the target class file with the enhanced target class file through a byte code enhancement technology, so that the dynamic embedding point of the application program is realized. In the whole process of embedding the point, the application program can continuously run, and after the point is embedded, the application program can output a corresponding embedded point file, so that the method parameters or return values focused by a user are collected into the embedded point file in the form of embedded point data, and then, in the process of running the application program, the user can inquire the embedded point file through a UI interface of an application performance management system or a visual embedded point tool, and perform information interpretation according to the embedded point data in the embedded point file, so as to obtain relevant information of running the application program.
Further, as a specific implementation of the methods shown in fig. 1 and fig. 2, the present embodiment provides a dynamic point burying device for an application program, as shown in fig. 3, where the device includes: a data acquisition module 31, a file acquisition module 32, a preprocessing module 33, a redefinition module 34 and a file enhancement module 35.
The data acquisition module 31 is configured to acquire a name of a target class file, a name of a target method, a method parameter, and buried point data;
the file acquisition module 32 is configured to verify the method parameters, acquire a target method and a target class file according to the method parameters, the name of the target method, and the name of the target class file, and send the target method, the target class file, and the embedded point data to a target proxy;
a preprocessing module 33, configured to intercept and preprocess the target method, so as to set the target method to a state that can be buried;
redefinition module 34, which is used to call the interface at the corresponding position of the target method, report the buried point data, redefine the target class file, and obtain the enhanced target class file;
the file enhancement module 35 may be configured to replace the object class file with an enhanced object class file by using a byte code enhancement technology, so as to implement dynamic embedding of the application program.
In a specific application scenario, as shown in fig. 4, the apparatus further includes a prefix tree construction module 36 and a prefix tree display module 37, where the file obtaining module 32 may be further configured to obtain all class files of a service where the target agent end is located; the prefix tree construction module 36 is configured to construct a prefix tree of a class file, a prefix tree of a method, and a prefix tree of a method parameter according to all class files served by the target agent end; the prefix tree display module 37 may be configured to display a prefix tree of the class file, a prefix tree of the method, and a prefix tree of the method parameter in a process of acquiring the name of the target class file, the name of the target method, and the method parameter.
In a specific application scenario, the embedded data includes tag data and/or log data, and the data obtaining module 31 is specifically configured to obtain at least one tag data and/or at least one log data, where the tag data includes a tag name and a tag expression; the log data includes a log name and a log expression.
In a specific application scenario, the file obtaining module 32 is specifically configured to determine whether the method parameter meets the grammar rule, and determine whether the name of the target method and the name of the target class file are matched; if the method parameters meet the grammar rules and the names of the target methods are matched with the names of the target class files, loading the target class files and the target methods according to the method parameters, the names of the target methods and the names of the target class files.
In a specific application scenario, the types of method parameters include one or more of objects, collections, object arrays, maps, objects, arrays, basic data types, and wrapper classes.
In a specific application scenario, the preprocessing module 33 is specifically configured to determine whether the target method is a static method; if the target method is a static method, statically intercepting a code segment of the target method, and preprocessing the intercepted code segment; if the target method is a non-static method, the instance intercepts the code segments of the target method and preprocesses the intercepted code segments.
In a specific application scenario, the redefinition module 34 may be specifically configured to call an interface at a pre-position or a post-position of the target method, and report the embedded point data, so as to fill the embedded point data into the pre-position or the post-position of the target method.
It should be noted that, other corresponding descriptions of the functional units related to the dynamic point burying device of the application program provided in this embodiment may refer to corresponding descriptions in fig. 1 and fig. 2, which are not repeated herein, and each functional module of the dynamic point burying device of the application program provided in this embodiment may be on the same computer device or on different computer devices.
Based on the above methods shown in fig. 1 and fig. 2, correspondingly, the present embodiment further provides a storage medium, on which a computer program is stored, where the program is executed by a processor to implement the dynamic point embedding method of the application program shown in fig. 1 and fig. 2.
Based on such understanding, the technical solution of the present application may be embodied in the form of a software product, where the software product to be identified may be stored in a non-volatile storage medium (may be a CD-ROM, a U-disc, a mobile hard disk, etc.), and include several instructions for causing a computer device (may be a personal computer, a server, or a network device, etc.) to execute the method described in the various implementation scenarios of the present application.
Based on the method shown in fig. 1 and fig. 2 and the embodiment of the dynamic point embedding device of the application program shown in fig. 3 and fig. 4, in order to achieve the above object, the present embodiment further provides an entity device of dynamic point embedding of the application program, which may specifically be a personal computer, a server, a smart phone, a tablet computer, a smart watch, or other network devices, where the entity device includes a storage medium and a processor; a storage medium storing a computer program; a processor for executing a computer program to implement the method as shown in fig. 1 and 2.
Optionally, the physical device may further include a user interface, a network interface, a camera, radio Frequency (RF) circuitry, sensors, audio circuitry, WI-FI modules, and the like. The user interface may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), etc., and the optional user interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface), etc.
It will be appreciated by those skilled in the art that the physical device structure of the dynamic embedded point of an application provided in this embodiment is not limited to the physical device, and may include more or fewer components, or may combine some components, or may be a different arrangement of components.
The storage medium may also include an operating system, a network communication module. The operating system is a program for managing the entity equipment hardware and the software resources to be identified, and supports the operation of the information processing program and other software and/or programs to be identified. The network communication module is used for realizing communication among all components in the storage medium and communication with other hardware and software in the information processing entity equipment.
From the above description of the embodiments, it will be apparent to those skilled in the art that the present application may be implemented by means of software plus necessary general hardware platforms, or may be implemented by hardware. By applying the technical scheme of the application, firstly, the name of the target class file, the name of the target method, the method parameters and the embedded point data are acquired, the description files of the target class and the target method are loaded through the acquired data, then the target method, the target class file and the embedded point data are sent to the target agent end, the target method is intercepted and preprocessed at the target agent end, so that the target method is set to be in a state of being embedded with the point, then the embedded point data are filled in the interceptor at the corresponding position of the target method, the target class file is redefined, the enhanced target class file is obtained, and finally the target class file is replaced by the enhanced target class file through the byte code enhancement technology, so that the dynamic embedded point of the application program is realized. Compared with the prior art, the method has the advantages that dynamic point burying of the application program is realized, point burying efficiency and point burying accuracy of the application program are improved, workload of point burying is reduced, and stability of codes is improved.
Those skilled in the art will appreciate that the drawing is merely a schematic illustration of a preferred implementation scenario and that the modules or flows in the drawing are not necessarily required to practice the application. Those skilled in the art will appreciate that modules in an apparatus in an implementation scenario may be distributed in an apparatus in an implementation scenario according to an implementation scenario description, or that corresponding changes may be located in one or more apparatuses different from the implementation scenario. The modules of the implementation scenario may be combined into one module, or may be further split into a plurality of sub-modules.
The above-mentioned inventive sequence numbers are merely for description and do not represent advantages or disadvantages of the implementation scenario. The foregoing disclosure is merely illustrative of some embodiments of the application, and the application is not limited thereto, as modifications may be made by those skilled in the art without departing from the scope of the application.

Claims (11)

1. A method for dynamic embedding of an application program, the method comprising:
acquiring the name of a target class file, the name of a target method, method parameters and buried point data;
verifying the method parameters, acquiring the target method and the target class file according to the method parameters, the name of the target method and the name of the target class file, and sending the target method, the target class file and the buried data to a target proxy;
the target agent end intercepts and preprocesses the target method so as to set the target method into a state that the target method can be buried;
the target agent terminal calls an interface at a corresponding position of the target method, reports the buried point data, redefines the target class file and obtains an enhanced target class file;
and the target agent end replaces the target class file with the enhanced target class file through a byte code enhancement technology so as to realize the dynamic embedding point of the application program.
2. The method of claim 1, wherein prior to obtaining the name of the target class file, the name of the target method, the method parameters, and the buried data, the method further comprises:
acquiring all class files of the service where the target agent end is located;
constructing a prefix tree of the class file, a prefix tree of a method and a prefix tree of a method parameter according to all class files of the service of the target agent end;
and displaying the prefix tree of the class file, the prefix tree of the method and the prefix tree of the method parameter in the process of acquiring the name of the target class file, the name of the target method and the method parameter.
3. The method of claim 1, wherein the buried data comprises tag data and/or log data, and wherein the obtaining buried data comprises:
acquiring at least one tag data and/or at least one log data, wherein the tag data comprises a tag name and a tag expression; the log data includes a log name and a log expression.
4. The method of claim 1, wherein the verifying the method parameters and obtaining the target method and the target class file based on the method parameters, the name of the target method, and the name of the target class file comprises:
judging whether the method parameters meet grammar rules or not, and judging whether the names of the target methods and the names of the target class files are matched or not;
and if the method parameters meet grammar rules and the names of the target methods are matched with the names of the target class files, loading the target class files and the target methods according to the method parameters, the names of the target methods and the names of the target class files.
5. The method of claim 1, wherein the types of method parameters include one or more of objects, collections, object arrays, maps, objects, arrays, base data types, and wrapper classes.
6. The method of claim 1, wherein intercepting and preprocessing the target method comprises:
judging whether the target method is a static method or not;
if the target method is a static method, statically intercepting a code segment of the target method, and preprocessing the intercepted code segment;
if the target method is a non-static method, the instance intercepts a code segment of the target method and preprocesses the intercepted code segment.
7. The method of claim 1, wherein the calling an interface at a corresponding location of the target method and reporting the buried point data comprises:
and calling an interface at the front position or the rear position of the target method, and reporting the embedded point data to fill the embedded point data into the front position or the rear position of the target method.
8. A dynamic embedded point device for an application, the device comprising:
the data acquisition module is used for acquiring the name of the target class file, the name of the target method, the method parameters and the buried point data;
the file acquisition module is used for verifying the method parameters, acquiring the target method and the target class file according to the method parameters, the name of the target method and the name of the target class file, and sending the target method, the target class file and the embedded point data to a target proxy;
the preprocessing module is used for intercepting and preprocessing the target method so as to set the target method into a state that the target method can be buried;
the redefinition module is used for calling an interface at a corresponding position of the target method, reporting the buried point data, redefining the target class file and obtaining an enhanced target class file;
and the file enhancement module is used for replacing the target class file with the enhanced target class file through a byte code enhancement technology so as to realize dynamic embedding of the application program.
9. The apparatus of claim 8, further comprising a prefix tree construction module and a prefix tree presentation module, wherein,
the file acquisition module is also used for acquiring all class files of the service where the target agent end is located;
the prefix tree construction module is used for constructing prefix trees of class files, prefix trees of methods and prefix trees of method parameters according to all class files served by the target agent end;
the prefix tree display module is used for displaying the prefix tree of the class file, the prefix tree of the method and the prefix tree of the method parameter in the process of acquiring the name of the target class file, the name of the target method and the method parameter.
10. A storage medium having stored thereon a computer program, which when executed by a processor, implements the steps of the method of any of claims 1 to 7.
11. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the computer program when executed by the processor implements the steps of the method according to any one of claims 1 to 7.
CN202010783426.4A 2020-08-06 2020-08-06 Dynamic point embedding method and device for application program, storage medium and computer equipment Active CN112115041B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010783426.4A CN112115041B (en) 2020-08-06 2020-08-06 Dynamic point embedding method and device for application program, storage medium and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010783426.4A CN112115041B (en) 2020-08-06 2020-08-06 Dynamic point embedding method and device for application program, storage medium and computer equipment

Publications (2)

Publication Number Publication Date
CN112115041A CN112115041A (en) 2020-12-22
CN112115041B true CN112115041B (en) 2023-08-22

Family

ID=73799160

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010783426.4A Active CN112115041B (en) 2020-08-06 2020-08-06 Dynamic point embedding method and device for application program, storage medium and computer equipment

Country Status (1)

Country Link
CN (1) CN112115041B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113326184B (en) * 2021-05-11 2022-05-17 前海飞算云智软件科技(深圳)有限公司 Interface testing method and device, storage medium and electronic equipment
CN114996128B (en) * 2022-05-19 2023-03-14 青矩技术股份有限公司 Script processing method, device and equipment based on ASM framework and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018113385A1 (en) * 2016-12-24 2018-06-28 上海壹账通金融科技有限公司 Method and system for dynamically tracking application of client, client, and server
CN109491645A (en) * 2018-10-17 2019-03-19 深圳壹账通智能科技有限公司 Point methods, device, computer equipment and storage medium are buried based on interface element
CN110908880A (en) * 2019-11-01 2020-03-24 北京金山安全软件有限公司 Embedded point code injection method, event reporting method and related equipment thereof
CN110941528A (en) * 2019-11-08 2020-03-31 支付宝(杭州)信息技术有限公司 Log buried point setting method, device and system based on fault

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018113385A1 (en) * 2016-12-24 2018-06-28 上海壹账通金融科技有限公司 Method and system for dynamically tracking application of client, client, and server
CN109491645A (en) * 2018-10-17 2019-03-19 深圳壹账通智能科技有限公司 Point methods, device, computer equipment and storage medium are buried based on interface element
CN110908880A (en) * 2019-11-01 2020-03-24 北京金山安全软件有限公司 Embedded point code injection method, event reporting method and related equipment thereof
CN110941528A (en) * 2019-11-08 2020-03-31 支付宝(杭州)信息技术有限公司 Log buried point setting method, device and system based on fault

Also Published As

Publication number Publication date
CN112115041A (en) 2020-12-22

Similar Documents

Publication Publication Date Title
CN103150513B (en) The method of the implantation information in interception application program and device
CN108920370B (en) Compatibility problem detection method, device and equipment
CN112115041B (en) Dynamic point embedding method and device for application program, storage medium and computer equipment
CN104134041A (en) Anti-detecting method and device of terminal simulator system
CN106294134A (en) The collapse localization method of code and device
CN104683386A (en) Pile service implementation method and device capable of customizing response
CN103309884A (en) User behavior data collecting method and system
CN110944048A (en) Service logic configuration method and device
CN111068328A (en) Game advertisement configuration table generation method, terminal device and medium
CN111258680B (en) Resource loading method and device, storage medium and electronic device
CN110928770B (en) Software testing method, device, system, storage medium and electronic equipment
CN105373293A (en) Data acquisition method and apparatus
CN114978940A (en) Link monitoring and alarming method, device, computer equipment and storage medium
CN112615759A (en) Full link voltage measurement assembly, full link voltage measurement method and device
CN111949491A (en) SQL extraction method and device for MyBatis application program
CN111159301A (en) Data creating method, device, equipment and storage medium based on intelligent contract
CN109933515B (en) Regression test case set optimization method and automatic optimization device
CN112463519A (en) Flatter-based page use behavior data non-buried point statistical method, equipment and storage medium
CN112699034A (en) Virtual login user construction method, device, equipment and storage medium
CN112817816B (en) Embedded point processing method and device, computer equipment and storage medium
CN114116509A (en) Program analysis method, program analysis device, electronic device, and storage medium
CN113010434A (en) System and method for realizing lightweight application point burying
CN113220586A (en) Automatic interface pressure test execution method, device and system
CN112784133B (en) Link visualization method, device, equipment and storage medium
CN110866211B (en) Method and device for processing abnormal page of client

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
CB02 Change of applicant information

Address after: 100102 201 / F, block C, 2 lizezhong 2nd Road, Chaoyang District, Beijing

Applicant after: Beijing Shuidi Technology Group Co.,Ltd.

Address before: 100102 201, 2 / F, block C, No.2 lizezhong 2nd Road, Chaoyang District, Beijing

Applicant before: Beijing Health Home Technology Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant