Exception handling method, device, equipment and storage medium
By obtaining the tracking identification and time-related information of the abnormal response request in the business system, and generating suspected abnormal interface information of the arrangement correlation degree, the problem of low manual positioning efficiency in the prior art is solved, and fast and accurate abnormal response positioning is achieved.
Patent Information
- Application Number
- CN202111385457.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-22
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2041-11-22
AI Technical Summary
In the prior art, abnormal responses in the business system require manual problem positioning, resulting in low efficiency.
By obtaining the tracking identifier of the target service request, obtaining the time-related information of the business module in the business system that handles the request, generating suspected abnormal interface information, and arranging the interfaces according to correlation, so that developers can quickly locate problems.
Improves the efficiency of positioning exception response problems, making it easier for developers to determine the problem of abnormal interfaces.
Smart Images

Figure CN114153712B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of request processing, and in particular to an exception processing method, apparatus, device and storage medium. Background Art
[0002] In a business system whose functions are implemented by microservice modules, a single application is composed of multiple loosely coupled and independently deployable smaller components or services. Developers can combine and deploy single services according to specific business needs to obtain a business system that corresponds to the business needs. The business system can be composed of multiple business modules implemented based on microservices.
[0003] For a request sent to a business system, a request will be processed and responded to by a business module in the business system. When the request receives an abnormal response in the business system, manual problem location is required. Manual location requires checking the logs of multiple business modules to find the business module where the problem occurs, which is inefficient. Summary of the invention
[0004] The present application provides an exception handling method, apparatus, device and storage medium to solve the technical problem of low efficiency caused by the need for manual problem location in existing exception responses.
[0005] In a first aspect, a method for handling an exception is provided, comprising:
[0006] Obtaining a tracking identifier of a target business request, where the target business request is a business request that has been processed by a business system and has a corresponding abnormal response;
[0007] According to the tracking identifier, obtaining time-related information corresponding to at least one business module in the business system that processes the target business request, wherein the time-related information corresponding to a business module includes time information generated by the business module processing the target business request;
[0008] Based on the time-related information corresponding to each of the at least one business module, suspected abnormal interface information corresponding to the target business request is generated, the suspected abnormal interface information including at least one first interface related to the abnormal response among the interfaces included in the at least one business module and abnormal information associated with each first interface, the at least one first interface and the abnormal information are arranged in the suspected abnormal interface information according to the relevance to the abnormal response, wherein the relevance is obtained based on the time-related information.
[0009] In this technical solution, by finding the time information generated when the business module that processes the target business request in the business system processes the target business request based on the tracking identifier of the target business request that generates an abnormal response in the business system, suspected abnormal interface information corresponding to the target business request is generated based on the time information. Since the suspected abnormal interface information contains interfaces related to the abnormal response, and these interfaces are arranged in the suspected abnormal interface information according to the relevance to the abnormal response, and the relevance is obtained based on the time information, it is equivalent to determining the degree of relevance between the business module that processes the target business request and the abnormal response based on the time information generated when the business module that processes the target business request processes the target business request. Therefore, generating the suspected abnormal interface information arranged by relevance can help developers quickly locate the business module with problems and improve positioning efficiency. In addition, according to the abnormal conditions associated with each interface in the suspected abnormal interface information, it can be convenient for developers to determine the problem of abnormal interface.
[0010] In combination with the first aspect, in a possible implementation method, obtaining time-related information corresponding to at least one business module in the business system that processes the target business request based on the tracking identifier includes: obtaining a module log corresponding to the tracking identifier from a log system based on the tracking identifier, the module log being used to record log information generated by the at least one business module processing the target business request, the log information including the time-related information; obtaining time-related information corresponding to each of the at least one business modules from the module log.
[0011] In combination with the first aspect, in a possible implementation, the target service request is a request whose processing delay in the service system is greater than a preset delay threshold, and the time-related information corresponding to one service module includes a first time and a second time corresponding to each interface in the one service module, the first time being the time when the interface receives the target service request, and the second time being the time when the interface responds to the target service request; generating suspected abnormal interface information corresponding to the target service request based on the time-related information corresponding to each of the at least one service modules includes: calculating the interface delay of the second interface based on the first time and the second time corresponding to the second interface, the second interface being any interface included in the at least one service module; calculating the difference between the interface delay of the second interface and the average processing delay corresponding to the second interface, to obtain the delay difference of the second interface; sorting the interfaces included in the at least one service module based on the delay difference of the interfaces included in the at least one service module, and obtaining the suspected abnormal interface information based on the sorted interfaces and the delay difference of the sorted interfaces. When the target business request is a slow request with a large processing delay, the delay difference of the target business request in each interface is determined. The delay difference reflects the difference between each interface processing the target business request and processing other requests. Sorting the interfaces according to the delay difference enables developers to prioritize interfaces with larger delays.
[0012] In combination with the first aspect, in a possible implementation method, the calculation of the difference between the interface delay of the second interface and the average processing delay corresponding to the second interface, before obtaining the delay difference of the second interface, also includes: obtaining a preset number of historical interface delays of the second interface, the historical interface delay being the length of time between the time when the second interface receives a service request in historical time and the time when it responds to the service request; averaging the preset number of historical interface delays to obtain the average processing delay corresponding to the second interface.
[0013] In combination with the first aspect, in a possible implementation, the target business request is a request that generates an error in the business system; the time-related information corresponding to one business module includes the log time corresponding to each interface in the one business module, and the log time is the time when the interface generates a log for processing the target business request; the suspected abnormal interface information corresponding to the target business request is generated according to the time-related information corresponding to each of the at least one business module, including: determining the interface whose error code is not a preset code among the interfaces respectively included in the at least one business module; sorting the interfaces whose error code is not a preset code according to the sequence of the log time, and obtaining the suspected abnormal interface information according to the sorted interfaces and the error codes corresponding to the sorted interfaces. Sorting the interfaces that generate errors by log time can help developers quickly find the interface that last had an error.
[0014] In combination with the first aspect, in a possible implementation, after generating the suspected abnormal interface information corresponding to the target business request according to the time-related information corresponding to each of the at least one business module, it also includes: determining the first frequency corresponding to each interface in the suspected abnormal interface information, the first frequency refers to the frequency that appears in the historical suspected abnormal interface information corresponding to the target business request and is in the first N bits in the historical suspected abnormal interface information, N is a positive integer greater than or equal to 1; in the suspected abnormal interface information, the interface whose first frequency is higher than the preset frequency threshold is highlighted. By highlighting the interface with a high abnormal frequency in the historical response in the suspected abnormal interface information, it can help developers quickly locate the interface with problems.
[0015] In combination with the first aspect, in a possible implementation, the method further includes: counting the second frequencies corresponding to the interfaces included in each business module in the business system, the second frequency refers to the frequency of occurrence in all suspected abnormal interface information generated in the business system; after sorting the interfaces included in each business module in the business system according to the second frequency, generating a statistical report on the interface response of the business system. By counting the frequency of occurrence of interfaces in the business system in the suspected abnormal interface information, sorting the interfaces according to the frequency of occurrence, and then generating a statistical report, it can help developers find business modules that often have problems, thereby improving the business modules.
[0016] In a second aspect, an exception handling device is provided, comprising:
[0017] An identification acquisition module, used to acquire a tracking identification of a target business request, wherein the target business request is a business request corresponding to an abnormal response in a business system;
[0018] An information acquisition module, configured to acquire, according to the tracking identifier, time-related information corresponding to at least one business module in the business system that processes the target business request, wherein the time-related information corresponding to a business module includes time information generated by the business module processing the target business request;
[0019] A generation module is used to generate suspected abnormal interface information corresponding to the target business request based on the time-related information corresponding to each of the at least one business module, the suspected abnormal interface information including at least one first interface related to the abnormal response in the at least one business module and abnormal information associated with each first interface, the at least one first interface and the abnormal information are arranged in the suspected abnormal interface information according to the relevance to the abnormal response, wherein the relevance is obtained based on the time-related information.
[0020] In a third aspect, a computer device is provided, comprising a memory and one or more processors, wherein the one or more processors are used to execute one or more computer programs stored in the memory, and when the one or more processors execute the one or more computer programs, the computer device implements the exception handling method of the first aspect.
[0021] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor executes the exception handling method of the first aspect.
[0022] The present application can achieve the following technical effects: according to the time information generated by the business module processing the target business request, the correlation degree between the business module processing the target business request and the abnormal response is determined. Therefore, generating suspected abnormal interface information arranged by correlation can help developers quickly locate the business module with problems and improve positioning efficiency. In addition, according to the abnormal conditions associated with each interface in the suspected abnormal interface information, it can be convenient for developers to determine the abnormal problem of the interface. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 A schematic diagram of the system architecture of a business system provided for this application;
[0024] Figure 2 A flowchart of an exception handling method provided in an embodiment of the present application;
[0025] Figure 3 It is a structural schematic diagram of an exception handling device provided in an embodiment of the present application;
[0026] Figure 4It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0027] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0028] The technical solution of this application can be applied to Figure 1 In the business system architecture shown. Figure 1 A schematic diagram of the system architecture of a business system provided in the present application, the business system architecture 10 may include a business system 101, a log system 102 and an external device 103. The external device 103 may be a user device (such as a mobile phone, a personal computer, etc.), and a client for accessing the business system 101 is installed in the external device 103, and the client may send a business request to the business system based on user needs; the business system 101 includes a system gateway 1011 and at least one business module 1012, and the system gateway 1011 is used to receive the business request sent by the external device 103, and forward the business request to the business module 1012 in the business system for processing. Optionally, the business module 1012 can be implemented based on microservice technology, and is used to process requests in the business system to realize certain business functions. The operation of the business module 1012 in the business system 101 generates a log, which records the operation information of the business module 1012, wherein the operation information includes but is not limited to the date, time, identification of the business module, and specific operation information of the business module; the business system 101 can send the log generated by the operation of the business module 1012 to the log system 102, and the log system 102 is used to store the logs of all business modules. Based on the business system 101, the log system 102 and the external device 103, the business system architecture 10 can also include a monitoring system 104 and an abnormal request positioning system 105, wherein the business system 101 can upload the interface delay generated by each business module 1012 processing the business request sent by the external device 103 to the monitoring system 104, and the monitoring system 104 is used to record and save the interface delay. The business system 101 can also report abnormal business requests that generate abnormal responses within the business system 101 to the abnormal request locating system 105. The abnormal request locating system 105 is used to generate abnormal analysis information related to the abnormal response based on the abnormal business requests reported by the business system 101 for developers to view.
[0029] based on Figure 1 The system architecture shown can realize the technical solution of the present application. The technical solution of the present application can be specifically implemented in the above-mentioned abnormal request locating system 105, which is specifically introduced below.
[0030] See also Figure 2 , Figure 2A flowchart of an exception handling method provided in an embodiment of the present application, wherein the method can be applied to the above Figure 1 In the abnormal request positioning system 105, as Figure 2 As shown, the method comprises the following steps:
[0031] S201, obtaining a tracking identifier of a target service request.
[0032] Here, the target business request refers to the business request that corresponds to the abnormal response in the business system, and the target business request can also be called an abnormal business request. Among them, the abnormal response corresponds to the normal response. The business request that generates a normal response refers to a business request that obtains a response from the business system within a preset timeout period and can obtain the required resources from the business system. Correspondingly, the business request that generates an abnormal response refers to a business request that does not obtain a response from the business system within a preset time, or does not obtain the required resources from the business system. Specifically, an abnormal business request can refer to a request whose processing delay in the business system is greater than a preset delay threshold, or it can refer to a request that generates an error in the business system, and so on, and is not limited to the description here.
[0033] In the embodiment of the present application, the tracking identifier refers to an identifier used to uniquely indicate the target service request in the service system, that is, an identifier that uniquely indicates the abnormal service request.
[0034] In a feasible implementation, the tracking identifier of the target service request may be sent by the service system, specifically, the service system may directly send the tracking identifier to the abnormal request location system; or the service system may carry the tracking identifier in the abnormal log corresponding to the target service request and send it to the abnormal request location system. Figure 1 The scheme of the system structure shown can be: when the system gateway 1011 detects that there is a business request that generates an abnormal response in the business system, it sends it to the abnormal request locating system 104. Among them, the tracking identifier of the target business request can be sent directly by the system gateway 1011 to the abnormal request locating system 105, or it can be sent by the system gateway to the abnormal request locating system 105 with it in the abnormal log corresponding to the target business request.
[0035] In the first possible scenario, the business system receives all business requests, monitors the processing delay of each business request in the business system, and compares the processing delay of each business request in the business system with the preset delay threshold corresponding to each business request, where different business requests may correspond to different preset delay thresholds, and the preset delay threshold corresponding to each business request may be preset in the background processing system by the developer according to the business type corresponding to the business request, so as to facilitate dynamic modification. When the business system receives a business request, the business system may determine the delay threshold of the business request according to the business type corresponding to the business request. If the processing delay corresponding to the target business request is greater than the preset delay threshold corresponding to the target business request, the business system determines that the target business request is an abnormal business request, and sends the log of the target business request in the business system (such as the system gateway) to the abnormal request positioning system.
[0036] Among them, the processing delay of a service request in a service system refers to the time between the time when the service system receives the service request and the time when the service request responds to the service request. The processing delay of a service request in a service system may be equal to the sum of the processing delays incurred by the service request at at least one service module of the service system for processing the service request. The processing delay incurred by a service request at a service module refers to the time between the time when the service module receives the service request and the time when the service module responds to the service request. The processing delay incurred by a service request at a service module may be equal to the sum of the interface delays of each interface in the service module for processing the service request. The interface delay of an interface processing a service request refers to the time between the time when the interface receives the service request and the time when the interface responds to the service request.
[0037] For example, there is a service request Q1, and the preset delay threshold corresponding to the service request Q1 is 1s. It is processed by service module A and service module B in the service system. Service module A includes interface a1 and interface a2, and service module B includes interface b1, interface b2 and interface b3. Interface a1 receives service request Q1 at 2021.10.1 12:00:00.000, responds to service request Q1 at 2021.10.1 12:00:00.167, and hands service request Q1 to interface a2 for processing; interface a2 responds to service request Q1 at 2021.10.112:00:00.355, and hands service request Q1 to interface b1 for processing; interface b1 responds to service request Q1 at 2021.10.1 12:00:00.670, and hands service request Q1 to interface b2 for processing; interface b2 responds to service request Q1 at 2021.10.1 12:00:00.960, and hands service request Q1 to interface b3 for processing, and interface b3 responds to service request Q1 at 12:00:01.096. The interface delay of interface a1 for processing service request Q1 is 167 microseconds (us), the interface delay of interface a2 for processing service request Q1 is 188us, and the processing delay of service request Q1 at service module A is 355us; the interface delay of interface b1 for processing service request Q1 is 315us, the interface delay of interface b2 for processing service request Q1 is 290us, the interface delay of interface b3 for processing service request Q1 is 130us, and the processing delay of service request Q1 at service module B is 741us; the processing delay of service request Q1 in the service system is 1096us (i.e. 1.096s), which is greater than the preset delay threshold 1s, then service request Q1 is an abnormal service request, i.e., a target service request.
[0038] Exemplarily, the exception log sent by the business system to the exception request location system may be as follows:
[0039] {"traceId":"134543213141","requestData":"test1","errorCode":"0"}; where traceId is the trace identifier of the business request, requestData is the resource requested by the business request, and errorCode is the error code information returned by the business system when processing the business request.
[0040] Optionally, when the business system monitors the processing delay of each business request at each interface in the business system, it may also send the interface delay of each business request at each interface of each business module to the monitoring system.
[0041] In the second possible situation, the business system receives all business requests, obtains the error code information returned by the business module in the business system when processing each business request, and if it is detected that the error code corresponding to the target business request is not a preset code, the business system determines that the target business request is an abnormal business request, and sends the log of the target business request in the business system (such as the system gateway) to the target business request location system 105. Exemplarily, the abnormal log sent by the business system to the abnormal request location system 105 may be as follows:
[0042] {"traceId":"134543213141","requestData":"test2","errorCode":"123"}
[0043] The preset code refers to the error code information returned by the service module in normal response to the service request, wherein the service module responds to the service request normally means that no error occurs when the service module processes the service request.
[0044] Optionally, the tracking identifier of the target service request can also be directly obtained by the abnormal request positioning system, wherein the abnormal request positioning system can sequentially read the log stored in the log system and the interface delay stored in the monitoring system, and when the abnormal service request is determined in the manner in which the above-mentioned service system determines whether the service request is an abnormal service request, the tracking identifier of the abnormal service request is read from the log system. Alternatively, the abnormal request positioning system is integrated with the service system, and when the service system detects an abnormal service request, the abnormal request positioning system obtains the tracking identifier of the abnormal service request.
[0045] This application does not limit the specific method of obtaining the tracking identifier of the target service request.
[0046] S202: Acquire, according to the tracking identifier of the target service request, time-related information corresponding to at least one service module in the service system that processes the target service request.
[0047] Among them, the time-related information corresponding to a business module includes the time information generated by a business module processing a target business request. The time information corresponding to a business module is not limited to the time when the business module receives and responds to the target business request, the time when each interface in the business module receives and responds to the target business request, the log time of the log generated by the business module processing the target business request, the log time of the log generated by each interface in the business module processing the abnormal response, the time when the business module completes processing the target business request and forwards it to another business module for processing, the time when the interface in the business module completes processing the target business request and forwards it to another interface for processing, etc., not limited to the description here.
[0048] For example, taking the target service request as the aforementioned service request Q1, for service module A, the corresponding time information includes: the time when interface a1 receives service request Q1 (2021.10.1 12:00:00.000), the time when interface a1 responds to service request Q1 (2021.10.1 12:00:00.167), the time when interface a forwards service request Q1 (2021.10.1 12:00:00.167), the time when interface a2 receives service request Q1 (2021.10.1 12:00:00.167), and the time when interface a2 responds to service request Q2 (2021.10.1 12:00:00.355), the time when interface a2 forwards business request Q2 (2021.10.112:00:00.355), the log time of the log recording the action of interface a1 processing business request Q1, and the log time of the log recording the action of interface a2 processing business request Q1.
[0049] In a specific implementation, a module log corresponding to the tracking identifier can be obtained from a log system according to the tracking identifier. The module log is used to record at least one business module that processes the target business request, log information generated when processing the target business request, and the log information includes all time information of the business module processing the target business request. Time-related information corresponding to each of the at least one business module processing the target business request is obtained from the module log.
[0050] S203: Generate suspected abnormal interface information corresponding to the target service request according to the time-related information corresponding to at least one service module in the service system that processes the target service request.
[0051] In an embodiment of the present application, the suspected abnormal interface information corresponding to the target business request includes at least one first interface and at least one first interface's respective associated abnormal information, wherein the first interface is an interface related to the abnormal response in the interface included in at least one business module that processes the target business request; the abnormal information associated with a first interface refers to the information related to the abnormal response generated by the first interface when processing the target business request. The at least one first interface and at least one first interface's respective associated abnormal information are arranged in the suspected abnormal interface information according to the relevance to the abnormal response, wherein the relevance of the first interface to the abnormal response is obtained based on the time-related information corresponding to at least one business module.
[0052] Specifically, when the target service request is an abnormal service request in the first case described in the aforementioned step S201, the time when each interface of each service module receives the target service request (hereinafter referred to as the first time) and the time when the target service request is responded to (hereinafter referred to as the second time) can be obtained, and then the suspected abnormal interface information corresponding to the target service request is generated according to the following steps:
[0053] J1. Calculate the interface delay of the second interface according to the first time and the second time corresponding to the second interface.
[0054] Here, the second interface can be any interface included in the service module that processes the target service request. Taking the target service request as the aforementioned service request Q1 as an example, the aforementioned interface a1, interface a2, interface b1, interface b2 or interface b3 can all be referred to as the second interface.
[0055] In a specific implementation, the time difference between the second time and the first time of the second interface may be calculated to obtain the interface delay of the second interface.
[0056] J2. Calculate the difference between the interface delay of the second interface and the average processing delay corresponding to the second interface to obtain the delay difference of the second interface.
[0057] Here, the average processing delay corresponding to the second interface refers to the average interface delay of the second interface in processing service requests in historical time / historical time period, reflecting the average delay of the second interface in processing service requests, which can be understood as the delay when processing service requests normally.
[0058] In some feasible implementations, a preset number of historical interface delays of the second interface may be obtained, the historical interface delay being the time between the time when the second interface receives a service request in a historical time / historical time period and the time when it responds to a service request, and the preset number of historical interface delays of the second interface are averaged to obtain the average processing delay corresponding to the second interface. For example, if the second interface is the aforementioned interface a1, the interface delays of the most recent five times before interface a1 processes the target service request may be obtained, and the average of the five interface delays may be calculated as the average processing delay of interface a1.
[0059] In other feasible implementations, multiple groups of historical interface delays can also be obtained based on a sliding window. The historical interface delays in each sliding window are first averaged to obtain the average interface delay corresponding to each sliding window, and then the average interface delays corresponding to each sliding window are averaged to obtain the average processing delay. For example, if the second interface is the aforementioned interface a1, the interface delays of the eight most recent times before interface a1 processes the target service request can be obtained, and the interface delays of the first eight to three times are used as a group of historical interface delays, the interface delays of the first seven to two times are used as a group of historical interface delays, and the interface delays of the first six to one time are used as a group of historical interface delays to obtain three groups of historical interface delays. The average interface delays of the three groups of historical interface delays are calculated respectively, and then the average interface delays of the three groups of historical interface delays are averaged to obtain the average processing delay of interface a1. The method of obtaining multiple groups of historical interface delays based on sliding windows can obtain an average processing delay that more accurately reflects the average delay of the interface in processing service requests.
[0060] In some other feasible implementations, a linear regression may be performed on the historical interface delay of the second interface to obtain a delay regression line reflecting the development and change of the historical interface delay of the second interface, and the interface delay on the delay regression line is used as the average processing delay corresponding to the second interface. This application does not limit the specific implementation method for determining the average processing delay corresponding to the second interface.
[0061] In a specific implementation manner, the abnormal request locating system may obtain a preset number of historical interface delays of the second interface from the monitoring system, and calculate the tie processing delay corresponding to the second interface.
[0062] J3. Sort the interfaces included in at least one service module according to the delay difference of the interfaces included in at least one service module, and obtain suspected abnormal interface information according to the sorted interfaces and the delay difference of the sorted interfaces.
[0063] Here, the delay difference corresponding to the interface reflects the difference between the delay when the interface processes the target service request and the delay when the interface processes the service request normally. The larger the delay difference, the larger the difference between the delay when the interface processes the target service request and the delay when the interface processes the service request normally, and the higher the possibility of an abnormality in the interface. The smaller the delay difference, the smaller the difference between the delay when the interface processes the target service request and the delay when the interface processes the service request normally, and the lower the possibility of an abnormality in the interface. Therefore, sorting the interfaces included in at least one business module according to the delay difference of the interfaces included in at least one business module is equivalent to sorting according to the possibility of the interface causing an abnormal response. The sorted interfaces can reflect the correlation between the interface and the abnormal response generated by the target service request in the business system.
[0064] In a specific implementation, according to the delay difference of the interfaces contained in at least one business module, the interfaces with larger delay difference can be arranged in front and the interfaces with smaller delay difference can be arranged in the back, so as to obtain the sorted interfaces; then the delay difference of the sorted interfaces is obtained, and combined with the sorted interfaces to obtain the suspected abnormal interface information. In this way, when locating the problem of abnormal response, the developer can preferentially locate the interface with larger delay difference, that is, locate the interface with higher correlation with abnormal response, which helps to quickly locate the problem of abnormal response.
[0065] For example, the modules that process the target service request are module D, module E, and module F. Module D has interface D1, module E has interface E1, and module F has interface F1. The delay differences between the interfaces before sorting are as follows:
[0066] {
[0067] Module D: Interface D1——3ms
[0068] Module E: Interface E1——5ms
[0069] Module F: Interface F1——-1ms
[0070] }
[0071] After sorting by delay difference, the sorted interfaces and the delay difference of the sorted interfaces are combined to obtain the suspected abnormal interface information as follows:
[0072] {
[0073] Module E: Interface E1——5ms
[0074] Module D: Interface D1——3ms
[0075] Module F: Interface F1——-1ms
[0076] }
[0077] Optionally, after sorting the interfaces included in at least one business module according to the delay difference of the interfaces included in at least one business module, the interfaces with a delay difference less than a preset threshold value can be removed from the sorted interfaces to obtain the removed interfaces; then, the suspected abnormal interface information is obtained according to the removed interfaces and the delay difference of the removed interfaces; or, the interfaces with a delay difference less than the preset threshold value can be removed first, and then the removed interfaces can be sorted. Alternatively, the present application can be excluded without limitation.
[0078] Specifically, when the target service request is an abnormal service request in the second case described in the aforementioned step S202, the log time of the log generated by each interface in the service module of each service module processing the abnormal target service request can be obtained. The log time refers to the time when the interface generates the log when processing the target service request. Then, the suspected abnormal interface information corresponding to the target service request is generated according to the following steps:
[0079] K1. Determine an interface whose error code is not a preset code among interfaces included in at least one business module.
[0080] Here, regarding the concept of the preset code, please refer to the above description and will not be repeated here.
[0081] K2. Sort the interfaces whose error codes are not preset codes according to the chronological order of the log times, and obtain suspected abnormal interface information according to the sorted interfaces and the error codes corresponding to the sorted interfaces.
[0082] Here, the order of log time reflects the order in which the interface processes the target business requests. Sorting the interfaces whose error codes are not preset codes according to the log time is equivalent to sorting them according to the order in which the interfaces are processed. The order in which the interface errors occur reflects the correlation between the interface and the abnormal response.
[0083] In a specific implementation, interfaces with earlier error codes that are not preset can be arranged in front according to the log time, and interfaces with later error codes that are not preset can be arranged in the back. In this way, when locating the problem of abnormal response, developers can preferentially locate the interface that first errors, that is, the interface with the highest correlation with the abnormal response, so that developers can solve the problem fundamentally.
[0084] For example, the modules that process the target business request are module D and module E, where module D has interface D2, module E has interface E2, and module F has interface F2. The preset code is 0, and the log time and error code information of each interface are as follows:
[0085] {
[0086] Module D: Interface D2——123 2021.10.1 12:00:00.333
[0087] Module E: Interface E2——0 2021.10.1 12:00:00.666
[0088] Module F: Interface F2——456 2021.10.1 12:00:00.108
[0089] }
[0090] Then, according to the order of log time, the interfaces whose error codes are not preset codes are sorted, and the sorted interfaces and their error codes are combined to obtain the suspected abnormal interface information as follows:
[0091] {
[0092] Module F: Interface F1——456 2021.10.1 12:00:00.108
[0093] Module D: Interface D2——123 2021.10.1 12:00:00.333
[0094] }
[0095] In the above Figure 2 In the corresponding technical solution, by finding the time information generated when the business module that processes the target business request in the business system processes the target business request according to the tracking identifier of the target business request corresponding to the abnormal response in the business system, the suspected abnormal interface information corresponding to the target business request is generated according to the time information. Since the suspected abnormal interface information contains interfaces related to the abnormal response, and these interfaces are arranged in the suspected abnormal interface information according to the relevance to the abnormal response, and the relevance is obtained based on the time information, it is equivalent to determining the degree of relevance between the business module that processes the target business request and the abnormal response according to the time information generated when the business module that processes the target business request processes the target business request. Therefore, generating the suspected abnormal interface information arranged by the relevance can help developers quickly locate the business module with problems and improve positioning efficiency. In addition, according to the abnormal conditions associated with each interface in the suspected abnormal interface information, it can be convenient for developers to determine the problem of abnormal interface.
[0096] Optionally, in some feasible implementations, after executing the above step S203, the following steps may also be executed:
[0097] L1. Determine the first frequency corresponding to each interface in the suspected abnormal interface information.
[0098] L2. In the suspected abnormal interface information, the interface whose first frequency is higher than the preset frequency threshold is highlighted.
[0099] Here, the first frequency corresponding to the interface refers to the frequency at which the interface in the suspected abnormal interface information appears in the historical suspected abnormal interface information corresponding to the target business request and is in the top N bits in the historical suspected abnormal interface information, where N is a positive integer greater than or equal to 1. Among them, the historical suspected abnormal interface information refers to the suspected abnormal interface information generated by processing the target business request in historical time. The first frequency corresponding to the interface can be equal to the ratio of the number of times the interface appears in the top N bits in the historical suspected abnormal interface information corresponding to the target business request to the total number of historical suspected abnormal interface information.
[0100] For example, N=1, the suspected abnormal interface information determined by step S203 is {a1, a2, b1, b2, b3}, and there are three groups of historical suspected abnormal interface information, namely {b1, a2, b2, b3, a1}, {a1, b3, b2, b1, a3}, and {b1, b2, a2, b3, a1}. The first frequency corresponding to b1 is 2 / 3, and the first frequency corresponding to a1 is 1 / 3.
[0101] If the interface information of suspected abnormalities in history is in the top N places, it means that it has a great relationship with the abnormal response in the historical time; if the frequency of the interface information of suspected abnormalities in history is greater than the preset frequency threshold, it means that the interface is likely to be the root cause of the abnormal response. By highlighting the interfaces with a high frequency of appearing in the top N places in the historical time, developers can quickly locate the root cause of the abnormal response.
[0102] In a specific implementation, the interface whose first frequency is higher than the preset frequency threshold may be highlighted by color highlighting, bold display, underline marking, etc.
[0103] Optionally, in some feasible implementations, the above method may further include the following steps:
[0104] G1, a second frequency corresponding to each interface included in each service module in the statistical service system;
[0105] G2. After sorting the interfaces included in each business module in the business system according to the second frequency, generate an interface response statistical report of the business system.
[0106] Here, the second frequency corresponding to the interface refers to the frequency of appearance in all suspected abnormal interface information generated in the business system, wherein all suspected abnormal interface information may include suspected abnormal interface information corresponding to multiple target business requests. The second frequency corresponding to the interface can be equal to the ratio of the number of times the interface appears in the suspected abnormal interface information to the total number of suspected abnormal interface information. It should be noted that the suspected abnormal interface information here refers to all suspected abnormal interface information generated in the business system.
[0107] By sorting the interfaces contained in each business module in the business system according to the second frequency corresponding to the interface, it is equivalent to sorting them according to the frequency of abnormal response of the interface. In the specific implementation, the interfaces with higher second frequency can be arranged in front, and the interfaces with lower second frequency can be arranged in the back, so that the interfaces with frequent abnormal responses are arranged in front, and the interface response statistics report is generated. It can help developers quickly find business modules that often have problems, so as to improve the business modules.
[0108] The method of the present application is introduced above. In order to better implement the method of the present application, the device of the present application is introduced next.
[0109] See also Figure 3 , Figure 3 is a schematic diagram of the structure of an exception handling device provided in an embodiment of the present application. The exception handling device may be a part of the target service request positioning system. Figure 3 As shown, the exception handling device 30 includes:
[0110] The identification acquisition module 301 is used to acquire the tracking identification of the target business request, where the target business request is the business request corresponding to the abnormal response in the business system;
[0111] An information acquisition module 302 is used to acquire, according to the tracking identifier, time-related information corresponding to at least one business module in the business system that processes the target business request, wherein the time-related information corresponding to a business module includes time information generated by the business module processing the target business request;
[0112] A generation module 303 is used to generate suspected abnormal interface information corresponding to the target business request based on the time-related information corresponding to each of the at least one business module, wherein the suspected abnormal interface information includes at least one first interface related to the abnormal response in the at least one business module and abnormal information associated with each first interface, and the at least one first interface and the abnormal information are arranged in the suspected abnormal interface information according to the relevance to the abnormal response, wherein the relevance is obtained based on the time-related information.
[0113] In one possible design, the above-mentioned information acquisition module 302 is specifically used to: obtain the module log corresponding to the tracking identifier from the log system according to the tracking identifier, and the module log is used to record the log information generated by the at least one business module log processing the target business request, and the log information includes the time-related information; obtain the time-related information corresponding to each of the at least one business modules from the module log.
[0114] In a possible design, the target service request is a request whose processing delay in the service system is greater than a preset delay threshold, and the time-related information corresponding to the one service module includes the first time and the second time corresponding to each interface in the one service module, the first time being the time when the interface receives the target service request, and the second time being the time when the interface responds to the target service request; the above-mentioned generation module 303 is specifically used to: calculate the interface delay of the second interface according to the first time and the second time corresponding to the second interface, the second interface being any interface included in the at least one service module; calculate the difference between the interface delay of the second interface and the average processing delay corresponding to the second interface to obtain the delay difference of the second interface; sort the interfaces included in the at least one service module according to the delay difference of the interfaces included in the at least one service module, and obtain the suspected abnormal interface information according to the sorted interfaces and the delay difference of the sorted interfaces.
[0115] In one possible design, the generation module 303 is also used to: obtain a preset number of historical interface delays of the second interface, where the historical interface delay is the length of time between the time when the second interface receives a service request in historical time and the time when it responds to the service request; and average the preset number of historical interface delays to obtain an average processing delay corresponding to the second interface.
[0116] In one possible design, the target business request is a request that generates an error in the business system; the time-related information corresponding to one business module includes the log time corresponding to each interface in the one business module, and the log time is the time when the interface generates a log for processing the target business request; the generation module 303 is specifically used to: determine the interface whose error code is not a preset code among the interfaces included in at least one business module; sort the interfaces whose error code is not a preset code according to the log time, and obtain the suspected abnormal interface information according to the sorted interfaces and the error code corresponding to the sorted interfaces.
[0117] In a possible design, the above-mentioned exception handling device 30 also includes a marking module 304, which is used to: determine the first frequency corresponding to each interface in the suspected abnormal interface information, where the first frequency refers to the frequency that appears in the historical suspected abnormal interface information corresponding to the abnormal request and is in the first N bits in the historical suspected abnormal interface information, where N is a positive integer greater than or equal to 1; and highlight the interface whose first frequency is higher than a preset frequency threshold in the suspected abnormal interface information.
[0118] In a possible design, the above-mentioned generation module 305 is also used to: count the second frequencies corresponding to the interfaces included in each business module in the business system, where the second frequency refers to the frequency of appearance in all suspected abnormal interface information generated in the business system; after sorting the interfaces included in each business module in the business system according to the second frequency, generate an interface response statistical report of the business system.
[0119] It should be noted that Figure 3 For details not mentioned in the corresponding embodiments, please refer to the aforementioned Figure 2 The description of the method embodiment will not be repeated here.
[0120] The above-mentioned device finds the time information generated when the business module that processes the target business request in the business system processes the target business request according to the tracking identifier of the target business request corresponding to the abnormal response in the business system, and generates suspected abnormal interface information corresponding to the target business request according to the time information. Since the suspected abnormal interface information contains interfaces related to the abnormal response, and these interfaces are arranged in the suspected abnormal interface information according to the relevance to the abnormal response, and the relevance is obtained based on the time information, it is equivalent to determining the degree of correlation between the business module that processes the target business request and the abnormal response according to the time information generated when the business module that processes the target business request processes the target business request. Therefore, generating suspected abnormal interface information arranged by relevance can help developers quickly locate the business module with problems and improve positioning efficiency.
[0121] See also Figure 4 , Figure 4 4 is a schematic diagram of a computer device provided in an embodiment of the present application, wherein the computer device 40 includes a processor 401 and a memory 402. The processor 401 is connected to the memory 402, for example, the processor 401 may be connected to the memory 402 via a bus.
[0122] The processor 401 is configured to support the computer device 40 to perform the corresponding functions in the method in the above method embodiment. The processor 401 can be a central processing unit (CPU), a network processor (NP), a hardware chip or any combination thereof. The above hardware chip can be an application specific integrated circuit (ASIC), a programmable logic device (PLD) or a combination thereof. The above PLD can be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof.
[0123] The memory 402 is used to store program codes, etc. The memory 402 may include a volatile memory (VM), such as a random access memory (RAM); the memory 302 may also include a non-volatile memory (NVM), such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD); the memory 402 may also include a combination of the above-mentioned types of memories.
[0124] The processor 401 may call the program code to perform the following operations:
[0125] Obtaining a tracking identifier of a target business request, where the target business request is a business request that has been processed by a business system and has a corresponding abnormal response;
[0126] According to the tracking identifier, obtaining time-related information corresponding to at least one business module in the business system that processes the target business request, wherein the time-related information corresponding to a business module includes time information generated by the business module processing the target business request;
[0127] Based on the time-related information corresponding to each of the at least one business module, suspected abnormal interface information corresponding to the target business request is generated, the suspected abnormal interface information including at least one first interface related to the abnormal response among the interfaces included in the at least one business module and abnormal information associated with each first interface, the at least one first interface and the abnormal information are arranged in the suspected abnormal interface information according to the relevance to the abnormal response, wherein the relevance is obtained based on the time-related information.
[0128] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a computer, the computer executes the method described in the above embodiment.
[0129] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0130] The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. An exception handling method, characterized in that: include: Obtaining a tracking identifier of a target business request, wherein the target business request is a business request that has been processed by a business system and has a corresponding abnormal response; According to the tracking identifier, obtaining time-related information corresponding to at least one business module in the business system that processes the target business request, wherein the time-related information corresponding to a business module includes time information generated by the business module processing the target business request; Generate suspected abnormal interface information corresponding to the target service request according to the time-related information corresponding to each of the at least one service module, the suspected abnormal interface information including at least one first interface related to the abnormal response and abnormal information associated with each first interface among the interfaces respectively included in the at least one service module, the at least one first interface and the abnormal information being arranged in the suspected abnormal interface information according to the degree of relevance to the abnormal response, wherein the degree of relevance is obtained based on the time-related information; in, If the target service request is a service request whose processing delay in the service system is greater than a preset delay threshold, the time-related information corresponding to one service module includes a first time and a second time corresponding to each interface in the one service module, the first time being the time when the interface receives the target service request, and the second time being the time when the interface responds to the target service request, then generating the suspected abnormal interface information corresponding to the target service request according to the time-related information corresponding to each of the at least one service module includes: Calculate the interface delay of the second interface according to the first time and the second time corresponding to the second interface, where the second interface is any interface included in the at least one service module; Calculate the difference between the interface delay of the second interface and the average processing delay corresponding to the second interface to obtain the delay difference of the second interface; According to the delay difference of the interface respectively included in the at least one service module, the interfaces respectively included in the at least one service module are sorted, and according to the sorted interfaces and the delay difference of the sorted interfaces, the suspected abnormal interface information is obtained; If the target service request is a request that generates a response error in the service system, the time-related information corresponding to the one service module includes the log time corresponding to each interface in the one service module, and the log time is the time when the interface generates a log when processing the target service request, then generating the suspected abnormal interface information corresponding to the target service request according to the time-related information corresponding to each of the at least one service module includes: Determining, among the interfaces respectively included in the at least one service module, an interface whose error code is not a preset code; According to the chronological order of the log times, the interfaces whose error codes are not preset codes are sorted, and the suspected abnormal interface information is obtained according to the sorted interfaces and the error codes corresponding to the sorted interfaces.
2. The method according to claim 1, characterized in that The acquiring, according to the tracking identifier, time-related information corresponding to at least one service module in the service system that processes the target service request comprises: According to the tracking identifier, obtaining a module log corresponding to the tracking identifier from a log system, wherein the module log is used to record log information generated by the at least one service module processing the target service request, and the log information includes the time-related information; The time-related information corresponding to each of the at least one service module is obtained from the module log.
3. The method according to claim 1, characterized in that Before calculating the difference between the interface delay of the second interface and the average processing delay corresponding to the second interface to obtain the delay difference of the second interface, the method further includes: Obtain a preset number of historical interface delays of the second interface, where the historical interface delay is the duration between the time when the second interface receives a service request in historical time and the time when it responds to the service request; The preset number of historical interface delays are averaged to obtain an average processing delay corresponding to the second interface.
4. The method according to any one of claims 1 to 3, characterized in that: After generating the suspected abnormal interface information corresponding to the target service request according to the time related information corresponding to each of the at least one service module, the method further includes: Determine a first frequency corresponding to each interface in the suspected abnormal interface information, where the first frequency refers to a frequency that appears in the historical suspected abnormal interface information corresponding to the target service request and is in the first N bits in the historical suspected abnormal interface information, where N is a positive integer greater than or equal to 1; In the suspected abnormal interface information, the interface whose first frequency is higher than the preset frequency threshold is highlighted.
5. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: Counting the second frequencies corresponding to the interfaces included in each business module in the business system, where the second frequencies refer to the frequencies appearing in all suspected abnormal interface information generated in the business system; After sorting the interfaces included in each business module in the business system according to the second frequency, an interface response statistical report of the business system is generated.
6. An exception handling device, characterized in that: include: An identification acquisition module, used to acquire a tracking identification of a target business request, wherein the target business request is a business request corresponding to an abnormal response in a business system; An information acquisition module, configured to acquire, according to the tracking identifier, time-related information corresponding to at least one business module in the business system that processes the target business request, wherein the time-related information corresponding to a business module includes time information generated by the business module processing the target business request; A generating module, configured to generate suspected abnormal interface information corresponding to the target service request according to the time-related information corresponding to each of the at least one service module, wherein the suspected abnormal interface information includes at least one first interface related to the abnormal response in the at least one service module and abnormal information associated with each first interface, wherein the at least one first interface and the abnormal information are arranged in the suspected abnormal interface information according to the degree of relevance to the abnormal response, wherein the degree of relevance is obtained based on the time-related information; The target service request is a service request whose processing delay in the service system is greater than a preset delay threshold, and the time-related information corresponding to one service module includes a first time and a second time corresponding to each interface in the one service module, the first time is the time when the interface receives the target service request, and the second time is the time when the interface responds to the target service request, and the suspected abnormal interface information corresponding to the target service request is generated according to the time-related information corresponding to each of the at least one service module, including: Calculate the interface delay of the second interface according to the first time and the second time corresponding to the second interface, where the second interface is any interface included in the at least one service module; Calculate the difference between the interface delay of the second interface and the average processing delay corresponding to the second interface to obtain the delay difference of the second interface; According to the delay difference of the interface respectively included in the at least one service module, the interfaces respectively included in the at least one service module are sorted, and according to the sorted interfaces and the delay difference of the sorted interfaces, the suspected abnormal interface information is obtained; or, The target business request is a request that generates a response error in the business system, the time-related information corresponding to one business module includes log time corresponding to each interface in the one business module, the log time is the time when the interface generates a log when processing the target business request, and the generating of suspected abnormal interface information corresponding to the target business request according to the time-related information corresponding to each of the at least one business module includes: Determining, among the interfaces respectively included in the at least one service module, an interface whose error code is not a preset code; According to the chronological order of the log times, the interfaces whose error codes are not preset codes are sorted, and the suspected abnormal interface information is obtained according to the sorted interfaces and the error codes corresponding to the sorted interfaces.
7. A computer device, characterized in that: The method comprises a memory and a processor, wherein the processor is used to execute one or more computer programs stored in the memory, and when the processor executes the one or more computer programs, the computer device implements the method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor is caused to perform the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Service exception detection method and device and storage medium
CN109818787A
Information processing method and related device
CN112148508A