Abnormality detection method and device, electronic equipment and readable storage medium
By analyzing the original stack information of the exception call stack and displaying attributes and code information in real time on the display interface, the problem of debugging programs affecting development efficiency is solved, timely acquisition and accurate prompts of exception information are achieved, and development efficiency is improved.
Patent Information
- Application Number
- CN202310736124.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-20
- Publication Date
- 2024-12-20
AI Technical Summary
During the real machine development or acceptance process, developers need to confirm the exception by opening the debugging program, but after opening the debugging program, it will affect the normal use of the original page, resulting in lag and omission of exception information acquisition, affecting development efficiency.
When detecting the exception call stack, the corresponding original stack information is parsed to determine the exception information, and the attribute information and code information are displayed to the developer in real time through the information prompt window on the display interface, including method name, exception code file routing, and error lines and column information, support viewing and ignoring controls to improve development efficiency.
It realizes prompt and effective prompting developers for abnormal information, avoiding information omissions and messiness, improving development efficiency, and ensuring timely acquisition and accuracy of abnormal information.
Smart Images

Figure CN119166486A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to an anomaly detection method, device, electronic device and readable storage medium. Background Art
[0002] Currently, developers can use the application engine to perform real-machine development or acceptance. During this process, if the developer needs to confirm whether an exception occurs, he or she needs to open a specific debugging program (such as the vConsole program) to confirm whether an exception occurs.
[0003] However, in the related art, after the developer opens the above-mentioned specific debugging program, the debugging program will affect the normal use of the original page, that is, the above-mentioned debugging program and the original page cannot be used together. Therefore, the developer cannot obtain the abnormal information in real time, which leads to the problems of delayed and missed acquisition of the abnormal information, thus affecting the development efficiency. Summary of the invention
[0004] In view of this, the embodiments of the present application provide an anomaly detection method, device, electronic device and readable storage medium to avoid problems such as information omission, information clutter and poor correlation, and improve development efficiency.
[0005] In a first aspect, a method for detecting anomalies is provided, the method comprising:
[0006] In response to detecting an exception call stack, the original stack information corresponding to the exception call stack is parsed to determine the exception information corresponding to the exception call stack, wherein the exception information includes attribute information and code information, the attribute information includes at least the method name, exception code file routing and exception location information corresponding to the exception call stack, and the code information includes at least the target source code corresponding to the exception call stack.
[0007] An information prompt window is displayed on the display interface, and the information prompt window at least includes the attribute information.
[0008] In response to the information prompt window being triggered, code information corresponding to the exception call stack is displayed.
[0009] In some embodiments, the parsing of the original stack information corresponding to the abnormal call stack to determine the abnormal information corresponding to the abnormal call stack includes:
[0010] Determine the exception type corresponding to the exception call stack.
[0011] In response to the exception type being a predetermined type, original stack information corresponding to the exception call stack is parsed to determine exception information corresponding to the exception call stack.
[0012] In some embodiments, the parsing of the original stack information corresponding to the abnormal call stack to determine the abnormal information corresponding to the abnormal call stack includes:
[0013] Regular expression matching is performed on the original stack information to determine attribute information corresponding to the abnormal call stack, where the abnormal position information in the attribute information includes error row information and error column information.
[0014] The error line information and the error column information are mapped and reversed to determine the target code file route, target code line information and target code column information corresponding to the exception call stack.
[0015] The code information corresponding to the exception call stack is determined according to the method name, the target code file route, the target code line information and the target code column information.
[0016] In some embodiments, the mapping and reverse processing of the error line information and the error column information to determine the target code file route, target code line information and target code column information corresponding to the abnormal call stack includes:
[0017] Based on the preset Sourcemap index file, the error line information and the error column information are mapped and reversed to determine the target code file route, target code line information and target code column information corresponding to the exception call stack.
[0018] In some embodiments, the method further comprises:
[0019] In response to detecting a plurality of abnormal call stacks, the reminder tasks corresponding to the abnormal call stacks are stored in a reminder queue in a predetermined order.
[0020] In response to the information prompt window currently displayed on the display interface exiting, abnormal information corresponding to the first reminder task in the reminder queue is determined.
[0021] An information prompt window corresponding to the first reminder task is displayed on the display interface.
[0022] In some embodiments, the code information further includes backtrace information, and the backtrace information includes source code associated with the target source code.
[0023] In some embodiments, the method further comprises:
[0024] The exception call stack is recorded in the historical exception list.
[0025] In response to the exception call stack in the historical exception list being triggered, the exception information corresponding to the exception call stack is displayed.
[0026] In some embodiments, the attribute information also includes the exception type corresponding to the exception call stack.
[0027] In some embodiments, the information prompt window also includes a view control and an ignore control.
[0028] The method further comprises:
[0029] In response to the viewing control being triggered, code information corresponding to the exception call stack is displayed.
[0030] In response to the ignore control being triggered, exit the information prompt window.
[0031] In some embodiments, the method further comprises:
[0032] Show hint function turn on control.
[0033] In response to the prompt function activation control being switched to an activated state, the abnormal information prompt function is activated, and the abnormal information prompt function is used to display the information prompt window on the display interface.
[0034] In a second aspect, an abnormality detection device is provided, the device comprising:
[0035] The exception information determination module is configured to execute, in response to detecting an exception call stack, parsing the original stack information corresponding to the exception call stack, and determining the exception information corresponding to the exception call stack, wherein the exception information includes attribute information and code information, the attribute information includes at least the method name, exception code file routing and exception location information corresponding to the exception call stack, and the code information includes at least the target source code corresponding to the exception call stack.
[0036] The information prompt window display module is configured to execute displaying an information prompt window on the display interface, wherein the information prompt window at least includes the attribute information.
[0037] The code information display module is configured to execute, in response to the information prompt window being triggered, displaying the code information corresponding to the abnormal call stack.
[0038] In some embodiments, the abnormal information determination module is specifically configured to perform:
[0039] Determine the exception type corresponding to the exception call stack.
[0040] In response to the exception type being a predetermined type, original stack information corresponding to the exception call stack is parsed to determine exception information corresponding to the exception call stack.
[0041] In some embodiments, the abnormal information determination module is specifically configured to perform:
[0042] Regular expression matching is performed on the original stack information to determine attribute information corresponding to the abnormal call stack, where the abnormal position information in the attribute information includes error row information and error column information.
[0043] The error line information and the error column information are mapped and reversed to determine the target code file route, target code line information and target code column information corresponding to the exception call stack.
[0044] The code information corresponding to the exception call stack is determined according to the method name, the target code file route, the target code line information and the target code column information.
[0045] In some embodiments, the abnormal information determination module is specifically configured to perform:
[0046] Based on the preset Sourcemap index file, the error line information and the error column information are mapped and reversed to determine the target code file route, target code line information and target code column information corresponding to the exception call stack.
[0047] In some embodiments, the apparatus further comprises:
[0048] The reminder task storage module is configured to execute, in response to detecting multiple abnormal call stacks, storing the reminder tasks corresponding to each of the abnormal call stacks into the reminder queue in a predetermined order.
[0049] The reminder task determination module is configured to execute, in response to the exit of the information prompt window currently displayed on the display interface, to determine the abnormal information corresponding to the first reminder task in the reminder queue.
[0050] The reminder task display module is configured to display an information prompt window corresponding to the first reminder task on the display interface.
[0051] In some embodiments, the code information further includes backtrace information, and the backtrace information includes source code associated with the target source code.
[0052] In some embodiments, the apparatus further comprises:
[0053] The exception call stack recording module is configured to execute recording of the exception call stack into a historical exception list.
[0054] The historical exception display module is configured to execute, in response to the exception call stack in the historical exception list being triggered, displaying the exception information corresponding to the exception call stack.
[0055] In some embodiments, the attribute information also includes the exception type corresponding to the exception call stack.
[0056] In some embodiments, the information prompt window also includes a view control and an ignore control.
[0057] The device also includes:
[0058] The viewing control triggering module is configured to execute, in response to the viewing control being triggered, displaying code information corresponding to the abnormal call stack.
[0059] The ignore control triggering module is configured to execute, in response to the ignore control being triggered, exiting the information prompt window.
[0060] In some embodiments, the apparatus further comprises:
[0061] The prompt function activation control display module is configured to execute and display the prompt function activation control.
[0062] The prompt function activation module is configured to execute, in response to the prompt function activation control being switched to an activated state, activation of an abnormal information prompt function, wherein the abnormal information prompt function is used to display the information prompt window on the display interface.
[0063] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory and a processor, wherein the memory is used to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method described in the first aspect.
[0064] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the method described in the first aspect is implemented.
[0065] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program / instructions, which, when executed by a processor, implement the method described in the first aspect.
[0066] The embodiment of the present application can parse the original stack information corresponding to the abnormal call stack after detecting the abnormal call stack to determine the abnormal information corresponding to the abnormal call stack. Further, the embodiment of the present application can display the attribute information to the developer in real time by displaying the information prompt window on the display interface, so that the developer can directly view the attribute information or trigger to view the code information. Therefore, through the embodiment of the present application, the abnormal information can be prompted to the developer in a timely and effective manner, avoiding the problems of information omission, information clutter and poor relevance, and improving the development efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] The above and other purposes, features and advantages of the embodiments of the present application will become more apparent through the following description of the embodiments of the present application with reference to the accompanying drawings, in which:
[0068] Figure 1 A flowchart for viewing abnormal information for related technologies;
[0069] Figure 2 A flowchart of an abnormality detection method according to an embodiment of the present application;
[0070] Figure 3 A flowchart of another anomaly detection method according to an embodiment of the present application;
[0071] Figure 4 A flowchart of another anomaly detection method according to an embodiment of the present application;
[0072] Figure 5 A schematic diagram of an information prompt window of an embodiment of the present application;
[0073] Figure 6 A flowchart of an abnormality detection method according to an embodiment of the present application;
[0074] Figure 7 A flowchart of another anomaly detection method according to an embodiment of the present application;
[0075] Figure 8 A schematic diagram of another information prompt window of an embodiment of the present application;
[0076] Fig. 9 A flowchart of another anomaly detection method according to an embodiment of the present application;
[0077] Fig.10 A schematic diagram of a control for opening a prompt function according to an embodiment of the present application;
[0078] Fig.11 This is a schematic diagram of the structure of an abnormality detection device according to an embodiment of the present application;
[0079] Fig.12 A schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0080] The present application is described below based on embodiments, but the present application is not limited to these embodiments. In the detailed description of the present application below, some specific details are described in detail. It is possible for those skilled in the art to fully understand the present application without the description of these details. In order to avoid confusing the essence of the present application, known methods, processes, flows, components and circuits are not described in detail.
[0081] In addition, persons of ordinary skill in the art will appreciate that the drawings provided herein are for illustration purposes and are not necessarily drawn to scale.
[0082] Unless the context clearly requires otherwise, the words "include", "comprising" and the like throughout this application should be interpreted as including rather than exclusive or exhaustive; that is, as meaning "including but not limited to".
[0083] In the description of this application, it should be understood that the terms "first", "second", etc. are used for descriptive purposes only and should not be understood as indicating or implying relative importance. In addition, in the description of this application, unless otherwise specified, the meaning of "plurality" is two or more. In addition, this application authorizes the acquisition, collection, storage, use, processing, transmission, provision and presentation of data on the premise of complying with the provisions of relevant laws and regulations, not infringing on the privacy of others and not violating public order and good morals.
[0084] Currently, developers can use the application engine to conduct real-machine development or acceptance. During this process, if developers need to confirm whether an abnormality occurs, they need to open a specific debugging program (such as the vConsole program) to confirm whether an abnormality occurs. vConsole is a lightweight and extensible front-end development debugging panel that can help developers develop and debug more conveniently.
[0085] Take the vConsole program as an example. Figure 1 As shown, developers can perform real machine development or acceptance through the development interface 11. During this process, the relevant technology can display a jump button 12 corresponding to the vConsole program in the development interface 11 for the developer to debug.
[0086] Further, such as Figure 1 As shown, when the developer clicks the jump button 12, the related technology can display the vConsole debugging panel 13 in the form of a pop-up window in the development interface 11, and the vConsole debugging panel 13 can display log information, business exceptions, system exceptions and other information.
[0087] However, in the related art, after the developer opens the vConsole program, the vConsole program will affect the normal use of the original page (that is, during the display of the vConsole debugging panel 13, the developer cannot edit the content in the development interface 11), that is, the vConsole debugging panel 13 and the development interface 11 cannot be used together.
[0088] Furthermore, if developers want to check the exceptions that occur during the development process in a timely manner, they need to frequently trigger the vConsole debug panel 13, which greatly reduces the development efficiency. Accordingly, if developers trigger the vConsole debug panel 13 every once in a while, there will be a delay in obtaining the exception information, and there will be problems such as information omission, information clutter, and poor relevance caused by too much content and type in the vConsole debug panel 13, which will affect the development efficiency. Therefore, how to prompt the developer with exception information in a timely and effective manner and improve the development efficiency is a problem that needs to be solved urgently.
[0089] In order to solve the above problems, the embodiment of the present application provides an exception detection method. When an abnormal call stack is detected, the embodiment of the present application can determine the abnormal information corresponding to the abnormal call stack, and prompt the developer through an information prompt window, thereby promptly and effectively prompting the developer with abnormal information and improving development efficiency. Among them, the method can be applied to electronic devices, the electronic device can be a terminal or a server, the terminal can be a smart phone, a tablet computer or a personal computer (PC), etc., the server can be a single server, it can also be a server cluster configured in a distributed manner, and it can also be a cloud server.
[0090] Specifically, Figure 2 As shown, the abnormality detection method of the embodiment of the present application may include the following steps:
[0091] In step S110 , in response to detecting an abnormal call stack, original stack information corresponding to the abnormal call stack is parsed to determine abnormal information corresponding to the abnormal call stack.
[0092] The exception information may include attribute information and code information, the attribute information at least includes the method name corresponding to the exception call stack, the exception code file route and the exception location information, and the code information at least includes the target source code corresponding to the exception call stack. Specifically, the method name may be used to represent the method name corresponding to the source code where the exception occurs, the exception code file route may be used to represent the index position corresponding to the source code where the exception occurs, and the exception location information may be used to represent the row and column location information corresponding to the source code where the exception occurs, which generally includes the error line information and error column information of the exception source code, and the target source code is the source code where the exception occurs.
[0093] In addition, the embodiment of the present application can detect whether an abnormal call stack appears and determine the abnormal information corresponding to the abnormal call stack through the application engine. The application engine can be a small program engine or other applicable application engines.
[0094] Specifically, after detecting the abnormal call stack, the application engine can determine the original stack information corresponding to the abnormal call stack. The original stack information cannot be directly used to determine the code information. Therefore, the embodiment of the present application can parse the original stack information through the application engine to determine the target code information corresponding to the abnormal call stack, and then determine the code information based on the target code information. Among them, the target code refers to the code generated after the compiler or assembler processes the source code, which is generally composed of machine code or code close to machine language.
[0095] In an optional embodiment, if Figure 3 As shown, the above step S110 may include the following steps:
[0096] In step S111, the exception type corresponding to the exception call stack is determined.
[0097] Among them, the exception type may include business exceptions and system exceptions, etc. The embodiment of the present application can determine the exception type corresponding to the exception call stack through the above-mentioned application engine.
[0098] In step S112, in response to the exception type being a predetermined type, original stack information corresponding to the exception call stack is parsed to determine exception information corresponding to the exception call stack.
[0099] Among them, the embodiment of the present application can set the predetermined type according to actual needs. For example, the embodiment of the present application can set the above predetermined type to a business exception. Further, when the exception type corresponding to the exception call stack is a business exception, the embodiment of the present application can determine the exception information corresponding to the exception call stack and prompt the developer through the information prompt window. In other words, the embodiment of the present application can filter the exception call stacks of different exception types by predetermined types, so as to display more important exception call stacks to the developer and improve the efficiency of exception troubleshooting.
[0100] In an optional implementation, for the process of determining abnormal information, such as Figure 4 As shown, the above step S110 may include the following steps:
[0101] In step S113, regular expression matching is performed on the original stack information to determine the attribute information corresponding to the abnormal call stack.
[0102] Among them, the exception location information in the attribute information may include error line information and error column information. A regular expression is a text pattern that includes ordinary characters and special characters. A regular expression can use a single string to describe and match a series of strings that match a certain syntactic rule. It is usually used to retrieve and replace texts that conform to a certain pattern (or rule). In an embodiment of the present application, the original stack information can be matched and split by regular expression matching processing to determine the method name, exception code file routing, error line information, and error column information corresponding to the original stack information. Among them, the method name can be used to represent the method name corresponding to the source code where the exception occurs, the exception code file routing can be used to represent the index position corresponding to the source code where the exception occurs, the error line information can be used to represent the line information corresponding to the source code where the exception occurs in the original stack information, and the error column information can be used to represent the column information corresponding to the source code where the exception occurs in the original stack information.
[0103] In step S114, the error line information and the error column information are mapped and reversed to determine the target code file route, target code line information and target code column information corresponding to the abnormal call stack.
[0104] Among them, since the original stack information cannot be directly used to determine the code information, the embodiment of the present application can first determine the information corresponding to the target code (i.e., the target code file routing, target code line information and target code column information) according to the information corresponding to the source code (i.e., the error line information and the error column information), and then generate exception information according to the information corresponding to the target code.
[0105] In an optional implementation, the above step S114 can be specifically performed as follows: based on a preset Sourcemap index file, the error line information and the error column information are mapped and reversed to determine the target code file route, target code line information and target code column information corresponding to the exception call stack.
[0106] Among them, the Sourcemap index file is an information file, which stores the position correspondence information before and after the code conversion, that is, the source code position before the conversion corresponding to the converted compressed code. Sourcemap solves the problem of difficulty in debugging during the code compilation and packaging process, due to the large differences between the codes after the code is compressed, space-removed, and compiled and converted by babel. Based on the mapping of source code and target code brought by Sourcemap, the embodiment of the present application can map and reverse the error line information and error column information based on Sourcemap, determine the target code corresponding to the exception call stack, and then determine the target code file routing, target code line information and target code column information corresponding to the target code. Among them, the target code refers to the code generated after the compiler or assembler processes the source code, the target code file routing is used to characterize the index position corresponding to the target code, the target code line information can be used to characterize the line information corresponding to the target code, and the target code column information can be used to characterize the column information corresponding to the target code.
[0107] In step S115, code information corresponding to the exception call stack is determined according to the method name, the target code file route, the target code line information and the target code column information.
[0108] Specifically, the embodiment of the present application can reassemble the method name, target code file route, target code line information and target code column information to obtain a reassembled stack. Furthermore, the embodiment of the present application can output the reassembled stack to the functional module corresponding to the information prompt window, so that the functional module determines the exception information and controls the display interface to display the information prompt window, and displays the code information corresponding to the exception call stack after the information prompt window is triggered. Among them, the reassembled stack can be characterized as follows: at method name (target code file route; target code line information; target code column information)
[0109] By determining the exception information, the embodiment of the present application can display the method name, exception code file route, error line information and error column information to the developer to help the developer quickly locate the exception call stack and improve development efficiency.
[0110] In step S120, an information prompt window is displayed on the display interface.
[0111] The information prompt window at least includes attribute information.
[0112] For example, Figure 5As shown, the embodiment of the present application can display an information prompt window 51 on the display interface, and the information prompt window 51 can be in a suitable form such as a pop-up window. The abnormal information in the information prompt window 51 can at least include a method name 511, an abnormal code file route 512, an error line information 513, and an error column information 514.
[0113] In an embodiment of the present application, if a developer encounters a code exception during the development process, the embodiment of the present application can directly prompt the developer through the information prompt window 51, so that the developer can intuitively obtain the source code information of the exception without switching or opening other windows, thereby improving development efficiency.
[0114] In an optional implementation, the attribute information of the embodiment of the present application may also include the exception type corresponding to the exception call stack.
[0115] by Figure 5 For example, the embodiment of the present application can display the method name 511, the exception code file route 512, the error line information 513 and the error column information 514 to the developer, and can also display the exception type corresponding to the exception call stack to the developer. In this way, when there are too many exception types to be displayed, the developer can quickly filter the exception call stack that needs to be viewed by the exception type displayed in the exception information, thereby further improving development efficiency.
[0116] In step S130, in response to the information prompt window being triggered, code information corresponding to the abnormal call stack is displayed.
[0117] The code information at least includes the target source code corresponding to the exception call stack, and the target source code is the source code where the exception occurs.
[0118] like Figure 6 As shown, during the process of the developer developing through the development interface 61, if the application engine detects an abnormal call stack, the embodiment of the present application can display an information prompt window 62 in the development interface 61 to prompt the developer with the attribute information of the source code where the exception occurred. Among them, the attribute information can at least include the method name corresponding to the original stack information, the abnormal code file route and the abnormal location information, and optionally, the attribute information can also include the exception type corresponding to the abnormal call stack.
[0119] Furthermore, if the developer wishes to view the code information 63 corresponding to the information prompt window 62 (i.e., the exception call stack), the developer may trigger the information prompt window 62 by touch or external device control (e.g., an external device such as a mouse or keyboard), so that the electronic device displays the code information 63 corresponding to the information prompt window 62. Accordingly, if the developer does not view the code information 63 corresponding to the information prompt window 62, on the one hand, the embodiment of the present application may control the information prompt window 62 to automatically exit after displaying for a predetermined time (e.g., 3 seconds, 5 seconds, or 8 seconds, etc.), and on the other hand, the developer may also manually control the information prompt window 62 to exit by touch or external device control.
[0120] The embodiment of the present application can parse the original stack information corresponding to the abnormal call stack after detecting the abnormal call stack to determine the abnormal information corresponding to the abnormal call stack. Further, the embodiment of the present application can display the attribute information to the developer in real time by displaying the information prompt window on the display interface, so that the developer can directly view the attribute information or trigger to view the code information. Therefore, through the embodiment of the present application, the abnormal information can be prompted to the developer in a timely and effective manner, avoiding the problems of information omission, information clutter and poor relevance, and improving the development efficiency.
[0121] In an optional embodiment, if Figure 7 As shown, when there are too many abnormal call stacks, the embodiment of the present application can also perform the following steps:
[0122] In step S210 , in response to detecting a plurality of abnormal call stacks, the reminder tasks corresponding to the abnormal call stacks are stored in a reminder queue in a predetermined order.
[0123] Wherein, the predetermined order can be the sequence of detecting the abnormal call stack, or it can be the order obtained by arranging according to the priority of the abnormal type (for example, the priority of the business exception is greater than the priority of the system exception), or it can be other applicable predetermined orders.It should be noted that if the embodiment of the present application is arranged according to the priority of the abnormal type, then the embodiment of the present application can preferentially show the more important abnormal call stack to the developer, so that the developer can check the more important abnormal call stack for the first time, to further improve development efficiency.In addition, multiple abnormal call stacks under the same abnormal type can be sorted according to the sequence of detecting the abnormal call stack.
[0124] In step S220, in response to the information prompt window currently displayed on the display interface exiting, abnormal information corresponding to the first reminder task in the reminder queue is determined.
[0125] Among them, the embodiment of the present application can set a predetermined time (such as 3 seconds, 5 seconds or 8 seconds, etc.) on the one hand, and control the information prompt window to exit after displaying the predetermined time. On the other hand, the developer can also manually control the information prompt window to exit by touch or external device control.
[0126] In step S230, an information prompt window corresponding to the first reminder task is displayed on the display interface.
[0127] In the embodiment of the present application, when too many abnormal call stacks are detected, the reminder tasks corresponding to each abnormal call stack can be stored in the reminder queue, and the information prompt windows corresponding to each reminder task can be displayed in turn on the display interface. In this way, the embodiment of the present application can effectively avoid problems such as information omission and information clutter, and improve development efficiency.
[0128] In an optional implementation, the information prompt window of the embodiment of the present application may also include a view control and an ignore control.
[0129] For example, Figure 8 As shown, the information prompt window 81 may include attribute information (method name 811, exception type 812, exception code file routing 813, error line information 814 and error column information 815). Optionally, the information prompt window 81 may not display the exception type 812 to simplify the amount of information displayed in the information prompt window 81.
[0130] In addition, the information prompt window 81 may also include a view control button 816 (i.e., a view control) and an ignore control button 817 (i.e., an ignore control). Specifically, the embodiment of the present application may also perform the following steps:
[0131] In step A1, in response to the view control being triggered, code information corresponding to the exception call stack is displayed.
[0132] In step A2, in response to the ignore control being triggered, the information prompt window is exited.
[0133] That is, through the view control button 816 and the ignore control button 817, the developer can quickly choose whether to view the detailed information corresponding to the information prompt window, thereby improving development efficiency.
[0134] It should be noted that the view control and ignore control of the embodiment of the present application are not limited to Figure 8For example, the view control and the ignore control may also be the information prompt window itself. If the developer wishes to view the code information corresponding to the information prompt window, the developer may click anywhere on the information prompt window, or slide the information prompt window in a first predetermined direction (e.g., slide to the right) to trigger the view control, thereby controlling the electronic device to display the code information corresponding to the abnormal call stack. Accordingly, if the developer does not wish to view the code information corresponding to the information prompt window, the developer may slide the information prompt window in a second predetermined direction (e.g., slide upward or slide to the left) to trigger the exit of the information prompt window.
[0135] In an optional implementation, the code information of the embodiment of the present application may further include backtrace information, and the backtrace information may include source code associated with the target source code.
[0136] Among them, after determining the target source code corresponding to the abnormal call stack, the embodiment of the present application can perform backtracking processing based on the code referenced by the target source code to determine one or more source code sections associated with the target source code. Further, when the information prompt window is triggered, the developer can intuitively view all codes related to the abnormal call stack to improve development efficiency.
[0137] It should be noted that if there is no source code associated with the target source code, the code information of the embodiment of the present application may not include backtrace information.
[0138] In an optional implementation, the developer may also view historical exceptions. Specifically, the embodiment of the present application may further perform the following steps:
[0139] In step B1, the exception call stack is recorded in a historical exception list.
[0140] The developer may trigger an entry button or menu option of the historical exception list in the display interface by touch or external device control to trigger a jump to display the historical exception list.
[0141] In step B2, in response to the exception call stack in the historical exception list being triggered, the exception information corresponding to the exception call stack is displayed.
[0142] For example, Fig. 9 As shown, historical exception 91, historical exception 92 and historical exception 93 are three exception call stacks in the historical exception list. Further, when historical exception 91 is triggered, the embodiment of the present application can control the expansion of historical exception 91 (such as Fig. 9The display interface shown on the right) displays the exception information 911 corresponding to the historical exception 91 in the expanded part for the developer to view. It should be noted that the exception information 911 may include the attribute information and code information corresponding to the historical exception 91. In addition to the target source code corresponding to the historical exception 91, the code information may also include the traceback information corresponding to the historical exception 91.
[0143] Therefore, through the embodiments of the present application, developers can view historical exceptions through the historical exception list, avoiding omission of information and improving development efficiency.
[0144] In an optional implementation manner, the embodiment of the present application may further perform the following steps:
[0145] In step C1, a prompt function start control is displayed.
[0146] In step C2, in response to the prompt function activation control being switched to the activated state, the abnormal information prompt function is activated.
[0147] Among them, the abnormal information prompt function is used to display an information prompt window on the display interface. That is to say, the embodiment of the present application can turn on or off the abnormal information prompt function through the prompt function opening control. If the abnormal information prompt function is turned on, the embodiment of the present application can display an information prompt window when an abnormal call stack is detected to prompt the developer that an abnormality has occurred. If the abnormal information prompt function is turned off, the embodiment of the present application does not display the information prompt window to simplify the content displayed on the page.
[0148] For example, Fig.10 As shown, the display interface 1001 of the embodiment of the present application may include a prompt function activation control 1002. Among them, the prompt function activation control 1002 is Fig.10 The state shown in is the on state. Developers can trigger the prompt function on control 1002 by touch or external device control to freely choose to turn on or off the exception information prompt function, thereby improving development efficiency by turning on the exception information prompt function, or simplifying the content displayed on the page by turning off the exception information prompt function.
[0149] Based on the same technical concept, the embodiment of the present application also provides an abnormality detection device, such as Fig.11 As shown, the device includes: an abnormal information determination module 1101, an information prompt window display module 1102 and a code information display module 1103.
[0150] The exception information determination module 1101 is configured to execute, in response to detecting an exception call stack, parsing the original stack information corresponding to the exception call stack, and determining the exception information corresponding to the exception call stack, wherein the exception information includes attribute information and code information, the attribute information includes at least the method name, exception code file routing and exception location information corresponding to the exception call stack, and the code information includes at least the target source code corresponding to the exception call stack.
[0151] The information prompt window display module 1102 is configured to display an information prompt window on the display interface, wherein the information prompt window at least includes the attribute information.
[0152] The code information display module 1103 is configured to execute, in response to the information prompt window being triggered, displaying the code information corresponding to the abnormal call stack.
[0153] In some embodiments, the abnormal information determination module 1101 is specifically configured to perform:
[0154] Determine the exception type corresponding to the exception call stack.
[0155] In response to the exception type being a predetermined type, original stack information corresponding to the exception call stack is parsed to determine exception information corresponding to the exception call stack.
[0156] In some embodiments, the abnormal information determination module 1101 is specifically configured to perform:
[0157] Regular expression matching is performed on the original stack information to determine attribute information corresponding to the abnormal call stack, where the abnormal position information in the attribute information includes error row information and error column information.
[0158] The error line information and the error column information are mapped and reversed to determine the target code file route, target code line information and target code column information corresponding to the exception call stack.
[0159] The code information corresponding to the exception call stack is determined according to the method name, the target code file route, the target code line information and the target code column information.
[0160] In some embodiments, the abnormal information determination module 1101 is specifically configured to perform:
[0161] Based on the preset Sourcemap index file, the error line information and the error column information are mapped and reversed to determine the target code file route, target code line information and target code column information corresponding to the exception call stack.
[0162] In some embodiments, the apparatus further comprises:
[0163] The reminder task storage module is configured to execute, in response to detecting multiple abnormal call stacks, storing the reminder tasks corresponding to each of the abnormal call stacks into the reminder queue in a predetermined order.
[0164] The reminder task determination module is configured to execute, in response to the exit of the information prompt window currently displayed on the display interface, to determine the abnormal information corresponding to the first reminder task in the reminder queue.
[0165] The reminder task display module is configured to display an information prompt window corresponding to the first reminder task on the display interface.
[0166] In some embodiments, the code information further includes backtrace information, and the backtrace information includes source code associated with the target source code.
[0167] In some embodiments, the apparatus further comprises:
[0168] The exception call stack recording module is configured to execute recording of the exception call stack into a historical exception list.
[0169] The historical exception display module is configured to execute, in response to the exception call stack in the historical exception list being triggered, displaying the exception information corresponding to the exception call stack.
[0170] In some embodiments, the attribute information also includes the exception type corresponding to the exception call stack.
[0171] In some embodiments, the information prompt window also includes a view control and an ignore control.
[0172] The device also includes:
[0173] The viewing control triggering module is configured to execute, in response to the viewing control being triggered, displaying code information corresponding to the abnormal call stack.
[0174] The ignore control triggering module is configured to execute, in response to the ignore control being triggered, exiting the information prompt window.
[0175] In some embodiments, the apparatus further comprises:
[0176] The prompt function activation control display module is configured to execute and display the prompt function activation control.
[0177] The prompt function activation module is configured to execute, in response to the prompt function activation control being switched to an activated state, activation of an abnormal information prompt function, wherein the abnormal information prompt function is used to display the information prompt window on the display interface.
[0178] The embodiment of the present application can parse the original stack information corresponding to the abnormal call stack after detecting the abnormal call stack to determine the abnormal information corresponding to the abnormal call stack. Further, the embodiment of the present application can display the attribute information to the developer in real time by displaying the information prompt window on the display interface, so that the developer can directly view the attribute information or trigger to view the code information. Therefore, through the embodiment of the present application, the abnormal information can be prompted to the developer in a timely and effective manner, avoiding the problems of information omission, information clutter and poor relevance, and improving the development efficiency.
[0179] Fig.12 Schematic diagram of an electronic device according to an embodiment of the present application. Fig.12 As shown, Fig.12 The electronic device shown is a general address query device, which includes a general computer hardware structure, which includes at least a processor 1201 and a memory 1202. The processor 1201 and the memory 1202 are connected via a bus 1203. The memory 1202 is suitable for storing instructions or programs executable by the processor 1201. The processor 1201 can be an independent microprocessor or a collection of one or more microprocessors. Thus, the processor 1201 executes the instructions stored in the memory 1202, thereby executing the method flow of the embodiment of the present application as described above to realize the processing of data and the control of other devices. The bus 1203 connects the above-mentioned multiple components together, and at the same time connects the above-mentioned components to the display controller 1204 and the display device and the input / output (I / O) device 1205. The input / output (I / O) device 1205 can be a mouse, a keyboard, a modem, a network interface, a touch input device, a somatosensory input device, a printer, and other devices known in the art. Typically, the input / output device 1205 is connected to the system through an input / output (I / O) controller 1206.
[0180] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, devices (equipment) or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present application may adopt a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0181] The present application is described with reference to flowcharts of methods, apparatuses (devices) and computer program products according to embodiments of the present application. It should be understood that each process in the flowchart can be implemented by computer program instructions.
[0182] These computer program instructions may be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device that implements the process Figure 1 A function specified in a process or multiple processes.
[0183] These computer program instructions may also be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce the instructions for implementing the process Figure 1 A device that specifies functions in a process or multiple processes.
[0184] Another embodiment of the present application relates to a non-volatile storage medium for storing a computer-readable program, wherein the computer-readable program is used for a computer to execute part or all of the above method embodiments.
[0185] That is, those skilled in the art can understand that all or part of the steps in the above-mentioned embodiment method can be completed by specifying relevant hardware through a program, and the program is stored in a storage medium, including several instructions for a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0186] Another embodiment of the present application relates to a computer program product, including a computer program / instruction, which can implement part or all of the above method embodiments when the computer program / instruction is executed by a processor.
[0187] That is, those skilled in the art can understand that the embodiments of the present application can specify relevant hardware (including the processor itself) through the processor executing a computer program product (computer program / instructions), thereby implementing all or part of the steps in the above-mentioned embodiment method.
[0188] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
[0189] The solutions described in this specification and in the examples, if they involve the processing of personal information, will be processed on the premise of having a legal basis (such as obtaining the consent of the subject of personal information, or being necessary for the performance of a contract, etc.), and will only be processed within the scope of regulations or agreements. If a user refuses to process personal information other than the necessary information for basic functions, it will not affect the user's use of basic functions.
Claims
1. An anomaly detection method, characterized in that: The method comprises: In response to detecting an exception call stack, parsing original stack information corresponding to the exception call stack to determine exception information corresponding to the exception call stack, wherein the exception information includes attribute information and code information, the attribute information at least includes a method name, an exception code file route, and an exception location information corresponding to the exception call stack, and the code information at least includes a target source code corresponding to the exception call stack; Displaying an information prompt window on the display interface, the information prompt window at least including the attribute information; and In response to the information prompt window being triggered, code information corresponding to the exception call stack is displayed.
2. The method according to claim 1, characterized in that The parsing of the original stack information corresponding to the abnormal call stack to determine the abnormal information corresponding to the abnormal call stack includes: Determine the exception type corresponding to the exception call stack; and In response to the exception type being a predetermined type, original stack information corresponding to the exception call stack is parsed to determine exception information corresponding to the exception call stack.
3. The method according to claim 1 or 2, characterized in that: The parsing of the original stack information corresponding to the abnormal call stack to determine the abnormal information corresponding to the abnormal call stack includes: Performing regular expression matching processing on the original stack information to determine attribute information corresponding to the abnormal call stack, wherein the abnormal position information in the attribute information includes error row information and error column information; Mapping and inversely analyzing the error line information and the error column information to determine the target code file route, target code line information, and target code column information corresponding to the abnormal call stack; and The code information corresponding to the exception call stack is determined according to the method name, the target code file route, the target code line information and the target code column information.
4. The method according to claim 3, characterized in that The mapping and reverse processing of the error line information and the error column information to determine the target code file route, target code line information and target code column information corresponding to the abnormal call stack includes: Based on the preset Sourcemap index file, the error line information and the error column information are mapped and reversed to determine the target code file route, target code line information and target code column information corresponding to the exception call stack.
5. The method according to claim 1, characterized in that The method further comprises: In response to detecting a plurality of abnormal call stacks, storing reminder tasks corresponding to each of the abnormal call stacks into a reminder queue in a predetermined order; In response to the information prompt window currently displayed on the display interface exiting, determining abnormal information corresponding to the first reminder task in the reminder queue; and An information prompt window corresponding to the first reminder task is displayed on the display interface.
6. The method according to claim 1, characterized in that The code information further includes backtrace information, and the backtrace information includes source code associated with the target source code.
7. The method according to claim 1 or 6, characterized in that: The method further comprises: Recording the exception call stack into a historical exception list; and In response to the exception call stack in the historical exception list being triggered, the exception information corresponding to the exception call stack is displayed.
8. The method according to claim 1, characterized in that The attribute information also includes the exception type corresponding to the exception call stack.
9. The method according to claim 1, characterized in that: The information prompt window also includes a view control and an ignore control; The method further comprises: In response to the viewing control being triggered, displaying code information corresponding to the exception call stack; and In response to the ignore control being triggered, exit the information prompt window.
10. The method according to claim 1, characterized in that The method further comprises: Display prompt function turn on control; and In response to the prompt function activation control being switched to an activated state, the abnormal information prompt function is activated, and the abnormal information prompt function is used to display the information prompt window on the display interface.
11. An abnormality detection device, characterized in that: The device comprises: an exception information determination module, configured to execute, in response to detecting an exception call stack, parsing original stack information corresponding to the exception call stack, and determining exception information corresponding to the exception call stack, wherein the exception information includes attribute information and code information, the attribute information at least includes a method name, an exception code file route and an exception location information corresponding to the exception call stack, and the code information at least includes a target source code corresponding to the exception call stack; an information prompt window display module, configured to execute displaying an information prompt window on a display interface, wherein the information prompt window at least includes the attribute information; and The code information display module is configured to execute, in response to the information prompt window being triggered, displaying the code information corresponding to the abnormal call stack.
12. An electronic device comprising a memory and a processor, characterized in that: The memory is used to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method according to any one of claims 1-10.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 10 is implemented.
14. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the method according to any one of claims 1 to 10 is implemented.
