CN115237713A - Application data acquisition method and device, computer equipment and storage medium - Google Patents

Application data acquisition method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN115237713A
CN115237713A CN202210866756.9A CN202210866756A CN115237713A CN 115237713 A CN115237713 A CN 115237713A CN 202210866756 A CN202210866756 A CN 202210866756A CN 115237713 A CN115237713 A CN 115237713A
Authority
CN
China
Prior art keywords
module
probe
function
application
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210866756.9A
Other languages
Chinese (zh)
Inventor
程捷
李磊磊
吕子凯
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Bo Hongyuan Data Polytron Technologies Inc
Original Assignee
Beijing Bo Hongyuan Data Polytron Technologies Inc
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 Bo Hongyuan Data Polytron Technologies Inc filed Critical Beijing Bo Hongyuan Data Polytron Technologies Inc
Priority to CN202210866756.9A priority Critical patent/CN115237713A/en
Publication of CN115237713A publication Critical patent/CN115237713A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3065Monitoring arrangements determined by the means or processing involved in reporting the monitored data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3089Monitoring arrangements determined by the means or processing involved in sensing the monitored data, e.g. interfaces, connectors, sensors, probes, agents
    • G06F11/3093Configuration details thereof, e.g. installation, enabling, spatial arrangement of the probes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2201/00Indexing scheme relating to error detection, to error correction, and to monitoring
    • G06F2201/865Monitoring of software

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the invention discloses an application data acquisition method, an application data acquisition device, computer equipment and a storage medium. The method comprises the following steps: loading a probe module when detecting that an initial process belonging to a target application is started; adding callback information in the target function of the initial process through the probe module, and updating the target function; calling the updated target function through the target application, and sending the monitoring data of the target application to the probe module based on the callback information; and reporting the monitoring data to a server through the probe module. The embodiment of the invention can automatically load the probe module when detecting that the initial process belonging to the target application is started, realize the automatic deployment of the callback information in the target function, reduce the labor cost for deploying the callback information, and improve the efficiency for deploying the callback information, thereby improving the efficiency for acquiring the monitoring data of the target application.

Description

Application data acquisition method and device, computer equipment and storage medium
Technical Field
The embodiment of the invention relates to the field of data acquisition, in particular to an application data acquisition method, an application data acquisition device, computer equipment and a storage medium.
Background
The probe is a source code package written by a programming language, namely, the probe is provided and used in a mode of an SDK (Software Development Kit) so as to achieve the function of acquiring the monitoring data of the application program.
At present, probe source codes are introduced into an application program, the application program source codes need to be changed, and the changed application program source codes are re-analyzed so as to adapt to the probe source codes and realize monitoring data acquisition.
The existing modes for changing the source codes of the application programs are all manual configuration, when a large number of application programs are faced, the workload of the manual configuration mode is increased, the configuration efficiency is reduced, meanwhile, extra development and maintenance costs are required, and the cost of monitoring data acquisition is increased.
Disclosure of Invention
The embodiment of the invention provides an application data acquisition method, an application data acquisition device, computer equipment and a storage medium, which can automatically load a probe module when detecting that an initial process belonging to a target application is started so as to update a target function, reduce the labor cost for updating the target function, and improve the efficiency for updating the target function, thereby improving the efficiency for acquiring monitoring data of the target application.
In a first aspect, an embodiment of the present invention provides an application data acquisition method, including:
loading a probe module when detecting that an initial process belonging to a target application is started;
adding callback information in the target function of the initial process through the probe module, and updating the target function;
calling the updated target function through the target application, and sending the monitoring data of the target application to the probe module based on the callback information;
and reporting the monitoring data to a server through the probe module.
In a second aspect, an embodiment of the present invention provides an application data acquisition apparatus, including:
the probe loading module is used for loading the probe module when detecting that the initial process belonging to the target application is started;
the function updating module is used for adding callback information in the target function of the initial process through the probe module and updating the target function;
the data sending module is used for calling the updated target function through the target application and sending the monitoring data of the target application to the probe module based on the callback information;
and the data reporting module is used for reporting the monitoring data to a server through the probe module.
In a third aspect, an embodiment of the present invention further provides an apparatus, including a memory, a processor, and a computer program that is stored in the memory and is executable on the processor, where when the processor executes the computer program, the application data acquisition method according to any one of the embodiments of the present invention is implemented.
In a fourth aspect, embodiments of the present invention further provide a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the application data acquisition method according to any one of the embodiments of the present invention.
In a fifth aspect, an embodiment of the present invention further provides a computer program product, where the computer program product includes a computer program, and when the computer program is executed by a processor, the computer program implements the application data acquisition method according to any embodiment of the present invention.
The embodiment of the invention detects the application program, loads the probe module when detecting that the initial process belonging to the target application is started, injects a callback function into the target function of the initial process through the probe module to update the target function, then calls the updated target function through the target application, and sends the monitoring data of the target function to the probe module based on the callback function, so that the probe module reports the monitoring data to the server, and changes the program code segment by automatically loading the probe module when detecting that the initial process belonging to the target application is started, namely, updates the target function, thereby realizing automatic deployment of the callback information in the target function, and further acquiring the monitoring data based on the callback information.
Drawings
FIG. 1 is a flowchart of an application data acquisition method according to a first embodiment of the present invention;
FIG. 2 is a flowchart of an application data collection method according to a second embodiment of the present invention;
FIG. 3a is a flowchart of an application data acquisition method according to a third embodiment of the present invention;
FIG. 3b is a flowchart of an application data collection method according to a third embodiment of the present invention;
FIG. 4 is a flowchart of an application data acquisition method according to a fourth embodiment of the present invention;
fig. 5 is a schematic structural diagram of an application data acquisition device in the fifth embodiment of the present invention;
fig. 6 is a schematic structural diagram of a computer device in a sixth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1 is a flowchart of an application data acquisition method in a first embodiment of the present invention, where this embodiment is applicable to a case where application data acquisition is performed by a probe, and the method may be executed by an application data acquisition apparatus provided in the first embodiment of the present invention, where the apparatus may be implemented in a software and/or hardware manner, and may be generally integrated in a computer device, for example, a terminal device or a server. As shown in fig. 1, the method of this embodiment specifically includes:
s110, when the initial process belonging to the target application is detected to be started, loading the probe module.
The target application refers to an application program which needs to collect monitoring data. Illustratively, the target application may be a video application, a news application, a music application, a browser application, or the like. Optionally, the target application is an application program written based on the GO language. Specifically, the GO language is a programming language with strong static type, compiling type and concurrency type, and with garbage collection function.
The application program may be a client program or a server program. In the embodiment of the present invention, the application program may refer to a program deployed in a server, that is, a server-side program. The server can be used for deploying a plurality of application programs, and each application program can be deployed in different containers respectively; or only one application may be deployed in one server.
Typically, during application startup: the processor first loads a process loader, which is used to load all modules on which the application program runs into the memory. Therefore, the application program can process according to the received access request or call other application programs to obtain and feed back the response result.
The initial process refers to the process that the target application starts. It will be appreciated that the initial process is released after the target application execution is complete. The probe module is used for updating the target function, acquiring the updated monitoring data of the target function and sending the monitoring data to the server so that the server can evaluate the performance of the target application.
Specifically, when the application program is started, the process of the application program is detected through the probe loading module, if the process of the application program is detected to belong to the starting of the initial process of the target application, the probe module is loaded, and if the process of the application program is detected not to belong to the starting of the initial process of the target application, the probe module is not loaded.
And S120, adding callback information in the target function of the initial process through the probe module, and updating the target function.
The target function is a function which needs to be monitored in the initial process of the target application. It is also understood that the objective function refers to a function that needs data collection during the initial process of the objective application. In this embodiment, the calling target function may be an executable file corresponding to the initial process. The executable file refers to a file that can be loaded and executed by an operating system, and the function of the target application, that is, the running of the target application, can be realized by executing the executable file corresponding to the initial process. The Executable and Linkable Format (ELF) is composed of four parts, namely an ELF header (ELF header), a Program header table (Program header table), a Section (Section) and a Section header table (Section header table). The callback information refers to a code segment for indicating the target function to feed back the monitoring data to the probe module, and the callback information can be a callback function or a jump code. The callback function refers to a code segment for feeding back monitoring data to the probe module through an indication target function represented by the function. Illustratively, a callback function may be a function that contains a call target function parameter and a return value. The operation behavior of the application program can be monitored through the callback function, and the operation behavior data is obtained and sent to the server, so that the server can evaluate the performance of the application program. The springboard code refers to a section of executable memory code applied in the running process of the initial process. Specifically, the probe module applies for a section of memory with execution authority for the target function, writes a code section in the memory to form a springboard code, can call the target function through the springboard code, and feeds back monitoring data to the probe module. The springboard code may comprise: calling a callback pre-function containing target function parameters; calling a target function; and calling a callback function containing the target function parameter and the return value, namely calling the callback function.
Specifically, the probe module adds callback information to the target function of the initial process according to the callback information to form a new target function, so that the target function is updated.
Optionally, the target function includes a function for processing an http request, the callback information includes pre-callback information and post-callback information, and the monitoring data includes response time.
http (Hyper Text Transfer Protocol) is a simple request-response Protocol. It specifies what messages the client may send to the server and what responses to get. An http request refers to an access request sent over http. The http request processing function is a function for instructing an initial process of the target application to process the http request. The pre-callback information refers to information of a callback before the target function executes, and may be, for example, a pre-callback function including parameters of the target function. The post-callback information refers to information of a callback after the target function executes, and may be, for example, a post-callback function including a parameter of the target function and a return value. Response time refers to the time required for the initial process to execute the function that handles the http request. For example, the previous callback information may mark a time when the target function starts to execute, the subsequent callback information may mark a time when the target function completes to execute, and the response time is a difference between the time when the target function completes to execute in the subsequent callback information and the time when the target function starts to execute in the previous callback information.
By means of the front callback information and the rear callback information included in the callback information, the time when the target function starts to be executed and the time when the target function is completed can be accurately acquired, the response time is obtained, the accuracy rate determined by the response time in the monitoring data can be improved, and therefore the accuracy rate of acquiring the monitoring data is improved.
S130, the updated target function is called through the target application, and the monitoring data of the target application are sent to the probe module based on the callback information.
The monitoring data is used for describing the running process of the target application. Specifically, the monitoring data may include parameter data of an objective function, which is used to monitor operation behavior data of the application program during the running process. The monitoring data may also include statistical data obtained by performing statistical analysis on the operational behavior data.
Specifically, the target application in the processor calls the updated target function, obtains the monitoring data according to the callback information in the process of executing the updated target function, and sends the monitoring data to the probe module. Illustratively, when the callback information includes front callback information and rear callback information, and when the target application calls the updated target function, the target application first sends monitoring data to the probe module according to the front callback information, then executes the original target function, and finally sends the monitoring data to the probe module according to the rear callback information.
And S140, reporting the monitoring data to a server through the probe module.
Specifically, the probe module sends the updated target function to the server to obtain the monitoring data.
According to the embodiment of the invention, by detecting the application program, when the starting of the initial process belonging to the target application is detected, the probe module is loaded, the callback information is added into the target function of the initial process through the probe module, the target function is updated, the updated target function is called through the target application, the monitoring data of the target function is sent to the probe module based on the callback information, the probe module reports the monitoring data to the server, and the program code segment is modified by automatically loading the probe module when the starting of the initial process belonging to the target application is detected, namely, the target function is updated, so that the callback information is automatically deployed in the target function, and the monitoring data is obtained based on the callback information.
Example two
Fig. 2 is a flowchart of an application data acquisition method in the second embodiment of the present invention, and this embodiment is based on the above embodiment, and is embodied as follows: acquiring alternative functions and function information associated with the initial process through the probe module; determining a target function from each alternative function through the probe module, and determining positioning information of the target function from the function information, wherein the target function corresponds to the monitoring data; determining an adding position according to the positioning information of the target function through the probe module, wherein the adding position corresponds to the monitoring data; adding the callback information in the adding position by the probe module. As shown in fig. 2, the method of this embodiment specifically includes:
s210, when the initial process belonging to the target application is detected to be started, loading a probe module.
S220, acquiring the alternative function and function information associated with the initial process through the probe module.
An alternative function refers to a function that may be executed in the initial process of the target application. At least one alternative function may be associated in the initial progress of the target application. It is understood that, in the initial process, a plurality of alternative functions may be included, and the target application may determine, according to the received access request, a function to be executed from the alternative functions. The function information refers to information describing each alternative function in the initial process. The function information may include at least one of a name, location information, identification, and type.
Specifically, the probe module may obtain an executable file corresponding to the candidate function associated with the initial process, and obtain information of the candidate function according to the executable file corresponding to the candidate function to form function information.
S230, determining an objective function from the alternative functions through the probe module, and determining positioning information of the objective function from the function information, wherein the objective function corresponds to the monitoring data.
The positioning information refers to an offset address of the target function in the executable file. Illustratively, an executable file of an application includes a section with a section name ". Symtab", which includes names and location information of all functions in the executable file.
Specifically, in the process of the application program, the names and the positioning information of all functions in the executable file are obtained by analyzing the executable file of the process, and the positioning information corresponding to the target function, that is, the offset address of the target function, is determined from the names and the positioning information, that is, the target function corresponds to the monitoring data, that is, the monitoring data is the monitoring data sent by the target function to the probe module. Illustratively, when the objective function is a "net/http.serverhttp" function, the monitoring data is a response time of the "net/http.serverhandler.serverhttp" function.
S240, determining an adding position according to the positioning information of the target function through the probe module, wherein the adding position corresponds to the monitoring data.
The adding position refers to a position where callback information is added to the target function of the target process, and may also be understood as a position where a memory address of the callback function is added to the target function. The target process refers to a process in which the target function is located. Specifically, the probe module determines an adding position for adding callback information in the target function according to the positioning information of the target function. Illustratively, the positioning information of the target function is a file offset address of the target function in the executable file, and the adding position is determined as a memory address of the target function in the actual running process of the target process by adding the running base address of the process to the offset address of the target function according to the adding result.
Specifically, the probe module determines an adding position for adding callback information in the target function according to the positioning information of the target function, wherein the adding position corresponds to the monitoring data, that is, the probe module acquires the monitoring data from the adding position. Illustratively, the callback information is a jump board code, the monitoring data is response time of a function of net/http, server handler, server http, and a first line code with a position of the function of net/http, server handler, server http is added, and the probe module modifies the first line code to jump to an address where the jump board code is located, that is, when the target program executes the first line code of the function of net/http, the probe module jumps to the jump board code, so that the monitoring data is sent to the probe module based on the callback function.
S250, adding the callback information in the adding position through the probe module.
Specifically, the probe module adds callback information at the adding position in the target function according to the adding position to update the target function.
S260, calling the updated target function through the target application, and sending the monitoring data of the target application to the probe module based on the callback information.
And S270, reporting the monitoring data to a server through the probe module.
According to the technical scheme of the embodiment of the invention, the alternative function and the function information associated with the initial process are obtained through the probe module, the positioning information of the target function in the alternative function is determined through the function information, the adding position of the callback information is determined according to the positioning information of the target function, the callback information is added, the target function is not required to be updated in a manual configuration mode, the automatic adding of the callback information can be realized, the adding position of the callback information is determined through the positioning information of the target function, the adding accuracy of the callback information can be improved, the adding position corresponds to monitoring data, namely, the adaptive adjustment of the adding position is carried out aiming at different monitoring functions, the obtaining of various monitoring data can be realized, the use flexibility of the probe module is improved, and the collection flexibility of application data is improved.
EXAMPLE III
Fig. 3a is a flowchart of an application data acquisition method in the third embodiment of the present invention, and this embodiment starts the detected initial process belonging to the target application based on the above embodiment, specifically as follows: under the condition that the starting of the alternative process is detected, an executable file of the alternative process is obtained; analyzing the executable file to obtain analysis data; and determining that the initial process belonging to the target application is started under the condition that the section head table of the analysis data comprises the specified information. As shown in fig. 3a, the method of this embodiment specifically includes:
s310, under the condition that the starting of the alternative process is detected, the executable file of the alternative process is obtained.
The alternative process refers to a process included in the application. One application program may include at least one alternative process, each alternative process corresponds to one executable file, and the alternative process is used for calling the corresponding executable file when the application program receives an access request, so as to respond to the access request.
Specifically, when the application program is started, the processor loads the alternative process, and when the alternative process is detected to be started, the executable file used for running the alternative process is acquired.
S320, analyzing the executable file to obtain analysis data.
The analysis data refers to data obtained after the executable file is analyzed. The contents of ELF header, program header table, section and section header table in the executable file can be obtained by analyzing the data.
Specifically, when detecting that the alternative process is started, the processor analyzes the executable file of the started alternative process to obtain analyzed analysis data.
S330, determining that the initial process belonging to the target application is started under the condition that the section header table of the analysis data comprises the specified information.
The designation information is information for determining that the candidate process is the initial process of the target application. The designated information comprises at least one item of content, and when any item of content in the designated information is contained in the data of the section head table of the executable file in the analysis data, the data of the section head table of the executable file in the analysis data is determined to comprise the designated information. The specific information is determined according to the target application, and the specific information corresponding to different target applications is different.
Specifically, by traversing the data of the section head table of the executable file in the parsed data, when the data of the section head table of the executable file in the parsed data contains the specified information, it is determined that the initial process belonging to the target application is started, and when the data of the section head table of the executable file in the parsed data does not contain the specified information, it is determined that the initial process belonging to the target application is not started.
Illustratively, the initial process of the target application is the initial process of the Golang application, and the designation information is the section names ". Gopclntab", ". Note. Traversing and analyzing data of a node head table of an executable file in the data, determining that an initial process belonging to a target application is started when any one of node names of 'gopclntab', 'note.go.built' or 'gosymtab' exists in the data of the node head table, and determining that the initial process belonging to the target application is not started when specified information does not exist in the data of the node head table.
S340, when the initial process belonging to the target application is detected to be started, loading the probe module.
And S350, adding callback information in the target function of the initial process through the probe module, and updating the target function.
S360, the updated target function is called through the target application, and the monitoring data of the target application are sent to the probe module based on the callback information.
And S370, reporting the monitoring data to a server through the probe module.
The embodiment of the invention can improve the accuracy of judging the initial process starting of the target application by acquiring the executable file of the alternative process under the condition of detecting the starting of the alternative process, determining whether the data of the section head table of the executable file in the analysis data contains the specified information or not in the analysis data obtained after the analysis of the executable file, determining the starting of the initial process belonging to the target application under the condition of containing the specified information, and judging the starting of the initial process belonging to the target application through the specified information.
On the basis of the foregoing embodiment, the detecting of the initial process start belonging to the target application includes: loading a process loader module under the condition of detecting the starting of the alternative process; loading a preload module by the process loader module; detecting, by the pre-loading module, an initial process start belonging to a target application.
The process loader module is specifically a module which is commonly used in an operating system and used for loading programs and dynamic libraries. The process loader module is a module that is loaded first after the application program is started, and is responsible for mapping files related to the application program from a file form into a memory, loading corresponding dependency modules, initializing executable modules, initializing environments required by the application program, and finally calling a program entry point (main function, namely a main function) to execute real work. The preloading module can refer to an application program which is loaded preferentially in the process of loading the application program by the process loader module. The initial progress of the target application may be identified by the preload module. Typically, the preload module runs after the process loader module runs.
Specifically, the pre-loading module may be specified by the configuration file before the application program is run, so that when the process loader module loads the application program, the specified pre-loading module is inserted into the module table first, and then the other modules on which the application program depends are inserted, and the pre-loading module is always located after the process loader module in the position of the module table. When the application program is operated, the process loader module is loaded under the condition that the starting of the alternative process is detected, the process loader module loads the preloading module, the alternative process is detected through the preloading module, and the starting of the initial process belonging to the target application is detected. Illustratively, the preloading module analyzes the executable file in the initial process to obtain analysis data, and determines that the initial process belonging to the target application is started under the condition that the data of the section header table of the executable file in the analysis data comprises the specified information.
The method comprises the steps of loading a process loader module under the condition that starting of an alternative process is detected, loading a preloading module through the process loader module, detecting starting of an initial process belonging to a target application through the preloading module, loading the preloading module on the basis of the process loader as a universal module for loading a program and a dynamic library through the process loader module, and ensuring the accuracy of detecting starting of the initial process of the target application.
In a specific example, as shown in fig. 3b, the applying the data collecting method may include:
s3001, the processor loads the process loader module when detecting the alternative process starting.
S3002, loading the preloading module through the progress loader module.
The pre-loading module is used for detecting the application program written in the GO language. In this embodiment, the operating system is a Linux system, and the agentloader module may be set as a Preload module by using a Linux Preload technology. Typically, the preload module runs after the process loader module runs.
S3003, detecting the initial process start belonging to the target application by the preloading module.
The target application is an application program written in the GO language, and the initial process of the target application is an initial process of the application program written in the GO language and can also be called a Golang application process.
Specifically, the preloading module obtains an executable file of the alternative process, and the executable file is analyzed to obtain analysis data. And determining that the initial process belonging to the target application is started under the condition that the data of the section head table of the executable file in the analysis data comprises the specified information. Illustratively, the preloaded module traverses the node head table data of the executable file in the parsing data, and when any one of the node names of ". Gopclntab", ". Note. Go. Built" or ". Gosymtab" exists in the node head table, it indicates that the current process is the Golang application process, that is, the initial process of the target application is started.
S3004, when detecting that the initial process belonging to the target application is started, the processor loads the probe module.
The probe module is used for monitoring a target function, and illustratively, the probe module can be an agentgo module, and the monitored target function is a net/http.
S3005, adding callback information in the target function of the initial process through the probe module, and updating the target function.
Specifically, candidate functions and function information associated with the initial process are acquired through the probe module, an objective function is determined from each candidate function, positioning information of the objective function is determined from the function information of the candidate functions, an adding position is determined according to the positioning information of the objective function, and the callback information is added to the adding position.
Illustratively, the callback information includes pre-callback information and post-callback information. The add position is the objective function.
And S3006, when the initial process of the target application receives the http access request, calling the updated target function.
S3007, the initial process of the target application triggers and calls the previous callback information in the probe module, and the previous callback information carries the parameters of the target function.
And S3008, executing the target function after the previous callback information is executed.
And S3009, after the target function is executed, triggering and calling back call information in the probe module, wherein the back call information carries parameters and return values of the target function.
S3010, the probe module takes data collected in the execution process of the front callback information and the back callback information as monitoring data and reports the monitoring data to a server.
The embodiment of the invention detects the application program, loads the probe module when detecting that the initial process belonging to the target application is started, adds callback information in the target function of the initial process through the probe module, updates the target function, calls the updated target function through the target application, sends the monitoring data of the target function to the probe module based on the callback information, enables the probe module to report the monitoring data to the server, changes the program code segment by automatically loading the probe module when detecting that the initial process belonging to the target application is started, namely updates the target function, thereby realizing the automatic addition of the callback information in the target function, further acquiring the monitoring data based on the callback information, and solving the problems of large workload, low efficiency and high cost when manually deploying the callback information in the prior art, thereby reducing the labor cost for deploying the callback information, improving the efficiency for deploying the callback information, and further improving the efficiency for acquiring the monitoring data of the target application.
Example four
Fig. 4 is a flowchart of an application data acquisition method in a fourth embodiment of the present invention, where the present embodiment is based on the foregoing embodiment, further including: according to the equipment program identifier, reporting to a server; receiving probe identification fed back by the server aiming at the equipment program identification; after loading the probe module, further comprising: receiving a probe identification request sent by the probe module; in the event that the probe identity request includes the device identity, feeding back the probe identity to the probe module; reporting the monitoring data to a server through the probe module comprises: and reporting the monitoring data and the probe identification to a server through the probe module.
In this embodiment, the application programs may also be deployed in containers, one container deploying one application, and different containers being separate and independent from each other. The application program takes the container as the running environment. Thus, a probe deployment module deployed in an environment external to the container will not affect the container, i.e., no probe deployment module is deployed in the container. Therefore, there is a need to configure the probe deployment module in the container in which the application is deployed. A container system may refer to a cluster of containers. Illustratively, the container system may be referred to as a Docker. In the Linux operating system, docker uses the Linux namespace to isolate the running environment of the container.
As shown in fig. 4, the method of this embodiment specifically includes:
and S410, acquiring the equipment program identifier and reporting to a server.
The device program identifier refers to a probe identifier and a device identifier of a last executed process stored in the probe deployment module when the probe deployment module is started. The device identifier refers to an identifier of a computer device running the application program.
When detecting that the application program is started, the probe deployment module acquires the equipment program identifier and reports the equipment program identifier to the server.
And S420, receiving probe identification fed back by the server aiming at the equipment program identification.
The probe identification is used to identify the corresponding probe of the application. The probe identification comprises at least one item of process id, container id, process identification and the like. The process id is an identifier allocated to the application program when the application program is started. The container id refers to the identification of the container when the application is deployed in the container. The process identification is used to distinguish the processes in the application. Illustratively, the process identification may be the name of the process.
Specifically, after receiving the device program identifier, the server generates a new probe identifier according to the device program identifier, and feeds the probe identifier back to the probe deployment module. It can also be understood that, after receiving the device program identifier, the server updates the device program identifier, and feeds back the updated device program identifier as the probe identifier to the probe deployment module.
S430, when the initial process belonging to the target application is detected to be started, loading the probe module.
S440, receiving a probe identification request sent by the probe module.
A probe identification request refers to a request to instruct a probe deployment module to send a probe identification. Specifically, after the probe module is loaded, a probe identification request is sent to the probe deployment module, and the probe deployment module receives the probe identification request.
S450, under the condition that the probe identification request comprises the equipment identification, feeding the probe identification back to the probe module.
The device identification is used to identify the computer device where the application is located. The server may receive the application programs of multiple computer devices, and specifically, multiple application programs may be deployed in one computer device. The device identification is used to determine a target computer device, i.e., a computer device with a target application deployed, among the plurality of computer devices. The computer device may refer to a hardware device in which a server program is deployed in a server.
Specifically, the probe deployment module identifies the device identifier in the probe identifier request according to the probe identifier request. And when the probe deployment module identifies the equipment identifier, sending the probe identifier corresponding to the equipment identifier stored in the probe deployment module to the probe module. The probe identification and the equipment identification have a corresponding relation and are used for describing the relation between the computer equipment corresponding to the equipment identification and the application program running in the computer equipment. Optionally, after the probe identifier is fed back to the probe module, the probe identifier and the device identifier are stored in the probe deployment module as a device program identifier.
And S460, adding callback information in the target function of the initial process through the probe module, and updating the target function.
S470, calling the updated target function through the target application, and sending the monitoring data of the target application to the probe module based on the callback information.
And S480, reporting the monitoring data and the probe identification to a server through the probe module.
And the target application calls the updated target function, generates monitoring data and sends the monitoring data to the probe module. And the probe module sends the received monitoring data and the probe identification to a server.
According to the technical scheme of the embodiment of the invention, the equipment program identification is obtained and reported to the server, the server feeds the equipment program identification back to the probe identification, and the automatic generation of the probe identification is realized, so that the automatic configuration of the probe module is realized, the configuration efficiency of the probe module can be improved, the probe identification request sent by the probe module is received after the probe module is loaded, the probe identification is fed back to the probe module under the condition that the probe identification request comprises the equipment identification, the equipment identification in the probe identification request is firstly identified before the probe identification is fed back, so that the feedback accuracy of the probe identification is ensured, the accuracy of the probe module for acquiring the monitoring data is improved, the monitoring data and the probe identification are reported to the server through the probe module simultaneously, the server can establish the relation between the monitoring data and the probe identification, and the management efficiency of the server on the monitoring data is improved.
Optionally, when the application program is deployed in the container, before detecting that the application program is started, first detecting whether the container system is started, and when detecting that the container system is started, monitoring a process associated with the container system; when the existence of a container establishing process is detected, the probe deployment module is configured and a directory of an access file associated with the callback information is mounted in the container establishing process.
The detection of whether the container system is activated may specifically be: it is determined whether a process of the container system is occurring. If all running processes do not include any process associated with the container system before a certain time, after the certain time, one running process exists as the process associated with the container system, and the container system is determined to be started. The identification and detection of the process associated with the container system may be determined by the name of the process, for example, the process including the container id is the process associated with the container system. In addition, the process associated with the container system may also be determined in other manners, and whether the process of the container system occurs may also be determined in other manners, for example, if a starting process of the container system exists in all running processes, the starting process may refer to a process with a name specified in advance, which is not limited in the embodiment of the present invention.
The process associated with the container system may refer to a process that is running when the container system is working normally.
Specifically, an application may be preconfigured to monitor the progress associated with the container system.
A process associated with the container system is monitored to detect whether a container is newly created by the container system. Generally, the process of deploying and running the application in the container may specifically be: starting a container system, creating a container through the container system, configuring relevant parameters of the application program operation in the container creating process, and loading the application program in the created container. Therefore, after the creation operation of the container is detected, the probe deployment module is configured to be a preloading module of the application process while the original related parameters of the application program are configured to run, so that the probe deployment module is automatically loaded in the container.
Optionally, the detecting that the container system is started includes: traversing the process tree; and if the process related to the container engine container system appears in the process tree for the first time, determining that the container system is started.
A process tree may refer to a tree that includes multiple processes that are running, as well as relationships of the processes.
The first occurrence of the process related to the container system indicates that all running processes do not include any process related to the container system before the current time, and the current occurrence of the container system generally indicates that the container system is started and starts to work normally, and at this time, it can be determined that the container system is started. The process of first occurrence of the container system association may also refer to a process of first occurrence of the container system association within a set time period.
The starting of the container system can be accurately judged by traversing the process tree, and the process associated with the container system appears in the process tree for the first time, so that whether a new process of the container exists can be monitored in time, and callback information is configured in the container establishing process in time when the container establishing process is detected to exist, and the callback information is guaranteed to be accurately deployed in the container.
The method comprises the steps of monitoring a process associated with a container system in a scene of running an application program in a container, configuring a probe deployment module in the establishing process of the container when the establishing process of the container exists, accurately deploying the probe deployment module into the container, so that the probe deployment module can be automatically run in the container, and simultaneously mounting a directory of an access file associated with callback information into the established container, so that the access file associated with the callback information can be accessed in the container, and the callback information can be accurately deployed in the container.
EXAMPLE five
Fig. 5 is a schematic diagram of an application data acquisition device in the fifth embodiment of the present invention. The fifth embodiment is a corresponding apparatus for implementing the application data acquisition method provided in the foregoing embodiments of the present invention, and the apparatus may be implemented in a software and/or hardware manner, and may be generally integrated into an electronic device, for example, a computer device.
Correspondingly, the apparatus of the present embodiment may include: the system comprises a probe loading module 501, a function updating module 502, a data sending module 503 and a data reporting module 504.
The probe loading module 501 is configured to load a probe module when detecting that an initial process belonging to a target application is started;
a function updating module 502, configured to add callback information to the target function of the initial process through the probe module, and update the target function;
the data sending module 503 is configured to call the updated target function through the target application, and send the monitoring data of the target application to the probe module based on the callback information;
a data reporting module 504, configured to report the monitoring data to a server through the probe module.
The embodiment of the invention detects the application program, loads the probe module when detecting that the initial process belonging to the target application is started, adds callback information in the target function of the initial process through the probe module, updates the target function, calls the updated target function through the target application, sends the monitoring data of the target function to the probe module based on the callback information, enables the probe module to report the monitoring data to the server, changes the program code segment by automatically loading the probe module when detecting that the initial process belonging to the target application is started, namely updates the target function, thereby realizing the automatic addition of the callback function in the target function, further acquiring the monitoring data based on the callback function, solving the problems of large workload, low efficiency and high cost when manually deploying the callback function in the prior art, reducing the labor cost for deploying the callback function, improving the efficiency for deploying the callback function, and further improving the efficiency for acquiring the monitoring data of the target application.
Further, the function update module 502 includes: the alternative function acquisition unit is used for acquiring alternative functions and function information related to the initial process through the probe module; a positioning information determining unit, configured to determine, by the probe module, an objective function from among the candidate functions, and determine, from the function information, positioning information of the objective function, where the objective function corresponds to the monitoring data; an adding position determining unit, configured to determine, by the probe module, an adding position according to the positioning information of the target function, where the adding position corresponds to the monitoring data; and the callback information adding unit is used for adding the callback information in the adding position through the probe module.
Further, the probe loading module 501 includes: an executable file acquiring unit, configured to acquire an executable file of an alternative process when starting of the alternative process is detected; the analysis unit is used for analyzing the executable file to obtain analysis data; and the initial process starting determining unit is used for determining the starting of the initial process belonging to the target application under the condition that the section header table of the analysis data comprises the specified information.
Further, the executable file acquiring unit includes: the process loader loading subunit is used for loading the process loader module under the condition that the starting of the alternative process is detected; the preloading module loading subunit is used for loading the preloading module through the process loader module; and the initial process starting subunit is used for detecting the starting of the initial process belonging to the target application through the preloading module.
Further, the application data acquisition device further includes: the device program identifier reporting module is used for acquiring the device program identifier and reporting the device program identifier to the server; the probe identification receiving module is used for receiving probe identifications fed back by the server aiming at the equipment program identifications; the probe identification request receiving module is used for receiving a probe identification request sent by a probe module after the probe module is loaded; a probe identity feedback module, configured to feed back the probe identity to the probe module if the probe identity request includes the device identity; the data reporting module 504 is specifically configured to: and reporting the monitoring data and the probe identification to a server through the probe module.
Further, the target function includes a function for processing an http request, the callback information includes pre-callback information and post-callback information, and the monitoring data includes response time.
Further, the target application is an application program written based on the GO language.
The application data acquisition device can execute the application data acquisition method provided by the embodiment of the invention, and has the corresponding functional modules and beneficial effects of the executed application data acquisition method.
Example six
Fig. 6 is a schematic structural diagram of a computer device according to a sixth embodiment of the present invention. FIG. 6 illustrates a block diagram of an exemplary computer device 12 suitable for use in implementing embodiments of the present invention. The computer device 12 shown in FIG. 6 is only an example and should not bring any limitations to the functionality or scope of use of embodiments of the present invention.
As shown in FIG. 6, computer device 12 is in the form of a general purpose computing device. The components of computer device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that couples various system components including the system memory 28 and the processing unit 16. The computer device 12 may be a device that is attached to a bus.
Bus 18 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MCA) bus, an enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.
Computer device 12 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by computer device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM) 30 and/or cache memory 32. The computer device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 6, and commonly referred to as a "hard drive"). Although not shown in FIG. 6, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a Compact disk Read-Only Memory (CD-ROM), digital Video disk (DVD-ROM), or other optical media) may be provided. In these cases, each drive may be connected to bus 18 by one or more data media interfaces. System memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
A program/utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. Program modules 42 generally carry out the functions and/or methodologies of the described embodiments of the invention.
Computer device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), with one or more devices that enable a user to interact with computer device 12, and/or with any devices (e.g., network card, modem, etc.) that enable computer device 12 to communicate with one or more other computing devices. Such communication may be through an Input/Output (I/O) interface 22. Also, computer device 12 may communicate with one or more networks (e.g., local Area Network (LAN), wide Area Network (WAN)) via Network adapter 20. As shown, network adapter 20 communicates with other modules of computer device 12 via bus 18. It should be understood that although not shown in FIG. 6, other hardware and/or software modules may be used in conjunction with computer device 12, including without limitation, microcode, device drivers, redundant processing units, external disk drive Arrays, (Redundant Arrays of Inesponsive Disks, RAID) systems, tape drives, data backup storage systems, and the like.
The processing unit 16 executes various functional applications and data processing by executing programs stored in the system memory 28, for example, implementing an application data collection method provided by any embodiment of the present invention.
EXAMPLE seven
The seventh embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the application data acquisition method provided in all the embodiments of the present invention:
that is, the program when executed by the processor implements: loading a probe module when detecting that an initial process belonging to a target application is started; adding callback information in the target function of the initial process through the probe module, and updating the target function; calling the updated target function through the target application, and sending the monitoring data of the target application to the probe module based on the callback information; and reporting the monitoring data to a server through the probe module.
Computer storage media for embodiments of the invention may employ any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a RAM, a Read-Only Memory (ROM), an Erasable Programmable Read-Only Memory (EPROM), a flash Memory, an optical fiber, a portable CD-ROM, an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, radio Frequency (RF), etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a LAN or a WAN, or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. Those skilled in the art will appreciate that the present invention is not limited to the particular embodiments described herein, and that various obvious changes, rearrangements and substitutions will now be apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in some detail by the above embodiments, the invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the invention, and the scope of the invention is determined by the scope of the appended claims.

Claims (10)

1. An application data acquisition method, comprising:
loading a probe module when detecting that an initial process belonging to a target application is started;
adding callback information in the target function of the initial process through the probe module, and updating the target function;
calling the updated target function through the target application, and sending the monitoring data of the target application to the probe module based on the callback information;
and reporting the monitoring data to a server through the probe module.
2. The method of claim 1, wherein adding callback information in the target function of the initial process by the probe module comprises:
acquiring alternative functions and function information associated with the initial process through the probe module;
determining a target function from each alternative function through the probe module, and determining positioning information of the target function from the function information, wherein the target function corresponds to the monitoring data;
determining an adding position according to the positioning information of the target function through the probe module, wherein the adding position corresponds to the monitoring data;
adding, by the probe module, the callback information in the add location.
3. The method of claim 1, wherein the detecting of the initial process launch belonging to the target application comprises:
under the condition that the starting of the alternative process is detected, an executable file of the alternative process is obtained;
analyzing the executable file to obtain analysis data;
and determining that the initial process belonging to the target application is started under the condition that the section head table of the analysis data comprises the specified information.
4. The method of claim 1, wherein detecting an initial process launch belonging to a target application comprises:
loading a process loader module under the condition of detecting the starting of the alternative process;
loading a preload module by the process loader module;
detecting, by the pre-loading module, an initial process start belonging to a target application.
5. The method of claim 1, further comprising:
acquiring an equipment program identifier and reporting the equipment program identifier to a server;
receiving probe identification fed back by the server aiming at the equipment program identification;
after loading the probe module, further comprising:
receiving a probe identification request sent by the probe module;
in the event that the probe identity request includes the device identity, feeding back the probe identity to the probe module;
reporting the monitoring data to a server through the probe module includes:
and reporting the monitoring data and the probe identification to a server through the probe module.
6. The method of claim 1, wherein the objective function comprises a function that processes http requests, wherein the callback information comprises pre-callback information and post-callback information, and wherein the monitoring data comprises response times.
7. The method of claim 1, wherein the target application is an application written based on the GO language.
8. An application data acquisition device, comprising:
the probe loading module is used for loading the probe module when detecting that the initial process belonging to the target application is started;
the function updating module is used for adding callback information in the target function of the initial process through the probe module and updating the target function;
the data sending module is used for calling the updated target function through the target application and sending the monitoring data of the target application to the probe module based on the callback information;
and the data reporting module is used for reporting the monitoring data to a server through the probe module.
9. 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 processor implements the application data acquisition method as claimed in any one of claims 1 to 7 when executing the program.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method for application data acquisition according to any one of claims 1 to 7.
CN202210866756.9A 2022-07-22 2022-07-22 Application data acquisition method and device, computer equipment and storage medium Pending CN115237713A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210866756.9A CN115237713A (en) 2022-07-22 2022-07-22 Application data acquisition method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210866756.9A CN115237713A (en) 2022-07-22 2022-07-22 Application data acquisition method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115237713A true CN115237713A (en) 2022-10-25

Family

ID=83674948

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210866756.9A Pending CN115237713A (en) 2022-07-22 2022-07-22 Application data acquisition method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115237713A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117201292A (en) * 2023-10-30 2023-12-08 智业软件股份有限公司 Method capable of accurately positioning request call exception among micro services
CN117290840A (en) * 2023-09-07 2023-12-26 北京海泰方圆科技股份有限公司 Browser auditing method, device, computer equipment and storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117290840A (en) * 2023-09-07 2023-12-26 北京海泰方圆科技股份有限公司 Browser auditing method, device, computer equipment and storage medium
CN117290840B (en) * 2023-09-07 2024-03-15 北京海泰方圆科技股份有限公司 Browser auditing method, device, computer equipment and storage medium
CN117201292A (en) * 2023-10-30 2023-12-08 智业软件股份有限公司 Method capable of accurately positioning request call exception among micro services
CN117201292B (en) * 2023-10-30 2024-02-23 智业软件股份有限公司 Method capable of accurately positioning request call exception among micro services

Similar Documents

Publication Publication Date Title
CN106572173B (en) Configuration information updating method, device and system
CN115237713A (en) Application data acquisition method and device, computer equipment and storage medium
CN110515806B (en) Probe configuration method, device, computer equipment and storage medium
CN111083225A (en) Data processing method and device in Internet of things platform and Internet of things platform
CN109101228B (en) Application program execution method and device
US7913233B2 (en) Performance analyzer
CN110674025A (en) Interactive behavior monitoring method and device and computer equipment
US11126499B2 (en) System and methods for diagnosing and repairing a smart mobile device by disabling components
WO2017186066A1 (en) Software management method and apparatus
CN111061489B (en) Multi-platform compiling detection method, device, equipment and medium
CN112615758B (en) Application identification method, device, equipment and storage medium
US11294746B2 (en) Extracting moving image data from an error log included in an operational log of a terminal
CN110851324A (en) Log-based routing inspection processing method and device, electronic equipment and storage medium
CN110795353B (en) Quick application debugging method, device, equipment and storage medium
AU2012285083A1 (en) Embedded apparatus, program generation apparatus, and program
CN114443905A (en) Interface document updating method and device, electronic equipment and readable storage medium
US10432490B2 (en) Monitoring single content page application transitions
CN114553663B (en) Abnormality detection method, abnormality detection device, abnormality detection equipment and storage medium
CN106874004B (en) Method for enabling low-version software to be compatible with high-version file, client and server
CN112162954B (en) User operation log generation and path positioning method, device, equipment and medium
CN112818204B (en) Service processing method, device, equipment and storage medium
CN114385457A (en) Application program data acquisition method, device, equipment and storage medium
CN112416698B (en) Expansion method and device of monitoring system, storage medium and electronic equipment
CN109634636B (en) Application processing method, device, equipment and medium
CN114816914A (en) Data processing method, equipment and medium based on Kubernetes

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