Program operation monitoring method, device and equipment
By introducing independent monitoring code and hook function mechanisms into the mini program, the entire life cycle operation status information of the business code is obtained and reported, the gap in the front-end running status monitoring of the mini program is solved, and monitoring efficiency and user experience are improved.
Patent Information
- Application Number
- CN202110230794.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-02
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2041-03-02
AI Technical Summary
The existing technology is difficult to effectively monitor the front-end operation status of mini programs, resulting in a decline in user experience and increasing difficulty in discovering problems, and lacks an operation monitoring mechanism for the entire life cycle.
Introduce independent monitoring code, which is independent of the business code. It obtains the entire life cycle operation status information of the business code through the hook function, and caches it in the state of disconnection or weak network. When connected to the network, it sends monitoring data to the background server to generate backend report positioning. error message.
It realizes full life cycle monitoring of the front-end operation of the mini program, promptly feedback on problems, improves monitoring efficiency and user experience, facilitates later business code modification, and fills the gap in front-end operation error monitoring.
Smart Images

Figure CN112860522B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device and equipment for monitoring the operation of a program. Background Art
[0002] Against the backdrop of the rapid development of computer technology, mini programs have gradually emerged as an important infrastructure for the industrial Internet. As the mini program ecosystem gradually improves, the application scenarios of mini programs are also expanding. In-car tools, face-scanning payment, etc. have become new service scenarios for mini programs. Therefore, in order to optimize the user experience of mini programs and prevent user loss, it is particularly important to monitor the operation of mini programs. Summary of the invention
[0003] The present application provides a program operation monitoring method, device and equipment, which can solve the problems in the related technology.
[0004] In one aspect, a method for monitoring the operation of a program is provided, the method comprising:
[0005] Loading a program package, the program package including a business code and a monitoring code, the business code and the monitoring code are independent of each other, and the monitoring code is used to monitor the front-end operation of the business code;
[0006] Acquire the operation status information of the business code during operation through the monitoring code, wherein the operation status information includes the operation status information of the entire life cycle of the business code during operation;
[0007] The operation status information is sent to the backend server as monitoring data.
[0008] In a possible implementation, obtaining the running status information of the business code during its running by using the monitoring code includes:
[0009] The business code is rewritten by the monitoring code to obtain the business code with the hook function injected, and the running status information of the business code during running is obtained by the hook function, and the hook function is injected into all functions of the business code.
[0010] In a possible implementation manner, sending the operating status information as monitoring data to a background server includes:
[0011] In response to the operating environment of the service code being in a disconnected or weak network state, caching the operating state information;
[0012] In response to the operating environment of the business code being in a networked state, the cached operating status information is sent to a background server as monitoring data.
[0013] In a possible implementation manner, after sending the operating status information as monitoring data to a background server, the method further includes:
[0014] The monitoring data is used to generate a background report through the background server, and the background report is used to locate operation error information.
[0015] In a possible implementation, the operation status information includes at least one of operation error information, operation environment information, and network request return exception information.
[0016] In another aspect, a program operation monitoring device is provided, the device comprising:
[0017] A loading module, used to load a program package, wherein the program package includes a business code and a monitoring code, wherein the business code and the monitoring code are independent of each other, and the monitoring code is used to monitor the front-end operation of the business code;
[0018] An acquisition module, used to acquire the operation status information of the business code during operation through the monitoring code, wherein the operation status information includes the operation status information of the entire life cycle during the operation of the business code;
[0019] The sending module is used to send the operating status information as monitoring data to the background server.
[0020] In one possible implementation, the acquisition module is used to rewrite the business code through the monitoring code to obtain the business code with a hook function, and obtain the running status information of the business code during its running process through the hook function. The hook function is injected into all functions of the business code.
[0021] In one possible implementation, the sending module is used to cache the operating status information in response to the operating environment of the business code being in a disconnected or weak network state; in response to the operating environment of the business code being in a networked state, send the cached operating status information as monitoring data to the background server.
[0022] In a possible implementation, the device further includes:
[0023] A generating module is used to generate a background report from the monitoring data through the background server, and the background report is used to locate operation error information.
[0024] In a possible implementation, the operation status information includes at least one of operation error information, operation environment information, and network request return exception information.
[0025] On the other hand, a computer device is also provided, comprising a processor and a memory, wherein the memory stores at least one program code, and the at least one program code is loaded and executed by the processor so that the computer device implements the program operation monitoring method described in any one of the above items.
[0026] On the other hand, a computer-readable storage medium is provided, in which at least one program code is stored. The at least one program code is loaded and executed by a processor to implement the operation monitoring method of any of the programs described above.
[0027] On the other hand, a computer program product or a computer program is also provided, the computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes any of the above-mentioned program operation monitoring methods.
[0028] The technical solution provided by the embodiments of the present application brings at least the following beneficial effects:
[0029] The technical solution provided by the embodiment of the present application monitors the front-end operation of the business code throughout its life cycle by introducing independent monitoring code, and reports the operation status information to the back-end server as monitoring data. The monitoring code is decoupled from the business code, which facilitates the modification of the business code in the later stage, fills the gap in the monitoring of front-end operation errors, and can timely feedback the operation monitoring information of the program throughout its life cycle to the developer, so that problems can be discovered and solved in a timely manner, thereby improving the efficiency of the program's operation monitoring and improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0031] Figure 1 It is a schematic diagram of an implementation environment of a program operation monitoring method provided in an embodiment of the present application;
[0032] Figure 2 It is a flowchart of a program operation monitoring method provided in an embodiment of the present application;
[0033] Figure 3 is a schematic diagram of a program operation monitoring device provided in an embodiment of the present application;
[0034] Figure 4 is a schematic diagram of a program operation monitoring device provided in an embodiment of the present application;
[0035] Figure 5 It is a structural diagram of a program operation monitoring device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0036] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0037] This application embodiment provides a method for monitoring the operation of a program. Please refer to Figure 1 , which shows a schematic diagram of an implementation environment of a program operation monitoring method provided in an embodiment of the present application. The implementation environment includes: a terminal 11 and a server 12.
[0038] Among them, a program is running in the terminal 11, and the program can be a small program, and the small program is a monitored small program. A small program means an application with a small size and relatively single function, which has the characteristics of no need to pay attention to, no need to download, and ready to use. The server 12 is associated with the small program and provides services for the small program. When the terminal 11 is running the small program, the server 12 adds a monitoring code to the small program package of the terminal 11. The monitoring code is used to obtain the operating status information of the business code in the small program package throughout the life cycle. The terminal 11 sends the obtained operating status information to the server 12, thereby realizing the monitoring of the small program on the terminal 11.
[0039] The embodiments of the present application are applied to the scenario of monitoring the target program. For example, after a technician develops a program, he can install the developed program on a terminal. The terminal uses the method provided by the embodiments of the present application to monitor the front-end operation of the program and report the monitored operation status information to the back-end server. The developer can accurately locate the problem and solve it in time according to the reported data. The monitored program can be a mini program, which can be a mall-type mini program, a display-type mini program, an appointment-type mini program, etc.
[0040] In one possible implementation, the terminal 11 can be any electronic product that can interact with the user through one or more methods such as a keyboard, a touchpad, a touch screen, a remote control, voice interaction or a handwriting device, such as a PC (Personal Computer), a mobile phone, a smart phone, a PDA (Personal Digital Assistant), a wearable device, a handheld computer PPC (Pocket PC), a tablet computer, a smart car machine, a smart TV, a smart speaker, etc. The server 12 can be an independent physical server, or a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The terminal and the server can be directly or indirectly connected through wired or wireless communication, and this application does not limit this.
[0041] Those skilled in the art should understand that the above-mentioned terminal 11 and server 12 are only examples, and other existing or future terminals or servers that are applicable to the present application should also be included in the protection scope of the present application and are included here by reference.
[0042] Based on the above Figure 1 The implementation environment shown in the figure, the embodiment of the present application provides a program operation monitoring method, which can be applied to Figure 1 The program installed in the terminal 11 shown in FIG. Figure 2 As shown, the method provided in the embodiment of the present application includes the following steps 201 to 203.
[0043] Step 201, loading a program package, the program package includes a business code and a monitoring code, the business code and the monitoring code are independent of each other, and the monitoring code is used to monitor the front-end operation of the business code.
[0044] In one possible implementation, a user starts an application by clicking a button, and a terminal device running the application loads a program package to run the application, wherein the program package includes a business code and a monitoring code, and the business code and the monitoring code are independent of each other. The business code includes code data required to run the application, and the monitoring code includes code data for monitoring the running status of the business code, that is, the monitoring code is used to monitor the front-end running status of the business code.
[0045] In the embodiment of the present application, the program package is a small program package as an example for explanation. The small program can be run in an instant messaging application installed in the terminal. There is no need to install the actual product application. Only by opening the corresponding small program in an instant messaging application, the relevant operations for the product application can be completed. For example, execute functions such as purchase, play or subscription. Among them, the code data for loading, compiling and running that comes with the small program is the program package of the small program, and the code data is called the business code.
[0046] In a possible implementation, in order to monitor the operating status of the mini-program production environment, a monitoring code is introduced into the mini-program package, and the monitoring code is independent of the business code of the mini-program. Optionally, the monitoring code is edited by a specific programming language, and the monitoring code can be a JS (Java Script) script file, and the monitoring code is used to obtain the operating status information of the mini-program's business code during operation. The embodiment of the present application does not limit the specific content of the monitoring code, and it is sufficient to be able to monitor the operating status of the business code.
[0047] In an embodiment of the present application, the business code and the monitoring code are independent of each other, which realizes the decoupling of the monitoring code and the original business code, so that developers can easily modify the original business code, and the code logic is not affected by the monitoring code. It is only necessary to introduce a script file in the developed business code to realize the monitoring of the front-end running status of the business code.
[0048] Step 202, obtaining the running status information of the business code during its running process through the monitoring code, wherein the running status information includes the running status information of the whole life cycle during the running process of the business code.
[0049] In one possible implementation, the operating status information of the business code during its execution is obtained through the monitoring code, including: rewriting the business code through the monitoring code to obtain the business code with the hook function injected, and obtaining the operating status information of the business code during its execution through the hook function, wherein the hook function is injected into all functions of the business code.
[0050] In the embodiment of the present application, the hook mechanism is a callback mechanism. The ordinary callback is static and the callback interface needs to be written in advance. The hook mechanism can use reflection in the programming language Java and adopt replacement means for the entry point to change the code at runtime. Therefore, the business code can be rewritten by hooking without changing the original business code, so that the monitoring code can run in the process of the hooked business code, realizing the operation monitoring of the whole life cycle of the business code.
[0051] In the embodiment of the present application, the operation monitoring of the applet is taken as an example for explanation. In the development and production of the applet, the life cycle function of the applet package mainly includes three parts of native code: application (App) function, page (Page) function and component (Component) function. Among them, the App function is the framework of the applet, which is used to register a small program, called when the applet is started, and exists in the entire life cycle of the applet. The Page function is a page in the applet, which is used to implement the interface operation function of the applet. The Component function is a customized component in the applet, which is used to flexibly configure the applet style to enhance the special functions. For convenience, the embodiment of the present application refers to the three main parts required for the development of the applet as APC, that is, the collection of App, Page and Component is collectively referred to. In addition, the applet often needs to initiate a web page request during operation, which is reflected as a request (request) function in the applet development environment. Request is an encapsulated request function.
[0052] Exemplarily, during the operation monitoring of the mini program, after loading the mini program package including the business code and the monitoring code, the APC and the request are rewritten through the monitoring code, the protection of the request method is unlocked, and the hook function is injected into the APC and the request to obtain the APC and the request annotated with the hook. The hook can obtain the operation status information of the APC and the request during the operation process according to the configuration information.
[0053] In a possible implementation, the operation status information of the business code is obtained through hook, including: automatically executing the try catch method during the operation of the APC in the business code, and obtaining the corresponding operation status information when the operation error is caught; when the request remote request in the business code is returned, the corresponding operation status information is obtained when the request exception code is returned.
[0054] In the embodiment of the present application, the try catch method can obtain error information during operation. The principle is: try {code that may have errors is written here}, catch {processing after errors}. If the code in try does not have errors, the program will run the content in try normally and will not execute the content in catch. If the code in try has errors, the program will immediately jump into catch to execute the code. The code in catch can be obtained through background configuration information. For example, the content of the running status information to be obtained, the frequency and rules for sending the running status information, etc. can be configured.
[0055] Optionally, the operation status information includes at least one of operation error information, operation environment information, and network request return exception information. The operation error information includes but is not limited to the error type, error location, and error number, the operation environment information includes but is not limited to the operation time, operation path, network information, device information, version information, and user information, and the network request return exception information includes but is not limited to the request status, request duration, and request address at the time of the exception. The error type includes but is not limited to white screen, disconnection, freeze, page abnormality, or frozen screen, etc.
[0056] For example, a user clicks Buy Now in the shopping applet on device A, and the page freezes. The current running status information is obtained, including the running error type is page freeze, the freeze time is 50 seconds, the error location is the Buy Now page, the click time is 16:00, the network status at the time of click is WiFi (Wireless Fidelity) network, and the device information is device A.
[0057] In an embodiment of the present application, the front-end running status of the mini-program can be obtained through an independent monitoring code, and immediate feedback can be provided for front-end problems such as slow jumps and page freezes that inevitably occur during use, thereby reducing the user bounce rate and preventing user loss. In addition, due to the complexity of the online environment, some front-end problems will only occur in specific network environments or devices. For such problems, the collection of abnormal information of the front-end operation is particularly important. The method provided in the embodiment of the present application can not only collect erroneous stack information, but also collect user operation processes and device information, etc., in order to reproduce errors and improve the experience requirements of the overall performance of the mini-program.
[0058] Step 203: Send the operation status information as monitoring data to the background server.
[0059] In a possible implementation, sending the running status information as monitoring data to the backend server includes: caching the running status information in response to the running environment of the business code being disconnected or in a weak network state; and sending the cached running status information as monitoring data to the backend server in response to the running environment of the business code being in a connected state. The weak network state is generally manifested as a data network with a rate lower than 2G, or a WiFi network with a weak signal.
[0060] In the embodiments of the present application, due to the gradual improvement of the mini program ecosystem, mini programs are gradually applied to new service scenarios such as vehicle-mounted tools and face-swiping payment. For the use of vehicle-mounted tools, since the network is often disconnected or weak during the driving of the vehicle, the running status information at this time will be cached locally in the vehicle terminal, and when the network connection is good, the cached running status information will be sent to the background server as monitoring data. This will not cause the loss of monitoring data, making the acquired monitoring data more comprehensive.
[0061] In a possible implementation, after the operation status information is sent as monitoring data to the background server, the method further includes: generating a background report from the monitoring data through the background server, wherein the background report is used to locate the operation error information. Optionally, the background report is generated by statistically analyzing the monitoring data according to factors such as the error category, the impact of the error, and the number of errors, and generating the background report by processing the monitoring data according to pre-set statistical rules. This application does not limit the method of generating the background report, and it is sufficient to locate the operation error information.
[0062] In one possible implementation, after the background server receives the monitoring data sent by the terminal, it compiles and organizes the monitoring data to generate a background report. The background report can clearly display the error-related information during the front-end running of the program, and can quickly and accurately locate the error information, so that the developer can immediately determine the cause of the problem through the background report, immediately solve the problem, and realize the monitoring of the front-end operation of the program.
[0063] The method provided in the embodiment of the present application monitors the front-end operation of the business code throughout its life cycle by introducing an independent monitoring code, and reports the operation status information to the back-end server as monitoring data. The monitoring code is decoupled from the business code, which facilitates the modification of the business code in the later stage, fills the gap in the monitoring of front-end operation errors, and can promptly feedback the operation monitoring information of the program throughout its life cycle to the developer, so that problems can be discovered and solved in a timely manner, the efficiency of the program's operation monitoring can be improved, and the user experience can be improved.
[0064] The embodiment of the present application provides a program operation monitoring device, which can be used to execute the program operation monitoring method. Figure 3 , the device comprises:
[0065] A loading module 31 is used to load a program package, the program package includes a business code and a monitoring code, the business code and the monitoring code are independent of each other, and the monitoring code is used to monitor the front-end operation of the business code;
[0066] An acquisition module 32 is used to acquire the operation status information of the business code during operation through the monitoring code, and the operation status information includes the operation status information of the entire life cycle during the operation of the business code;
[0067] The sending module 33 is used to send the operation status information as monitoring data to the background server.
[0068] In one possible implementation, the acquisition module 32 is used to rewrite the business code through the monitoring code to obtain the business code with the hook function, and obtain the running status information of the business code during the running process through the hook function. The hook function is injected into all functions of the business code.
[0069] In one possible implementation, the sending module 33 is used to cache the operating status information in response to the operating environment of the business code being in a disconnected or weak network state; in response to the operating environment of the business code being in a networked state, send the cached operating status information as monitoring data to the background server.
[0070] In one possible implementation, see Figure 4 , the device further comprises:
[0071] The generating module 34 is used to generate a background report from the monitoring data through a background server, and the background report is used to locate the operation error information.
[0072] In a possible implementation, the operation status information includes at least one of operation error information, operation environment information, and network request return exception information.
[0073] The device provided in the embodiment of the present application monitors the front-end operation of the business code throughout its life cycle by introducing independent monitoring code, and reports the operation status information to the background server as monitoring data. The monitoring code is decoupled from the business code, which facilitates the modification of the business code in the later stage, fills the gap in the monitoring of front-end operation errors, and can promptly feedback the operation monitoring information of the program throughout its life cycle to the developer, so that problems can be discovered and solved in a timely manner, the efficiency of the program operation monitoring can be improved, and the user experience can be improved.
[0074] It should be understood that the device provided in the above embodiment only uses the division of the above functional modules as an example to implement its functions. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and their specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0075] Please refer to Figure 5, which shows a schematic diagram of the structure of a program operation monitoring device provided by an embodiment of the present application. The device may be a terminal, for example, a smart phone, a tablet computer, a vehicle-mounted terminal, a laptop computer or a desktop computer. The terminal may also be called a user device, a portable terminal, a laptop terminal, a desktop terminal or other names.
[0076] Typically, the terminal includes: a processor 501 and a memory 502 .
[0077] The processor 501 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 501 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 501 may also include a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 501 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 501 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0078] The memory 502 may include one or more computer-readable storage media, which may be non-transitory. The memory 502 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 502 is used to store at least one instruction, which is used to be executed by the processor 501 to implement the program operation monitoring method provided in the method embodiment of the present application.
[0079] In some embodiments, the terminal may further optionally include: a peripheral device interface 503 and at least one peripheral device. The processor 501, the memory 502 and the peripheral device interface 503 may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral device interface 503 via a bus, a signal line or a circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 504, a display screen 505, a camera assembly 506, an audio circuit 507, a positioning assembly 508 and a power supply 509.
[0080] The peripheral device interface 503 may be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 501 and the memory 502. In some embodiments, the processor 501, the memory 502, and the peripheral device interface 503 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 501, the memory 502, and the peripheral device interface 503 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.
[0081] The radio frequency circuit 504 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 504 communicates with communication networks and other communication devices via electromagnetic signals. The radio frequency circuit 504 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. Optionally, the radio frequency circuit 504 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, and the like. The radio frequency circuit 504 can communicate with other terminals via at least one wireless communication protocol. The wireless communication protocol includes, but is not limited to, a metropolitan area network, various generations of mobile communication networks (2G, 3G, 4G and 5G), a wireless local area network and / or a WiFi network. In some embodiments, the radio frequency circuit 504 may also include circuits related to NFC (Near Field Communication), which is not limited in this application.
[0082] The display screen 505 is used to display the UI (User Interface). The UI may include graphics, text, icons, videos and any combination thereof. When the display screen 505 is a touch display screen, the display screen 505 also has the ability to collect touch signals on the surface or above the surface of the display screen 505. The touch signal can be input to the processor 501 as a control signal for processing. At this time, the display screen 505 can also be used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, the display screen 505 can be one, set on the front panel of the terminal; in other embodiments, the display screen 505 can be at least two, respectively set on different surfaces of the terminal or in a folding design; in some other embodiments, the display screen 505 can be a flexible display screen, set on a curved surface or a folding surface of the terminal. Even, the display screen 505 can also be set to a non-rectangular irregular shape, that is, a special-shaped screen. The display screen 505 can be made of materials such as LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode) and the like.
[0083] The camera assembly 506 is used to capture images or videos. Optionally, the camera assembly 506 includes a front camera and a rear camera. Typically, the front camera is arranged on the front panel of the terminal, and the rear camera is arranged on the back of the terminal. In some embodiments, there are at least two rear cameras, which are any one of a main camera, a depth of field camera, a wide-angle camera, and a telephoto camera, so as to realize the fusion of the main camera and the depth of field camera to realize the background blur function, the fusion of the main camera and the wide-angle camera to realize the panoramic shooting and VR (Virtual Reality) shooting function or other fusion shooting functions. In some embodiments, the camera assembly 506 may also include a flash. The flash can be a monochrome temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cold light flash, which can be used for light compensation at different color temperatures.
[0084] The audio circuit 507 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals and input them into the processor 501 for processing, or input them into the radio frequency circuit 504 to achieve voice communication. For the purpose of stereo acquisition or noise reduction, there may be multiple microphones, which are respectively arranged at different parts of the terminal. The microphone may also be an array microphone or an omnidirectional acquisition microphone. The speaker is used to convert the electrical signal from the processor 501 or the radio frequency circuit 504 into sound waves. The speaker may be a traditional film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert the electrical signal into sound waves audible to humans, but also convert the electrical signal into sound waves inaudible to humans for purposes such as ranging. In some embodiments, the audio circuit 507 may also include a headphone jack.
[0085] The positioning component 508 is used to locate the current geographical location of the terminal to implement navigation or LBS (Location Based Service). The positioning component 508 can be a positioning component based on the US GPS (Global Positioning System), China's Beidou system, Russia's Grenas system or the European Union's Galileo system.
[0086] The power supply 509 is used to power various components in the terminal. The power supply 509 can be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power supply 509 includes a rechargeable battery, the rechargeable battery can support wired charging or wireless charging. The rechargeable battery can also be used to support fast charging technology.
[0087] In some embodiments, the terminal further includes one or more sensors 510 , including but not limited to: an acceleration sensor 511 , a gyroscope sensor 512 , a pressure sensor 513 , a fingerprint sensor 514 , an optical sensor 515 , and a proximity sensor 516 .
[0088] The acceleration sensor 511 can detect the magnitude of acceleration on the three coordinate axes of the coordinate system established by the terminal. For example, the acceleration sensor 511 can be used to detect the components of gravity acceleration on the three coordinate axes. The processor 501 can control the display screen 505 to display the user interface in a horizontal view or a vertical view according to the gravity acceleration signal collected by the acceleration sensor 511. The acceleration sensor 511 can also be used for collecting game or user motion data.
[0089] The gyro sensor 512 can detect the body direction and rotation angle of the terminal, and the gyro sensor 512 can cooperate with the acceleration sensor 511 to collect the user's 3D actions on the terminal. The processor 501 can implement the following functions based on the data collected by the gyro sensor 512: motion sensing (such as changing the UI according to the user's tilt operation), image stabilization during shooting, game control, and inertial navigation.
[0090] The pressure sensor 513 can be set in the side frame of the terminal and / or the lower layer of the display screen 505. When the pressure sensor 513 is set in the side frame of the terminal, the user's holding signal of the terminal can be detected, and the processor 501 performs left and right hand recognition or shortcut operation according to the holding signal collected by the pressure sensor 513. When the pressure sensor 513 is set in the lower layer of the display screen 505, the processor 501 controls the operability controls on the UI interface according to the user's pressure operation on the display screen 505. The operability controls include at least one of a button control, a scroll bar control, an icon control, and a menu control.
[0091] The fingerprint sensor 514 is used to collect the user's fingerprint, and the processor 501 identifies the user's identity based on the fingerprint collected by the fingerprint sensor 514, or the fingerprint sensor 514 identifies the user's identity based on the collected fingerprint. When the user's identity is identified as a trusted identity, the processor 501 authorizes the user to perform relevant sensitive operations, which include unlocking the screen, viewing encrypted information, downloading software, paying, and changing settings. The fingerprint sensor 514 can be set on the front, back, or side of the terminal. When a physical button or manufacturer logo is set on the terminal, the fingerprint sensor 514 can be integrated with the physical button or manufacturer logo.
[0092] The optical sensor 515 is used to collect the ambient light intensity. In one embodiment, the processor 501 can control the display brightness of the display screen 505 according to the ambient light intensity collected by the optical sensor 515. Specifically, when the ambient light intensity is high, the display brightness of the display screen 505 is increased; when the ambient light intensity is low, the display brightness of the display screen 505 is reduced. In another embodiment, the processor 501 can also dynamically adjust the shooting parameters of the camera component 506 according to the ambient light intensity collected by the optical sensor 515.
[0093] The proximity sensor 516, also known as a distance sensor, is usually arranged on the front panel of the terminal. The proximity sensor 516 is used to collect the distance between the user and the front of the terminal. In one embodiment, when the proximity sensor 516 detects that the distance between the user and the front of the terminal is gradually decreasing, the processor 501 controls the display screen 505 to switch from the screen-on state to the screen-off state; when the proximity sensor 516 detects that the distance between the user and the front of the terminal is gradually increasing, the processor 501 controls the display screen 505 to switch from the screen-off state to the screen-on state.
[0094] Those skilled in the art will understand that Figure 5 The structure shown in the figure does not constitute a limitation on the program operation monitoring device, and may include more or less components than those shown in the figure, or combine certain components, or adopt a different component arrangement.
[0095] In an exemplary embodiment, a computer device is also provided, the computer device comprising a processor and a memory, wherein at least one program code is stored in the memory. The at least one program code is loaded and executed by one or more processors to implement any of the above-mentioned program operation monitoring methods.
[0096] In an exemplary embodiment, a computer-readable storage medium is also provided, in which at least one program code is stored. The at least one program code is loaded and executed by a processor of a computer device to implement any of the above-mentioned program operation monitoring methods.
[0097] Optionally, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, etc.
[0098] In an exemplary embodiment, a computer program product or a computer program is also provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the operation monitoring method of any of the above programs.
[0099] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for monitoring program operation, characterized in that: The method comprises: Load the program package of the mini program, the program package includes business code and monitoring code, the business code and the monitoring code are independent of each other, the monitoring code is used to monitor the front-end operation of the business code, the life cycle function of the business code of the mini program includes the application App function, the page Page function and the component Component function, and the business code of the mini program initiates a web page request based on the request function during operation; The App function, the Page function, the Component function and the request function are rewritten by the monitoring code, and the hook function is injected into the App function, the Page function, the Component function and the request function to obtain the App function, the Page function, the Component function and the request function injected with the hook function, and the hook function is injected into all functions of the business code; The try catch method is automatically executed during the operation of the App function, the page Page function and the component Component function with the hook function, and the corresponding operation status information is obtained when the operation error is caught. In the process of the request function with the hook function making a remote request, the corresponding operation status information is obtained when the request exception code is returned, and the operation status information includes the operation status information of the whole life cycle during the operation of the business code; The operation status information is sent to the backend server as monitoring data.
2. The method according to claim 1, characterized in that The step of sending the operating status information as monitoring data to a background server includes: In response to the operating environment of the service code being in a disconnected or weak network state, caching the operating state information; In response to the operating environment of the business code being in a networked state, the cached operating status information is sent to a background server as monitoring data.
3. The method according to claim 1, characterized in that After sending the operating status information as monitoring data to the backend server, the method further includes: The monitoring data is used to generate a background report through the background server, and the background report is used to locate operation error information.
4. The method according to any one of claims 1 to 3, characterized in that: The operation status information includes at least one of operation error information, operation environment information and network request return exception information.
5. A program operation monitoring device, characterized in that: The device comprises: A loading module, used to load the program package of the mini program, the program package includes business code and monitoring code, the business code and the monitoring code are independent of each other, the monitoring code is used to monitor the front-end operation of the business code, the life cycle function of the business code of the mini program includes the application App function, the page Page function and the component Component function, and the business code of the mini program initiates a web page request based on the request function during operation; an acquisition module, used to rewrite the App function, the page function, the component function and the request function through the monitoring code, inject the hook function into the App function, the page function, the component function and the request function, and obtain the App function, the page function, the component function and the request function annotated with the hook function, wherein the hook function is injected into all functions of the business code; automatically execute the try catch method during the operation of the App function, the page function and the component function annotated with the hook function, and obtain the corresponding operation status information when the operation error is caught; in the process of the request function annotated with the hook function making a remote request, obtain the corresponding operation status information when the request exception code is returned, and the operation status information includes the operation status information of the whole life cycle during the operation of the business code; The sending module is used to send the operating status information as monitoring data to the background server.
6. The device according to claim 5, characterized in that The sending module is used to cache the operating status information in response to the operating environment of the business code being in a disconnected or weak network state; in response to the operating environment of the business code being in a networked state, send the cached operating status information as monitoring data to the background server.
7. The device according to claim 5 or 6, characterized in that The device also includes: A generating module is used to generate a background report from the monitoring data through the background server, and the background report is used to locate operation error information.
8. A computer device, characterized in that: The computer device includes a processor and a memory, wherein at least one program code is stored in the memory, and the at least one program code is loaded and executed by the processor so that the computer device implements the program operation monitoring method as described in any one of claims 1 to 4.
