CN109976973B - Online exception monitoring method for small program and electronic equipment - Google Patents
Online exception monitoring method for small program and electronic equipment Download PDFInfo
- Publication number
- CN109976973B CN109976973B CN201910121928.8A CN201910121928A CN109976973B CN 109976973 B CN109976973 B CN 109976973B CN 201910121928 A CN201910121928 A CN 201910121928A CN 109976973 B CN109976973 B CN 109976973B
- Authority
- CN
- China
- Prior art keywords
- information
- applet
- information object
- function
- small program
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/0703—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
- G06F11/0766—Error or fault reporting or storing
- G06F11/0778—Dumping, i.e. gathering error/state information after a fault for later diagnosis
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/3003—Monitoring arrangements specially adapted to the computing system or computing system component being monitored
- G06F11/302—Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/3065—Monitoring arrangements determined by the means or processing involved in reporting the monitored data
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)
- Health & Medical Sciences (AREA)
- Biomedical Technology (AREA)
- Debugging And Monitoring (AREA)
- Stored Programmes (AREA)
Abstract
The invention discloses a small program online abnormity monitoring method and electronic equipment, wherein the method comprises the following steps: creating an information object for function execution in an applet project, recording operation executed by a function through the information object, and storing the information object into a global execution information array; acquiring current equipment information and storing the current equipment information in a global variable; when the function has errors, the global execution information array and the global variable are reported to the server for storage. The invention realizes the monitoring of the on-line small program, and when the small program is abnormal, the recorded operation and equipment information is acquired and reported to the server in time, so that the problems can be reproduced and processed in time according to the content stored by the server.
Description
Technical Field
The invention relates to the technical field of computers, in particular to a small program online abnormity monitoring method and electronic equipment.
Background
The small Program, namely the English name Mini Program, is an application which can be used without downloading and installing, realizes the dream of 'being reachable by a touch' of the application, and can be opened by scanning or searching by a user.
After a full open application, the subject type is the developer of an enterprise, government, media, other organization or individual, and can apply for registration applets.
However, the online small program may have a problem that it is difficult to test in advance due to a complex online environment or some specific network environments and devices, and in addition, the problem of user feedback is usually incomplete, and only what error condition occurs is provided, which is not friendly to program reproduction bug and difficult to locate problems, and only with user feedback, a developer and a tester can find problems, which results in that the problems cannot be found and handled in time.
Accordingly, the prior art is yet to be improved and developed.
Disclosure of Invention
In view of the above-mentioned deficiencies of the prior art, an object of the present invention is to provide a method for monitoring an online exception of an applet and an electronic device, which are used to solve the problems that the applet problem is difficult to reproduce and cannot be found and processed in time in the prior art.
The technical scheme of the invention is as follows:
an online exception monitoring method for an applet, comprising the steps of:
creating an information object for function execution in an applet project, recording operation executed by a function through the information object, and storing the information object into a global execution information array;
acquiring current equipment information and storing the current equipment information in a global variable;
when the function has errors, the global execution information array and the global variable are reported to the server for storage.
The online anomaly monitoring method for the small program, wherein the steps of creating an information object for function execution in a small program project, recording operation executed by the function through the information object, and storing the information object into a global execution information array comprise:
a method of traversing entry files in an applet project;
an information object for recording the operation executed by the function is created in the method of the entry file, and the information object is stored in a global execution information array.
The online anomaly monitoring method for the small program, wherein the steps of creating an information object for function execution in a small program project, recording operation executed by the function through the information object, and storing the information object into a global execution information array further comprise:
a method of traversing each page in the applet project;
and creating an information object for recording the operation executed by the function in the method of each page, and storing the information object into a global execution information array.
The online anomaly monitoring method for the small program comprises the steps that current equipment information comprises network information, equipment information and geographical position information.
The online anomaly monitoring method for the small program is characterized in that the content recorded by the information object comprises one or more of current time, a source page, a current function name, a page path and a page parameter.
The on-line exception monitoring method for the small program further comprises the following steps:
and pre-configuring the reported server address and the key value of the current applet item.
The online anomaly monitoring method for the small program comprises the step of recording the address of the server and the key value of the current small program item through a configuration file.
An electronic device, comprising:
a processor adapted to implement the instructions, an
A storage device adapted to store a plurality of instructions, the instructions adapted to be loaded and executed by a processor to:
creating an information object for function execution in an applet project, recording operation executed by a function through the information object, and storing the information object into a global execution information array;
acquiring current equipment information and storing the current equipment information in a global variable;
when the function has errors, the global execution information array and the global variable are reported to the server for storage.
A non-transitory computer-readable storage medium having stored thereon computer-executable instructions that, when executed by one or more processors, cause the one or more processors to perform the applet inline anomaly monitoring method.
A computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a processor, cause the processor to perform the method of on-die exception monitoring.
Has the advantages that: the invention realizes the monitoring of the on-line small program, and when the small program is abnormal, the recorded operation and equipment information is acquired and reported to the server in time, so that the problems can be reproduced and processed in time according to the content stored by the server.
Drawings
FIG. 1 is a flowchart illustrating a method for monitoring an online exception of an applet according to a preferred embodiment of the present invention.
Fig. 2 is a block diagram of an electronic device according to a preferred embodiment of the invention.
Detailed Description
The invention provides a small program online anomaly monitoring method and electronic equipment, and the invention is further described in detail below in order to make the purpose, technical scheme and effect of the invention clearer and clearer. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1, fig. 1 is a flowchart illustrating a preferred embodiment of an online exception monitoring method for an applet, which includes the following steps:
s1, creating an information object for function execution in the applet project, recording the operation of function execution through the information object, and storing the information object into a global execution information array;
s2, acquiring current equipment information and storing the current equipment information in a global variable;
and S3, reporting the global execution information array and the global variable to a server for storage when the function has an error.
The invention realizes the monitoring of the on-line small program, and when the small program is abnormal, the recorded operation and equipment information is acquired and reported to the server in time, so that the problems can be reproduced and processed in time according to the content stored by the server.
Specifically, in the step S1, it is necessary to create an information object for function execution in the applet item in advance, so that the operation performed by the function can be recorded by the information object.
Specifically, the step of creating an information object for function execution in the applet item, recording the operation executed by the function through the information object, and storing the information object into the global execution information array includes:
a method of traversing entry files in an applet project;
an information object for recording the operation executed by the function is created in the method of the entry file, and the information object is stored in a global execution information array.
In the present invention, the method of an entry file in an applet project refers to a method of app.js of the entry file, and specifically includes: onLannch, onShow, onHide, and oneror, among others.
When traversing these methods, firstly temporarily storing the steps in these methods.
An information object is created within the method of the entry file, the information object being used to record the operation performed by the function. The information objects may be stored in the global execution information array records. After the adding operation of the information object is completed, the steps of the methods can be called again.
The onLaunch method is a lifecycle function for listening to applet initialization, which is triggered when the applet initialization is complete (globally only once).
The onShow method is a lifecycle function for listening to the applet display, which is triggered when the applet starts or enters the foreground display from the background.
The onHide method is used for monitoring a lifecycle function hidden by an applet, and when the applet enters a background from a foreground, the onHide is triggered.
The oneerror method is an error monitoring function, and when a script error occurs in an applet or an api call fails, the oneerror is triggered and carries error information.
The applet mainly contains the following three entry files: js, app json, and app wxss.
The app.js file is an entry file of the whole applet and mainly completes network detection, user information acquisition and the like; when letting the method, which can also be injected in common, go through getApp () call in other pages (there is no need to introduce through require or import when the method in app.
Json file can perform global configuration on the applet, determine the path of the page file, the whole window expression, set the network timeout time, set the multiple tabs, and the like.
Wxss is a common style sheet for applets.
Js entry file the present invention creates the above method in the applet app.
When a user clicks a closing button at the upper left corner of the applet or clicks a Home key of the device to leave the WeChat, the applet is not directly destroyed but enters a background; when entering the WeChat again or opening the small program again, the small program enters the foreground again from the background.
The user opens the applet for the first time, triggering onLaunch (globally only once).
And after the initialization of the applet is completed, triggering an onShow method and monitoring the display of the applet.
And the applet enters a background from a foreground to trigger the onHide method.
And the applet enters the foreground from the background to display, and triggers the onShow method.
The small program background runs for a certain time or the system resource occupation is too high, and the small program background can be destroyed.
In step S2, the current device information is acquired and stored in the global variable.
Specifically, the current device information includes network information, device information, and geographical location information.
This information can be obtained as follows: when traversing the onLaunch method, besides the operation executed by the recording function, the method can call an API to acquire the current device information, and take a WeChat applet as an example, wx. These acquired information are all stored in the global variable deviceinfo.
The network information is of String type, and the values of the network information comprise wifi, 2G, 3G, 4G, none and unsmown, wherein wifi represents a wifi network, 2G represents a 2G network, 3G represents a 3G network, 4G represents a 4G network, none represents a no network, and unsmown represents an unusual network type.
Further, the step of creating an information object for function execution in the applet item, recording the operation executed by the function through the information object, and storing the information object in the global execution information array further includes:
a method of traversing each page in the applet project;
and creating an information object for recording the operation executed by the function in the method of each page, and storing the information object into a global execution information array.
In the invention, each page in the small program item corresponds to one page file, and in order to judge which page has a problem in which method through information, all functions in all the page files in the small program item can be traversed.
When traversing these methods as well, the steps in these methods are first temporarily stored.
An information object is created within the method for each page, the information object being used to record the operation performed by the function. The information object may be stored in a global execution information array records (the global execution information array and the previous global execution information array may be the same or may be set separately). After the adding operation of the information object is completed, the steps of the methods can be called again.
In step S3, when the function has an error, the global execution information array and the global variable are reported to the server for storage.
Specifically, a separate process is required when traversing to the oneerror method. In this method, the global execution information array records and the global variable deviceinfo are sent to the server.
That is, once an error occurs in an applet item, the oneerror method is triggered to send the array and the variable information to the server for saving. Therefore, the server records error information and is convenient to reproduce the problem.
Further, the content recorded by the information object includes one or more of current time, source page, current function name, page path and page parameter.
The format of the information object is defined as follows:
{
type:function
time: // Current time
Belong App: // Source Page
A method: methodname// current function name
Options & & options path// page path
query options & & options query// page parameter
//}
Further, the method for monitoring online exception of the applet further comprises the following steps:
and pre-configuring the reported server address and the key value of the current applet item.
Specifically, the server address and the key value of the current applet item are recorded by a configuration file.
That is to say, a configuration file is newly created, and the server address and the key value of the current applet item are configured through the configuration file, so that the server side can distinguish different applet items conveniently. The key value of the current applet item may be referred to as an API interface authentication sequence number for verifying API access legitimacy.
When a user enters an applet project to operate, each step of operation is recorded in the global execution information array, and once an error occurs, the oneerror method is triggered to upload error information to the server, so that problems are reproduced and solved.
The present invention also provides an electronic device 10, as shown in fig. 2, comprising:
a processor 110 adapted to implement instructions, an
A storage device 120 adapted to store a plurality of instructions adapted to be loaded and executed by the processor 110:
creating an information object for function execution in an applet project, recording operation executed by a function through the information object, and storing the information object into a global execution information array;
acquiring current equipment information and storing the current equipment information in a global variable;
when the function has errors, the global execution information array and the global variable are reported to the server for storage.
The processor 110 may be a general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA), a single chip, an arm (acorn RISC machine) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination of these components. Also, the processor may be any conventional processor, microprocessor, or state machine. A processor may also be implemented as a combination of computing devices, e.g., a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors in conjunction with a DSP core, or any other such configuration.
The storage device 120, which is a non-volatile computer-readable storage medium, may be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as program instructions corresponding to the on-line exception monitoring method in the embodiment of the present invention. The processor executes various functional applications of the online anomaly monitoring method of the applet and data processing by running the nonvolatile software programs, instructions and units stored in the storage device, so as to realize the above method embodiment.
The details of the electronic device 10 are described in the above method, and thus will not be described in detail.
The present invention also provides a non-transitory computer-readable storage medium having stored thereon computer-executable instructions that, when executed by one or more processors, cause the one or more processors to perform the applet online anomaly monitoring method.
The invention also provides a computer program product comprising a computer program stored on a non-volatile computer readable storage medium, the computer program comprising program instructions which, when executed by a processor, cause said processor to perform said method of on-die exception monitoring.
It is to be understood that the invention is not limited to the examples described above, but that modifications and variations may be effected thereto by those of ordinary skill in the art in light of the foregoing description, and that all such modifications and variations are intended to be within the scope of the invention as defined by the appended claims.
Claims (4)
1. An online exception monitoring method for an applet is characterized by comprising the following steps:
creating an information object for function execution in an applet project, recording operation executed by a function through the information object, and storing the information object into a global execution information array;
acquiring current equipment information and storing the current equipment information in a global variable;
when the function has errors, reporting the global execution information array and the global variable to a server for storage;
further comprising:
pre-configuring the reported server address and the key value of the current small program item;
recording the server address and the key value of the current applet item through a configuration file;
the step of creating an information object for function execution in the applet item, recording the operation executed by the function through the information object, and storing the information object into the global execution information array comprises the following steps:
a method of traversing entry files in an applet project;
creating an information object for recording the operation of function execution in the method of the entry file, and storing the information object into a global execution information array;
the method for the entry file in the applet project specifically comprises the following steps: while traversing these methods, firstly temporarily storing the steps in the methods, and creating an information object in the method of the entry file, wherein the information object is used for recording the operation executed by the function; the information object may be stored in a global execution information array records; after the adding operation of the information object is completed, the steps of the methods can be called again;
a user opens the applet for the first time, and triggers onLaunch, and the whole process is triggered only once;
after the initialization of the applet is completed, triggering an onShow method and monitoring the display of the applet;
the small program enters a background from a foreground and triggers an onHide method;
the small program enters foreground display from the background and triggers the onShow method;
the small program background runs for a certain time or the system resource occupation is too high, and the small program background can be destroyed;
the step of creating an information object for function execution in the applet item, recording the operation executed by the function through the information object, and storing the information object in the global execution information array further comprises:
a method of traversing each page in the applet project;
and creating an information object for recording the operation executed by the function in the method of each page, and storing the information object into a global execution information array.
2. The applet online anomaly monitoring method according to claim 1, characterized in that the current device information comprises network information, device information and geographical location information.
3. The on-line anomaly monitoring method for the small program according to claim 1, wherein the content recorded by the information object comprises one or more of current time, source page, current function name, page path and page parameter.
4. A non-transitory computer-readable storage medium storing computer-executable instructions that, when executed by one or more processors, cause the one or more processors to perform the on-die exception monitoring method of any one of claims 1-3.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910121928.8A CN109976973B (en) | 2019-02-19 | 2019-02-19 | Online exception monitoring method for small program and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910121928.8A CN109976973B (en) | 2019-02-19 | 2019-02-19 | Online exception monitoring method for small program and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109976973A CN109976973A (en) | 2019-07-05 |
CN109976973B true CN109976973B (en) | 2021-05-25 |
Family
ID=67077038
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910121928.8A Active CN109976973B (en) | 2019-02-19 | 2019-02-19 | Online exception monitoring method for small program and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109976973B (en) |
Families Citing this family (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110333912B (en) * | 2019-07-11 | 2023-04-18 | 百度在线网络技术(北京)有限公司 | Method and device for prefetching applet data and computer readable storage medium |
CN112306723A (en) * | 2019-07-30 | 2021-02-02 | 北京京东尚科信息技术有限公司 | Operation information acquisition method and device applied to small program |
CN110888731B (en) * | 2019-12-09 | 2023-07-07 | 北京博睿宏远数据科技股份有限公司 | Method, device, equipment and storage medium for acquiring route data |
CN111984532A (en) * | 2020-07-31 | 2020-11-24 | 五八有限公司 | Applet-based exception handling method and device |
CN113377605A (en) * | 2021-02-10 | 2021-09-10 | 北京声智科技有限公司 | Access monitoring method, device, server and computer readable storage medium |
CN114706733B (en) * | 2022-05-30 | 2022-09-20 | 支付宝(杭州)信息技术有限公司 | Section program abnormity monitoring method and device |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2001358883A (en) * | 2000-06-09 | 2001-12-26 | Canon Inc | Communications equipment, control method therefor and storage medium |
CN108595329A (en) * | 2018-04-23 | 2018-09-28 | 腾讯科技(深圳)有限公司 | A kind of application testing method, device and computer storage media |
-
2019
- 2019-02-19 CN CN201910121928.8A patent/CN109976973B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2001358883A (en) * | 2000-06-09 | 2001-12-26 | Canon Inc | Communications equipment, control method therefor and storage medium |
CN108595329A (en) * | 2018-04-23 | 2018-09-28 | 腾讯科技(深圳)有限公司 | A kind of application testing method, device and computer storage media |
Non-Patent Citations (3)
Title |
---|
小程序异常监控收集;蟹老板爱写代码;《https://juejin.im/post/6844903617292402702》;20180606;第1-5节 * |
微信小程序的生命周期实例演示—微信小程序教程系列(2);michael_ouyang;《https://blog.csdn.net/michael_ouyang/article/details/54891783》;20170216;第1-8页,图1-8 * |
蟹老板爱写代码.小程序异常监控收集.《https://juejin.im/post/6844903617292402702》.2018, * |
Also Published As
Publication number | Publication date |
---|---|
CN109976973A (en) | 2019-07-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109976973B (en) | Online exception monitoring method for small program and electronic equipment | |
WO2020233053A1 (en) | Method, apparatus, device, and storage medium for making test page script | |
US9129058B2 (en) | Application monitoring through continuous record and replay | |
CN113489713B (en) | Network attack detection method, device, equipment and storage medium | |
US8572625B2 (en) | Method and system for application migration using per-application persistent configuration dependency | |
CN109308263B (en) | Applet testing method, device and equipment | |
US20160283357A1 (en) | Call stack relationship acquiring method and apparatus | |
US9195809B1 (en) | Automated vulnerability and error scanner for mobile applications | |
WO2022016847A1 (en) | Automatic test method and device applied to cloud platform | |
CN108255719B (en) | Application program dump file acquisition method and device and electronic equipment | |
US8448138B2 (en) | Recording user-driven events within a computing system | |
AU2017206284A1 (en) | Tracing system operations across remote procedure linkages to identify request originators | |
CN114077525A (en) | Abnormal log processing method and device, terminal equipment, cloud server and system | |
US9626328B1 (en) | Method and system for on-demand aggregated logging for distributed systems | |
US10579502B2 (en) | Resuming applications using pass-through servers and trace data | |
CN110879781A (en) | Program debugging method and device, electronic equipment and computer readable storage medium | |
US9842044B2 (en) | Commit sensitive tests | |
CN114237498A (en) | Snapshot generation method and system for cloud native storage data volume | |
US10275595B2 (en) | System and method for characterizing malware | |
CN117241276B (en) | Detection tool, detection method, detection system and detection equipment for mobile application | |
US20170344461A1 (en) | Automated exception resolution during a software development session based on previous exception encounters | |
Rana et al. | Automated windows behavioral tracing for malware analysis | |
CN111459577A (en) | Application installation source tracking method, device, equipment and storage medium | |
CN108959070B (en) | Python hook function method and device based on code object | |
US20160124837A1 (en) | Memory error tracking in a multiple-user development environment |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |