A method, device, electronic device and storage medium for locating a problem interface
By obtaining the client fault information and ID, searching the server interface log and simulating the client request, the server interface problem is determined, which solves the problem of long positioning time caused by manual debugging in the existing technology and improves the efficiency of interface problem positioning.
Patent Information
- Application Number
- CN202210191467.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-28
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2042-02-28
AI Technical Summary
The existing technology requires manual debugging when locating server interface problems, which takes a long time and reduces the efficiency of locating problem interfaces.
By obtaining the basic fault information and ID information fed back by the client, search the access log of the server interface, simulate the client to initiate an http request based on the debugging mode, obtain the debugging log information of the call chain, and find the target log information of the error code to determine the problem. interface.
There is no need for developers to debug the service interface code online, saving manpower and time, and improving the efficiency of locating problematic interfaces.
Smart Images

Figure CN114567543B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and more specifically, to a method, device, electronic device and storage medium for locating a problem interface. Background Art
[0002] With the vigorous development of mobile Internet, various backend services have emerged, and there is data interaction between many backend services. In this complex, multi-level microservice software technology architecture, once the client-facing server interface responds abnormally, that is, the access data returned by the server interface is abnormal, it will affect the normal operation of the entire architecture. Therefore, when it is detected that the access data returned by the server interface is abnormal, it is necessary to quickly locate the problematic server interface and feedback it to the corresponding developer.
[0003] The existing technology for locating problematic interfaces is as follows: the technical staff who directly faces the client service finds the corresponding request information in the request access log based on the client feedback, or finds the request information after reproducing the client problem using a network proxy tool (such as Charles), uses the local startup project to switch to the online environment to debug the request information, and locates the problematic server interface by online debugging of the program code of the service interface. However, if the downstream service response content is found to have a problem based on the request information, the technical staff responsible for the downstream service needs to switch to the online environment to debug the downstream service, and then perform online debugging of the program code of the service interface again.
[0004] When locating a problem interface in the prior art, a technician is required to perform manual positioning, so the problem interface positioning time is relatively long, the entire process is time-consuming and labor-intensive, and the efficiency of problem interface positioning is reduced. Summary of the invention
[0005] In view of this, the present invention discloses a method, device, electronic device and storage medium for locating a problem interface, so as to locate the interface problem by reproducing the process of a client initiating an HTTP request in a debugging mode. There is no need for developers to perform online debugging of the program code of the service interface, which saves manpower and positioning time. The whole process saves time and effort, thereby improving the efficiency of locating the problem interface.
[0006] A method for locating a problem interface, applied to a server, the method comprising:
[0007] Obtaining basic fault information and ID information fed back by the client when the function is abnormal, wherein the basic fault information at least includes: function classification and fault occurrence time point, and the ID information includes: client ID;
[0008] Find the corresponding server interface according to the functional classification;
[0009] Find the access log of the device corresponding to the client ID accessing the server interface according to the time point of the failure;
[0010] Determine the corresponding http request according to the access log;
[0011] Based on the debug mode, simulate the client to initiate the http request again to obtain the debug log information of all server interfaces in the call chain;
[0012] Target debugging log information with an error code is found from all the debugging log information, and the server interface corresponding to the target debugging log information is determined as the problem interface.
[0013] Optionally, when the user logs in at the client, the ID information also includes: a logged-in user ID.
[0014] Optionally, the debugging mode-based simulation client re-initiates the http request to obtain debugging log information of all server interfaces in the call chain, including:
[0015] An httpheader capable of triggering the debugging mode is added to the http request, simulating the client to initiate the http request again, and obtaining the debugging log information of all server interfaces of the call chain.
[0016] Optionally, the fields of the debug log information include: seqId, nodeId, parentNodeId, nodeName, nodeParams and nodeResult;
[0017] The seqId is used to represent the unique link identifier, which is used to identify this http request so as to associate each sub-call with the initial http request;
[0018] The nodeId is used to represent a node in a link, and one link represents an http request initiated by a client;
[0019] The parentNodeId is used to associate two adjacent calls;
[0020] The nodeName is used to indicate the node name in the link;
[0021] The nodeParams is used to indicate the path and parameters of the node in the link.
[0022] The nodeResult is used to indicate the response content of the node in the link to this request, so as to quickly locate the problem.
[0023] Optionally, the node relationship in the link includes: a child node relationship and a follower node relationship, wherein the child node relationship and the follower node relationship represent a direct causal relationship between a child node and a parent node;
[0024] When the parent node depends on the return result of the child node, the parent node and the child node form the child node relationship;
[0025] When the parent node does not depend on the return result of the child node, the follower node relationship is formed between the parent node and the child node.
[0026] Optionally, also include:
[0027] Output and display the problem interface.
[0028] A device for locating a problem interface, applied to a server, the device comprising:
[0029] A first acquisition unit is used to acquire basic fault information and ID information fed back by the client when the function is abnormal, wherein the basic fault information at least includes: function classification and fault occurrence time point, and the ID information includes: client ID;
[0030] An interface search unit, used to search for a corresponding server interface according to the functional classification;
[0031] A log search unit, used to search for the access log of the device corresponding to the client ID accessing the server interface according to the time point of the fault occurrence;
[0032] A request determining unit, used to determine a corresponding http request according to the access log;
[0033] The second acquisition unit is used to simulate the client to initiate the http request again based on the debugging mode to obtain the debugging log information of all server interfaces of the call chain;
[0034] The problem interface determination unit is used to find the target debugging log information with an error code from all the debugging log information, and determine the server interface corresponding to the target debugging log information as the problem interface.
[0035] Optionally, the second acquiring unit is specifically configured to:
[0036] An httpheader capable of triggering the debugging mode is added to the http request, simulating the client to initiate the http request again, and obtaining the debugging log information of all server interfaces of the call chain.
[0037] An electronic device comprising a memory and a processor;
[0038] The memory is used to store at least one instruction;
[0039] The processor is used to execute the at least one instruction to implement the method for locating the problematic interface described above.
[0040] A computer-readable storage medium stores at least one instruction, and when the at least one instruction is executed by a processor, the method for locating a problematic interface described above is implemented.
[0041] As can be seen from the above technical solutions, the present invention discloses a method, device, electronic device and storage medium for locating a problem interface, obtains basic fault information and ID information fed back by the client when the function is abnormal, and the basic fault information at least includes: function classification and fault occurrence time point, finds the corresponding server interface according to the function classification, finds the access log of the device corresponding to the client ID accessing the server interface according to the fault occurrence time point, determines the corresponding http request according to the access log, simulates the client to initiate the http request again based on the debugging mode, obtains the debugging log information of all server interfaces in the call chain, finds the target debugging log information with error code from all the debugging log information, and determines the server interface corresponding to the target debugging log information as the problem interface. The present invention locates the interface problem by reproducing the process of the client initiating the http request through the debugging mode, and does not require the developer to debug the program code of the service interface online, which saves manpower and positioning time, and the whole process saves time and effort, thereby improving the efficiency of locating the problem interface. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the disclosed drawings without paying creative work.
[0043] Figure 1 A flow chart of a method for locating a problem interface disclosed in an embodiment of the present invention;
[0044] Figure 2 A service dependency graph disclosed in an embodiment of the present invention;
[0045] Figure 3 A schematic diagram of a link disclosed in an embodiment of the present invention;
[0046] Figure 4 A simplified link diagram disclosed in an embodiment of the present invention;
[0047] Figure 5 Another link schematic diagram disclosed in an embodiment of the present invention;
[0048] Figure 6 A schematic diagram of a debug log information field disclosed in an embodiment of the present invention;
[0049] Figure 7 A visual view of a call chain disclosed in an embodiment of the present invention;
[0050] Figure 8 A playback function dependency graph disclosed in an embodiment of the present invention;
[0051] Fig. 9 A schematic diagram of the structure of a device for locating a problem interface disclosed in an embodiment of the present invention;
[0052] Fig.10 The present invention is a schematic diagram of the structure of an electronic device disclosed in an embodiment of the present invention. DETAILED DESCRIPTION
[0053] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0054] The embodiment of the present invention discloses a method, device, electronic device and storage medium for locating a problem interface, which obtains basic fault information and ID information fed back by a client when the function is abnormal, wherein the basic fault information at least includes: function classification and time point of fault occurrence, finds the corresponding server interface according to the function classification, finds the access log of the device corresponding to the client ID accessing the server interface according to the time point of fault occurrence, determines the corresponding http request according to the access log, simulates the client to initiate the http request again based on the debugging mode, obtains the debugging log information of all server interfaces of the call chain, finds the target debugging log information with an error code from all the debugging log information, and determines the server interface corresponding to the target debugging log information as the problem interface. The present invention locates the interface problem by reproducing the process of the client initiating the http request through the debugging mode, and does not require the developer to debug the program code of the service interface online, which saves manpower and positioning time, and the whole process saves time and effort, thereby improving the efficiency of locating the problem interface.
[0055] See also Figure 1 , a flow chart of a method for locating a problem interface disclosed in an embodiment of the present invention, the locating method is applied to a server, and the locating method includes:
[0056] Step S101, obtaining basic fault information and ID information fed back by the client when the function is abnormal;
[0057] The client device may be: iPhone, aPhone, iPad, PC browser, mobile browser, etc. The client in this embodiment refers to the system running on the client device, such as Mango TV website, App, etc.
[0058] The client in this embodiment has a problem feedback function. When a function of the client used by the user is abnormal, the user can submit basic fault information and ID information on the problem feedback function interface.
[0059] The basic fault information at least includes: function classification and fault occurrence time. In practical applications, the basic fault information may also include: function description, etc., depending on actual needs.
[0060] In this embodiment, the ID information includes: client ID. When the user logs in at the client, the ID information may also include: login user ID.
[0061] It should be noted that the present invention locates the problem interface by the server end. The server end is an interface system that provides business data to the client end, such as a channel, on-demand play, live play and other server end systems.
[0062] The server's direct dependencies are multi-layered, see Figure 2 The service dependency graph shown includes: client, gateway, server interface 1, server interface 2, server interface 3, and server interface 4. Each server interface supports debug mode access. The debug mode is triggered by adding a new httpheader, such as X-Mgtv-Debug:info. At the same time, the client will generate a globally unique seqId (link unique identifier) and pass it to the backend service as a parameter. The X-Mgtv-Debug and seqId parameters of the httpheader will be passed to the downstream dependent services. Therefore, once the client-facing server interface 1 enters the debug mode, all subsequent server interfaces (server interface 2, server interface 3, and server interface 4) that the server interface 1 depends on will enter the debug mode.
[0063] Step S102: Find the corresponding server interface according to the functional classification;
[0064] In actual applications, different functional categories correspond to different server interfaces. For example, if the functional category is: video playback, the corresponding server interface is: video serialization interface.
[0065] Step S103, finding the access log of the device corresponding to the client ID accessing the server interface according to the time point of the fault occurrence;
[0066] It should be noted that when the user uses the client function normally or when an abnormality occurs in the function, the client will request the server interface. After receiving the client's interface request, the server will record the access logs of all requests (including the request domain name, interface address, ID information, etc.) and the corresponding access time. Therefore, according to the time point of the failure, the access log of the device corresponding to the client ID accessing the server interface is found. For example, the time point of the failure is 2021-12-07 12:00:00, and the server interface is: video serial interface, then the access log of the device corresponding to the client ID accessing the video serial interface is found.
[0067] Step S104: determining the corresponding http request according to the access log;
[0068] The http request corresponding to the access log is the http request sent by the client to the server before an abnormality occurs when the user uses the client function.
[0069] Step S105, based on the debug mode simulation client re-initiates the http request to obtain the debug log information of all server interfaces in the call chain;
[0070] In this embodiment, the problem location background of the server adds an httpheader that can trigger the debugging mode to the http request, simulates the client to initiate the http request again, and obtains the debugging log information of all server interfaces of the call chain.
[0071] Among them, httpheader represents the http header.
[0072] It should be noted that the problem locating background described in the present invention is an interface operation management system for problem locating personnel to quickly locate problems.
[0073] After the problem location backend receives the problem feedback submitted by the user on the client: function classification, function description, time of fault occurrence and other information, it finds the corresponding service interface according to the function classification, finds the access log of the interface of the user device according to the time of occurrence, and replays the request in debug mode (adding the httpheader of X-Mgtv-Debug), the debug log information of all service interfaces on the link is stored. After log analysis, the debug log information is provided to the problem location in the form of an interface and then displayed graphically. When the problem location personnel receive user feedback, they can quickly locate the problematic service or method by viewing the graphical debug log information in the problem location backend.
[0074] In actual applications, after the problem location personnel find the problematic http request in the problem location background, they click the debug button. After the problem location background adds an httpheader that can trigger the debug mode to the http request, the simulated client initiates the http request again.
[0075] The server collects debug log information of all server interfaces in debug mode. The debug log information mainly includes the execution status of important methods, third-party services or third-party components. The concepts of debug log information include: links and nodes.
[0076] Step S106: Find the target debugging log information with an error code from all the debugging log information, and determine the server interface corresponding to the target debugging log information as the problem interface.
[0077] When a server interface fails, an error code will appear in the debug log information corresponding to the server interface. Therefore, by finding the target debug log information with the error code, the problem interface can be determined, and the problem interface is also the failed server interface.
[0078] In summary, the present invention discloses a method for locating a problem interface, obtaining basic fault information and ID information fed back by a client when the function is abnormal, wherein the basic fault information at least includes: function classification and time point of the fault occurrence, finding the corresponding server interface according to the function classification, finding the access log of the device accessing the server interface corresponding to the client ID according to the time point of the fault occurrence, determining the corresponding http request according to the access log, simulating the client to initiate the http request again based on the debugging mode, obtaining the debugging log information of all server interfaces of the call chain, finding the target debugging log information with the error code from all the debugging log information, and determining the server interface corresponding to the target debugging log information as the problem interface. The present invention locates the interface problem by reproducing the process of the client initiating the http request through the debugging mode, without the need for the developer to debug the program code of the service interface online, saving manpower and positioning time, and the whole process is time-saving and labor-saving, thereby improving the efficiency of locating the problem interface.
[0079] In the present invention, in the concept of debug log information, a link is the execution process of a client http request in a microservice architecture system. A link is a directed acyclic graph (DAG) composed of multiple nodes, and each node represents a continuous execution segment in the link that is named and records debug log information.
[0080] When a client initiates an HTTP request, it is considered a link. Figure 3, a link diagram disclosed in an embodiment of the present invention, the entire link includes: client, load balancing, permission service, order service and resource service, among which, API (Application Programming Interface, application program interface), RPC (Remote Procedure Call, remote procedure call), the whole process is as follows:
[0081] 1) When a user operates a certain function on the client, an HTTP request is initiated to the load balancing and backend service to interact and obtain dynamic data;
[0082] 2) Load balancing first initiates an RPC call to the permission service;
[0083] 3) Permission service RPC response permission data;
[0084] 4) Load balancing then initiates an RPC call to the order service;
[0085] 5) Order service RPC responds with order data;
[0086] 6) Load balancing requests resource services through the resource service API;
[0087] 7) Resource service API responds with specific resource content;
[0088] 8) After load balancing integrates permission data, order data and resource content, it returns it to the client for logical processing.
[0089] Will Figure 3 After the semantic modification of links and nodes is completed, visualization is performed to obtain Figure 4 The link diagram shown includes several modules: client calling process, load balancing calling process, permission service process, order service process, resource allocation and provision process, container initialization, storage space allocation and startup script execution. Each module represents a node, and a node represents a logical operating unit in the system. Logical causal relationships are established between nodes through nesting or sequential arrangement.
[0090] See also Figure 5 In the link diagram, in addition to the root node, the link also includes eight nodes, namely: node A, node B, node C, node D, node E, node F, node G and node H, among which node C is the child node of node A, and node G is called after node F.
[0091] A node may have a causal relationship with one or more nodes. The present invention defines two types of node relationships: a child node relationship and a follower node relationship. These two types of node relationships represent the direct causal relationship between a child node and a parent node.
[0092] When a parent node depends on the return result of a child node, a child node relationship is formed between the parent node and the child node. For example, in a function call, the called node is the child of the caller. For example, in an RPC call, the server node is the child of the client node. Many concurrent calls and operations that aggregate the results form a child node relationship.
[0093] If the parent node does not depend on the return result of the child node, then it can be said that the parent node and the child node form a follower node relationship.
[0094] Each node will have debugging log information, and the direct relationship between nodes and the execution status of nodes are output through log information. The fields of debugging log information are: seqId, nodeId, parentNodeId, nodeName, nodeParams and nodeResult.
[0095] by Figure 6 Explain the debug log information fields as an example.
[0096] collector: collect.
[0097] seqId: The unique link identifier generated by the client and sent to the server. It is used to identify this http request and to associate each sub-call with the initial http request. For example, Figure 6 traceId: 123.
[0098] nodeId: Figure 6 The 0, 1, 1.1, 2 in are used to represent the nodes in the link.
[0099] parentNodeId: For example, if the nodeId of b calling d is 1.1, then its parentNodeId is the nodeId of a calling b, which is 1. It is used to associate two adjacent calls.
[0100] nodeName: used to indicate the node name in the link.
[0101] nodeParams: used to indicate the path and parameters of the node in the link for this request, which facilitates replaying the request and assists in locating the problem.
[0102] nodeResult is used to indicate the path and parameters of the node in the link for this request, which facilitates replaying the request and assists in locating the problem.
[0103] The log information of each call collected by the log is shown in Table 1:
[0104] Table 1
[0105]
[0106] According to the information in Table 1, a visual view of the call chain can be drawn, such as Figure 7 As shown, from Figure 7 You can view the input parameters and response results of each node.
[0107] In actual applications, log collection is divided into two situations: automatic collection and manual collection.
[0108] Java language can use javaagent to realize the automatic collection of node debugging log information, so as to achieve non-intrusiveness to the code.
[0109] The present invention also analyzes the collected log information. Log analysis is to organize the collected system information, connect the debugging log information of all nodes of an http request in series through seqId, and provide an interface for problem location background graphical display.
[0110] To further optimize the above embodiment, after step S106, the following may also be included:
[0111] Output and display the problem interface.
[0112] To facilitate understanding of the problem interface location process disclosed in the present invention, the present invention provides a specific embodiment as follows:
[0113] Taking the video playback function as an example, when a user uses the video playback function on the client, he will request the video string retrieval interface of the backend playback service and respond to the content to play the video.
[0114] The video string retrieval API relies on the backend payment authentication service and string retrieval service, while the string retrieval service relies on the media asset basic service.
[0115] The playback function dependency diagram is shown in Figure 8:
[0116] When a user fails to play the video on the client, the video serial interface responds to the client with the following content:
[0117] {
[0118] "code": "10002",
[0119] "msg": "Failed to obtain video information",
[0120] "code":null,
[0121] }
[0122] Since the normal video playback function cannot be used, the basic fault information filled in by the user on the client's problem feedback interface is as follows:
[0123] Functional classification: video playback
[0124] Function description: Error message when playing video
[0125] Failure time: 2021-12-07 12:00:00
[0126] The client sends the basic fault information and ID information to the server. The ID information includes: client ID. When the user logs in to the client, the ID information may also include: login user ID.
[0127] After receiving the basic fault information and ID information sent by the client, the server-side problem location backend finds the corresponding server-side interface as the video string retrieval interface of the playback service: video / source according to the functional classification: video playback. Then, from the request log of the playback service, according to the fault occurrence time 2021-12-07 12:00:00, the access log of the video string retrieval interface is found. According to the access log, the corresponding video / source interface request (http request) at 2021-12-07 12:00:00 is determined. The request information is as follows:
[0128] curl-H'Host:www.mgtv.com'-H'Accept:* / *'
[0129] 'http: / / www.mgtv.com / video / source?videoId=10000&seqId=21d75611017043108abb4882fd8d5835&did=836e02fce4fd87ff636eb68ac17cde806be51906'
[0130] Among them, videoId is the unique identifier of the video, seqId is the unique identifier of the link, and did is the unique identifier of the client.
[0131] After finding the problematic request, the problem location backend adds an httpheader that can trigger the debug mode to the request, and simulates the client to initiate the request again, as follows:
[0132] curl-H'Host:www.mgtv.com'-H'Accept:* / *'-H'X-Mgtv-Debug:info''http: / / www.mgtv.com / video / source? videoId=10000&seqId=21d75611017043108abb4882fd8d5835&did=836e02fce4fd87ff636eb68ac17cde806
[0133] After receiving the debug mode request, the Play service and its downstream output the following information to the log collection when determining that it is in debug mode:
[0134]
[0135]
[0136] After analysis, all debug log information logs with seqId 21d75611017043108abb4882fd8d5835 are output to the problem location background through the interface. The problem location background graphically displays the results as follows Figure 8 As shown, from Figure 8 It can be seen that the result of the media asset basic service response is null, which causes the final playback service to be unable to give the playback address normally. Therefore, the media asset basic service interface is the final problem interface.
[0137] Corresponding to the above method embodiment, the present invention also discloses a device for locating a problematic interface.
[0138] See also Fig. 9 , a structural diagram of a positioning device for a problem interface disclosed in an embodiment of the present invention, the device is applied to a server, and the positioning device includes:
[0139] The first acquisition unit 201 is used to acquire basic fault information and ID information fed back by the client when the function is abnormal;
[0140] The client in this embodiment has a problem feedback function. When a function of the client used by the user is abnormal, the user can submit basic fault information and ID information on the problem feedback function interface.
[0141] The basic fault information at least includes: function classification and fault occurrence time. In practical applications, the basic fault information may also include: function description, etc., depending on actual needs.
[0142] In this embodiment, the ID information includes: client ID. When the user logs in at the client, the ID information may also include: login user ID.
[0143] An interface search unit 202 is used to search for a corresponding server interface according to the functional classification;
[0144] In actual applications, different functional categories correspond to different server interfaces. For example, if the functional category is: video playback, the corresponding server interface is: video serialization interface.
[0145] The log search unit 203 is used to search the access log of the device corresponding to the client ID accessing the server interface according to the time point of the fault occurrence;
[0146] It should be noted that when the user uses the client function normally or when an abnormality occurs in the function, the client will request the server interface. After receiving the client's interface request, the server will record the access logs of all requests (including the request domain name, interface address, ID information, etc.) and the corresponding access time. Therefore, according to the time point of the failure, the access log of the device corresponding to the client ID accessing the server interface is found. For example, the time point of the failure is 2021-12-07 12:00:00, and the server interface is: video serial interface, then the access log of the device corresponding to the client ID accessing the video serial interface is found.
[0147] A request determination unit 204, configured to determine a corresponding http request according to the access log;
[0148] The http request corresponding to the access log is the http request sent by the client to the server before an abnormality occurs when the user uses the client function.
[0149] The second acquisition unit 205 is used to simulate the client to initiate the http request again based on the debugging mode to obtain the debugging log information of all server interfaces of the call chain;
[0150] In this embodiment, the problem location background of the server adds an httpheader that can trigger the debugging mode to the http request, simulates the client to initiate the http request again, and obtains the debugging log information of all server interfaces of the call chain.
[0151] Among them, httpheader represents the http header.
[0152] It should be noted that the problem locating background described in the present invention is an interface operation management system for problem locating personnel to quickly locate problems.
[0153] After the problem location backend receives the problem feedback submitted by the user on the client: function classification, function description, time of fault occurrence and other information, it finds the corresponding service interface according to the function classification, finds the access log of the interface of the user device according to the time of occurrence, and replays the request in debug mode (adding the httpheader of X-Mgtv-Debug), the debug log information of all service interfaces on the link is stored. After log analysis, the debug log information is provided to the problem location in the form of an interface and then displayed graphically. When the problem location personnel receive user feedback, they can quickly locate the problematic service or method by viewing the graphical debug log information in the problem location backend.
[0154] The problem interface determination unit 206 is used to find the target debugging log information with an error code from all the debugging log information, and determine the server interface corresponding to the target debugging log information as the problem interface.
[0155] When a server interface fails, an error code will appear in the debug log information corresponding to the server interface. Therefore, by finding the target debug log information with the error code, the problem interface can be determined, and the problem interface is also the failed server interface.
[0156] In summary, the present invention discloses a device for locating a problem interface, which obtains basic fault information and ID information fed back by a client when the function is abnormal, wherein the basic fault information at least includes: function classification and time point of the fault occurrence, finds the corresponding server interface according to the function classification, finds the access log of the device accessing the server interface corresponding to the client ID according to the time point of the fault occurrence, determines the corresponding http request according to the access log, simulates the client to initiate the http request again based on the debugging mode, obtains the debugging log information of all server interfaces in the call chain, finds the target debugging log information with the error code from all the debugging log information, and determines the server interface corresponding to the target debugging log information as the problem interface. The present invention locates the interface problem by reproducing the process of the client initiating the http request in the debugging mode, and does not require the developer to debug the program code of the service interface online, which saves manpower and positioning time, and the whole process saves time and effort, thereby improving the efficiency of locating the problem interface.
[0157] It should be noted that for the specific working principles of each component in the device embodiment, please refer to the corresponding part of the method embodiment, which will not be repeated here.
[0158] Corresponding to the above embodiment, Fig.10 As shown, the present invention also provides an electronic device, which may include: a processor 1 and a memory 2;
[0159] The processor 1 and the memory 2 communicate with each other via a communication bus 3;
[0160] Processor 1, configured to execute at least one instruction;
[0161] Memory 2, used to store at least one instruction;
[0162] The processor 1 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention.
[0163] The memory 2 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0164] The processor executes at least one instruction to implement the following functions:
[0165] Obtaining basic fault information and ID information fed back by the client when the function is abnormal, wherein the basic fault information at least includes: function classification and fault occurrence time point, and the ID information includes: client ID;
[0166] Find the corresponding server interface according to the functional classification;
[0167] Find the access log of the device corresponding to the client ID accessing the server interface according to the time point of the failure;
[0168] Determine the corresponding http request according to the access log;
[0169] Based on the debug mode, simulate the client to initiate the http request again to obtain the debug log information of all server interfaces in the call chain;
[0170] Target debugging log information with an error code is found from all the debugging log information, and the server interface corresponding to the target debugging log information is determined as the problem interface.
[0171] The present invention also discloses a computer-readable storage medium, wherein the computer-readable storage medium stores at least one instruction, and when the at least one instruction is executed by a processor, the following functions are realized:
[0172] Obtaining basic fault information and ID information fed back by the client when the function is abnormal, wherein the basic fault information at least includes: function classification and fault occurrence time point, and the ID information includes: client ID;
[0173] Find the corresponding server interface according to the functional classification;
[0174] Find the access log of the device corresponding to the client ID accessing the server interface according to the time point of the failure;
[0175] Determine the corresponding http request according to the access log;
[0176] Based on the debug mode, simulate the client to initiate the http request again to obtain the debug log information of all server interfaces in the call chain;
[0177] Target debugging log information with an error code is found from all the debugging log information, and the server interface corresponding to the target debugging log information is determined as the problem interface.
[0178] In summary, the electronic device and computer-readable storage medium disclosed in the present invention obtain the basic fault information and ID information fed back by the client when the function is abnormal, and the basic fault information at least includes: function classification and fault occurrence time point, find the corresponding server interface according to the function classification, find the access log of the device corresponding to the client ID accessing the server interface according to the fault occurrence time point, determine the corresponding http request according to the access log, simulate the client to initiate the http request again based on the debugging mode, obtain the debugging log information of all server interfaces in the call chain, find the target debugging log information with error code from all the debugging log information, and determine the server interface corresponding to the target debugging log information as the problem interface. The present invention locates the interface problem by reproducing the process of the client initiating the http request through the debugging mode, and does not require the developer to debug the program code of the service interface online, saving manpower and positioning time, and the whole process saves time and effort, thereby improving the positioning efficiency of the problem interface.
[0179] It should be noted that the specific working principles of the electronic device and the computer-readable storage medium can be found in the corresponding part of the method embodiment and will not be repeated here.
[0180] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0181] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0182] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for locating a problem interface, characterized in that: Applied to the server, the positioning method includes: Obtaining basic fault information and ID information fed back by the client when the function is abnormal, wherein the basic fault information at least includes: function classification and fault occurrence time point, and the ID information includes: client ID; Find the corresponding server interface according to the functional classification; Find the access log of the device corresponding to the client ID accessing the server interface according to the time point of the failure; Determine the corresponding http request according to the access log; Based on the debug mode, simulate the client to initiate the http request again to obtain the debug log information of all server interfaces in the call chain; Finding target debug log information with an error code from all the debug log information, and determining the server interface corresponding to the target debug log information as the problem interface; The fields of the debug log information include: seqId, nodeId, parentNodeId, nodeName, nodeParams and nodeResult; The seqId is used to represent the unique link identifier, which is used to identify this http request so as to associate each sub-call with the initial http request; The nodeId is used to represent a node in a link, and one link represents an http request initiated by a client; The parentNodeId is used to associate two adjacent calls; The nodeName is used to indicate the node name in the link; The nodeParams is used to indicate the path and parameters of the node in the link. The nodeResult is used to indicate the response content of the node in the link to this request, so as to quickly locate the problem.
2. The positioning method according to claim 1, characterized in that: When a user logs in at the client, the ID information also includes: a logged-in user ID.
3. The positioning method according to claim 1, characterized in that: The debugging mode-based simulation client initiates the http request again to obtain the debugging log information of all server interfaces in the call chain, including: An httpheader capable of triggering the debugging mode is added to the http request, simulating the client to initiate the http request again, and obtaining the debugging log information of all server interfaces of the call chain.
4. The positioning method according to claim 1, characterized in that: The node relationships in the link include: a child node relationship and a follower node relationship, wherein the child node relationship and the follower node relationship represent a direct causal relationship between a child node and a parent node; When the parent node depends on the return result of the child node, the parent node and the child node form the child node relationship; When the parent node does not depend on the return result of the child node, the follower node relationship is formed between the parent node and the child node.
5. The positioning method according to claim 1, characterized in that: Also includes: Output and display the problem interface.
6. A device for locating a problem interface, characterized in that: Applied to the server, the positioning device includes: A first acquisition unit is used to acquire basic fault information and ID information fed back by the client when the function is abnormal, wherein the basic fault information at least includes: function classification and fault occurrence time point, and the ID information includes: client ID; An interface search unit, used to search for a corresponding server interface according to the functional classification; A log search unit, used to search for the access log of the device corresponding to the client ID accessing the server interface according to the time point of the fault occurrence; A request determining unit, used to determine a corresponding http request according to the access log; The second acquisition unit is used to simulate the client to initiate the http request again based on the debugging mode to obtain the debugging log information of all server interfaces of the call chain; A problem interface determination unit, configured to find target debug log information with an error code from all the debug log information, and determine the server interface corresponding to the target debug log information as the problem interface; The fields of the debug log information include: seqId, nodeId, parentNodeId, nodeName, nodeParams and nodeResult; The seqId is used to represent the unique link identifier, which is used to identify this http request so as to associate each sub-call with the initial http request; The nodeId is used to represent a node in a link, and one link represents an http request initiated by a client; The parentNodeId is used to associate two adjacent calls; The nodeName is used to indicate the node name in the link; The nodeParams is used to indicate the path and parameters of the node in the link. The nodeResult is used to indicate the response content of the node in the link to this request, so as to quickly locate the problem.
7. The positioning device according to claim 6, characterized in that: The second acquisition unit is specifically used for: An httpheader capable of triggering the debugging mode is added to the http request, simulating the client to initiate the http request again, and obtaining the debugging log information of all server interfaces of the call chain.
8. An electronic device, characterized in that: The electronic device comprises a memory and a processor; The memory is used to store at least one instruction; The processor is used to execute the at least one instruction to implement the method for locating a problematic interface as described in any one of claims 1 to 5.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one instruction, and when the at least one instruction is executed by a processor, the method for locating a problematic interface as claimed in any one of claims 1 to 5 is implemented.
