Slow interface acquisition method and related device

By accurately calculating the time-consuming time of the interface and identifying the slow interface, the problem of inaccurate judgment of slow interfaces in the existing technology is solved, and the accurate governance of slow interfaces is achieved, and user experience and system performance is improved.

CN119718873APending Publication Date: 2025-03-28新奥新智科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411882386.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-19
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

In the prior art, the long response time of the interface is inaccurate, resulting in inaccurate governance of slow interfaces, affecting user experience and system performance.

Method used

By obtaining the target interface identifier of the target interface of the application to be tested and the target tracking identifier of the target request, from the corresponding relationship between the pre-stored tracking identifier and the call information, multiple target call information corresponding to the target tracking identifier are found, the associated call information is determined, and the difference between the response time and the first time length of the target interface identifier is calculated as the time-consuming time. If the time-consuming time is greater than or equal to the preset threshold, the target interface is determined as a slow interface.

Benefits of technology

Accurate identification of slow interfaces is achieved, unnecessary waste of governance resources is avoided, and user experience and system performance is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119718873A_ABST
    Figure CN119718873A_ABST
Patent Text Reader

Abstract

The invention discloses a slow interface acquisition method and a related device, and relates to the technical field of application supervision. The method comprises the steps of obtaining a target interface identifier of a target interface of a to-be-tested application; obtaining a target tracking identifier of the target request obtained by the target interface; searching a plurality of pieces of target calling information corresponding to the target tracking identifier from a pre-stored corresponding relationship between the tracking identifier and the calling information; determining associated calling information from the multiple pieces of target calling information; determining a difference value between a response duration corresponding to the target interface identifier and a first duration as a time-consuming duration; the first duration comprises the time-consuming duration of other interfaces called by the target interface, so that the time-consuming duration corresponding to the target interface identifier is accurate; and if the consumed time duration corresponding to the target interface identifier is greater than or equal to a first preset threshold value, determining that the target interface is a slow interface. The consumed time duration corresponding to the target interface identifier is accurate, so that the determined slow interface is also accurate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of application supervision technology, and in particular to a slow interface acquisition method and related devices. Background Art

[0002] Distributed systems include multiple applications, which may be distributed on different servers and databases. In Internet applications, user experience is the key competitive advantage. Interfaces with long response times in distributed systems will directly affect user experience. Therefore, it is necessary to manage interfaces with long response times.

[0003] In the related technology, the absolute value of the difference between the time the interface receives a request and the time it responds to the request and obtains a response result is determined as the response time of the interface; if the response time is longer, it is considered that the response time of the interface is long, that is, the interface is a slow interface that needs to be managed.

[0004] The interface that needs to be managed, namely the slow interface, determined in the related art is inaccurate. Summary of the invention

[0005] In view of the above problems, the present application provides a slow interface acquisition method and related devices to achieve the purpose of accurately acquiring the slow interface. The specific scheme is as follows:

[0006] The first aspect of the present application provides a slow interface acquisition method, comprising:

[0007] Get the target interface identifier of the target interface of the application to be tested;

[0008] Obtaining a target tracking identifier of a target request obtained by the target interface;

[0009] Searching for multiple target call information corresponding to the target tracking identifier from the pre-stored correspondence between the tracking identifier and the call information, wherein the target call information includes an interface identifier, a start time of calling the interface corresponding to the interface identifier, and an end time of calling the interface corresponding to the interface identifier;

[0010] Determine associated call information from the plurality of target call information, wherein the start time in the associated call information is closest to the start time in the target call information containing the target interface identifier;

[0011] Determine that the difference between the response duration corresponding to the target interface identifier and the first duration is the time-consuming duration; the first duration is the difference between the end time and the start time contained in the associated call information; the response duration of the target interface identifier is the difference between the end time and the start time in the target call information containing the target interface identifier;

[0012] If the time duration corresponding to the target interface identifier is greater than or equal to a first preset threshold, it is determined that the target interface is a slow interface.

[0013] In a possible implementation, the step of determining associated call information from the plurality of target call information includes:

[0014] Based on the plurality of target call information, determining a call link path corresponding to the target request, wherein the call link path represents a sorting result of a plurality of interfaces that are sequentially called to implement the target request;

[0015] The associated call information is determined based on the call link path.

[0016] In a possible implementation, the step of determining the call link path corresponding to the target request based on the plurality of target call information includes:

[0017] Acquire processing time intervals respectively corresponding to a plurality of target call information, wherein the earliest time of the processing time interval of the target call information is the start time included in the target call information, and the latest time of the processing time interval is the end time included in the target call information;

[0018] For any two of the target call information, if the processing time interval of one target call information is included in the processing time interval of another target call information, it is determined that the one target call information is nested in the other target call information;

[0019] The nested relationship of the plurality of target call information is determined as the call link path.

[0020] In a possible implementation, the step of obtaining a target interface identifier of a target interface of the application to be tested includes:

[0021] Obtaining response durations corresponding to a plurality of interface identifiers of the application to be tested; the response duration of the interface identifier is the difference between the end time and the start time in the call information including the interface identifier;

[0022] Determine the interface identifier whose response duration is greater than or equal to a second preset threshold as the target interface identifier.

[0023] In a possible implementation, after the step of determining that the target interface is a slow interface if the time duration corresponding to the target interface identifier is greater than or equal to a first preset threshold, the step further includes:

[0024] From the correspondence between the preset interface identifier and the communication address, searching for the target communication address corresponding to the target interface identifier;

[0025] Sending a management request for managing the target interface to the target communication address.

[0026] A second aspect of the present application provides a slow interface acquisition device, including:

[0027] A first acquisition module is used to acquire a target interface identifier of a target interface of an application to be tested;

[0028] A second acquisition module, used to acquire a target tracking identifier of a target request obtained by the target interface;

[0029] A first search module is used to search for a plurality of target call information corresponding to the target tracking identifier from a pre-stored correspondence relationship between the tracking identifier and the call information, wherein the target call information includes an interface identifier, a start time of calling the interface corresponding to the interface identifier, and an end time of calling the interface corresponding to the interface identifier;

[0030] A first determining module, configured to determine associated calling information from a plurality of target calling information, wherein the start time in the associated calling information is closest to the start time in the target calling information containing the target interface identifier;

[0031] The second determination module is used to determine that the difference between the response duration corresponding to the target interface identifier and the first duration is the time-consuming duration; the first duration is the difference between the end time and the start time contained in the associated call information; the response duration of the target interface identifier is the difference between the end time and the start time in the target call information containing the target interface identifier;

[0032] The third determination module is configured to determine that the target interface is a slow interface if the time duration corresponding to the target interface identifier is greater than or equal to a first preset threshold.

[0033] In a possible implementation, the first determining module includes:

[0034] A first determining unit, configured to determine a call link path corresponding to the target request based on the plurality of target call information, wherein the call link path represents a sorting result of a plurality of interfaces that are sequentially called to implement the target request;

[0035] The second determining unit is used to determine the associated call information based on the call link path.

[0036] A third aspect of the present application provides a computer program product, including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements the slow interface acquisition method of the first aspect or any implementation of the first aspect.

[0037] A fourth aspect of the present application provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:

[0038] The memory is used to store computer programs;

[0039] The processor is used to execute the computer program so that the electronic device can implement the slow interface acquisition method of the above-mentioned first aspect or any implementation manner of the first aspect.

[0040] A fifth aspect of the present application provides a computer storage medium, which carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement the slow interface acquisition method of the above-mentioned first aspect or any implementation of the first aspect.

[0041] By means of the above technical scheme, the present application provides a method for obtaining a slow interface, obtaining a target interface identifier of a target interface of an application to be tested; obtaining a target tracking identifier of a target request obtained by the target interface; searching for multiple target call information corresponding to the target tracking identifier from the correspondence between the pre-stored tracking identifier and the call information; determining associated call information from multiple target call information; determining the difference between the response duration corresponding to the target interface identifier and the first duration as the time-consuming duration; the first duration includes the time-consuming duration of other interfaces called by the target interface, so the time-consuming duration corresponding to the target interface identifier is accurate; if the time-consuming duration corresponding to the target interface identifier is greater than or equal to the first preset threshold, the target interface is determined to be a slow interface. Since the time-consuming duration corresponding to the target interface identifier is accurate, the determined slow interface is also accurate. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.

[0043] Figure 1 A schematic diagram of a system architecture provided for this application;

[0044] Figure 2 A schematic diagram of an optional hardware structure of a terminal 100 provided in this application;

[0045] Figure 3 A flowchart of a slow interface acquisition method provided by this application;

[0046] Figure 4 A signaling diagram of a slow interface acquisition method provided by this application;

[0047] Figure 5 A schematic diagram of the structure of a slow interface acquisition device provided by the present application;

[0048] Figure 6 A schematic diagram of the structure of an electronic device provided in this application. DETAILED DESCRIPTION

[0049] The following describes the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.

[0050] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0051] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.

[0052] In a distributed system, the inaccuracy of the interface duration statistics involves multiple factors. The following is an explanation of the reasons for the inaccurate interface duration statistics.

[0053] The complexity of the call link path leads to inaccurate statistics on the duration of the interface. The reasons are as follows:

[0054] After receiving a request, the interface may call one or more downstream interfaces in order to respond to the request. The downstream interface may call its own downstream interface to implement the request, which makes it complicated to track and count the time consumption of a single interface. For example, in order to implement the same request, interface A is called, interface A calls interface B, and interface B calls interface C and interface D. In this way, the response time of interface A includes the time consumption of interface B, the time consumption of interface C, and the time consumption of interface D. If the response time of interface A is determined as the time consumption of interface A, the time consumption of interface A is not accurately determined. For another example, in order to implement the same request, interface A is called, and interface A does not call any other interface, that is, the request can be implemented by calling interface A. At this time, the response time of interface A is the time consumption of interface A.

[0055] External dependencies lead to inaccurate statistics on the duration of the interface. The reasons are as follows:

[0056] The interface may rely on external services, such as third-party APIs (Application Programming Interfaces) or databases. The response time of these external services is uncontrolled and may fluctuate greatly, affecting the overall time consumption of the interface.

[0057] In the related art, the response time of the interface is determined as the time taken by the interface, so the determined slow interface is inaccurate. The response time of the interface refers to the absolute value of the difference between the start time of calling the interface and the end time of calling the interface. For example, in order to implement the same request, interface A is called, and interface A calls interface B; assuming that interface A receives the request, and calls interface B after the service corresponding to interface A processes it (assuming that this process takes 50ms, which is the real time taken by interface A); the service corresponding to interface B processes it and feeds back the processing result to interface A (assuming that this process takes 500ms, which is the real time taken by interface B); in summary, the response time of interface A is 550ms. In the related art, the response time of interface A is the time taken; assuming that the time taken by the interface exceeds 100ms, it is a slow interface, then interface A is confirmed as a slow interface and pushed to the R&D personnel for governance. However, the real time taken by interface A is 50ms, and interface A does not actually need to be governed. During the process of managing interface A, R&D personnel discovered that interface A actually did not need to be managed, which wasted human resources.

[0058] In summary, optimizing on the wrong interface may lead to a waste of resources. If the slow interface is not accurately identified and optimized in a timely manner, it will eventually affect the user experience and cause the overall system performance to deteriorate.

[0059] The following describes the embodiments of the present application in combination with the above-mentioned technical issues.

[0060] See also Figure 1 , Figure 1 A schematic diagram of a system architecture is shown. The system may include a terminal 100, a distributed system 200 and a database 300.

[0061] Among them, an application program or a web page may be installed on the terminal 100, and the above application program and web page may provide an interface. The terminal 100 may receive relevant parameters input by the user on the interface to obtain processing results.

[0062] Exemplarily, the distributed system 200 is a system accessed by a client. In the embodiment of the present application, external dependencies, servers deployed with multiple applications, and databases are collectively referred to as distributed systems.

[0063] Exemplarily, the terminal 100 is a terminal held by a developer. Exemplarily, the terminal can display an interface corresponding to the processing result.

[0064] Exemplarily, the database 300 may be an APM (Application Performance Monitoring) database.

[0065] APM technology can monitor and record the complete path of the same request in a distributed system, including all the services and interfaces it passes through. The following is a detailed description of the process: When a request enters a distributed system, APM generates a unique trace ID for the request. This trace ID remains unchanged throughout the life cycle of the request and is used to identify and associate all relevant data for the request. In a microservice architecture, a request may need to pass through multiple services. When each service processes a request, it attaches the trace ID to the context of the request so that when the request is passed to the next service, the trace ID is also passed. This process can be achieved in the following two ways: HTTP header propagation: Add the trace ID in the header of the HTTP request so that each service can read and set the trace ID from the request header. Messaging system: When using a message queue or event bus, the trace ID is included in the metadata of the message.

[0066] When the service corresponding to each interface processes a request, APM will record the call information corresponding to the Trace ID, which includes the start time, end time and interface ID of the request. After the service corresponding to the interface completes the processing of the request, APM will report the collected call information corresponding to the Trace ID to the APM database.

[0067] Among them, the interface identifier included in the call information corresponds to the interface, the start time is the start time of calling the interface, and the end time is the end time of calling the interface. For example, the call link path of the same request is interface A→interface B; call interface A (the time at this time is the start time of calling interface A), the service corresponding to interface A processes, and then calls interface B (the time at this time is the start time of calling interface B), the service corresponding to interface B processes, and then feeds back the first processing result to interface A (the time at this time is the end time of calling interface B); the service corresponding to interface A combines the first processing result to obtain the second processing result, and feeds back the second processing result (the time at this time is the end time of calling interface A).

[0068] Exemplarily, the terminal 100 may obtain the call information corresponding to each Trace ID from the database 300, so as to execute the slow interface acquisition method provided in the embodiment of the present application.

[0069] Next describe Figure 1 The product form of the mid-terminal 100;

[0070] The terminal 100 in the embodiment of the present application can be a mobile phone, a tablet computer, a wearable device, a vehicle-mounted device, an augmented reality (AR) / virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA) or a server, etc., and the embodiment of the present application does not impose any limitation on this.

[0071] Figure 2 An optional hardware structure diagram of the terminal 100 is shown.

[0072] refer to Figure 2 As shown, the terminal 100 may include a radio frequency unit 110, a memory 120, an input unit 130, a display unit 140, a camera 150 (optional), an audio circuit 160 (optional), a speaker 161 (optional), a microphone 162 (optional), an earphone jack 163 (optional), a processor 170, an external interface 180, a power supply 190 and other components. Those skilled in the art will appreciate that Figure 2 This is merely an example of a terminal and does not constitute a limitation on the terminal. The terminal may include more or fewer components than shown in the figure, or a combination of certain components, or different components.

[0073] The input unit 130 can be used to receive input digital or character information, and generate key signal input related to the user settings and function control of the terminal. Specifically, the input unit 130 may include a touch screen 131 (optional) and / or other input devices 132. The touch screen 131 can collect the user's touch operations on or near it (such as the user's operation on or near the touch screen using any suitable object such as fingers, joints, stylus, etc.), and drive the corresponding connection device according to a pre-set program. The touch screen can detect the user's touch action on the touch screen, convert the touch action into a touch signal and send it to the processor 170, and can receive and execute the command sent by the processor 170; the touch signal at least includes the touch point coordinate information. The touch screen 131 can provide an input interface and an output interface between the terminal 100 and the user. In addition, the touch screen can be implemented using multiple types such as resistive, capacitive, infrared and surface acoustic wave. In addition to the touch screen 131, the input unit 130 can also include other input devices. Specifically, other input devices 132 may include, but are not limited to, one or more of a physical keyboard, function keys (such as a volume control key, a switch key, etc.), a trackball, a mouse, a joystick, and the like.

[0074] Among them, the input device 132 can receive input data and the like.

[0075] The display unit 140 may be used to display information input by the user or provided to the user, various menus of the terminal 100, interactive interfaces, file display and / or playback of any multimedia file. In the embodiment of the present application, the display unit 140 may be used to display interfaces, processing results, etc.

[0076] The memory 120 can be used to store instructions and data. The memory 120 can mainly include an instruction storage area and a data storage area. The data storage area can store various data, such as multimedia files, texts, etc.; the instruction storage area can store software units such as operating systems, applications, instructions required for at least one function, or their subsets and extensions. It can also include a non-volatile random access memory; provide the processor 170 with hardware, software and data resources including management of computing and processing equipment, and support control software and applications. It is also used for the storage of multimedia files, and the storage of running programs and applications.

[0077] The processor 170 is the control center of the terminal 100. It uses various interfaces and lines to connect various parts of the entire terminal 100. By running or executing instructions stored in the memory 120 and calling data stored in the memory 120, it executes various functions of the terminal 100 and processes data, thereby controlling the terminal device as a whole. Optionally, the processor 170 may include one or more processing units; preferably, the processor 170 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface and application program, and the modem processor mainly processes wireless communication. It is understandable that the above-mentioned modem processor may not be integrated into the processor 170. In some embodiments, the processor and the memory may be implemented on a single chip, and in some embodiments, they may also be implemented separately on separate chips. The processor 170 may also be used to generate corresponding operation control signals, send them to corresponding components of the computing and processing device, read and process data in the software, especially read and process data and programs in the memory 120, so that each functional module therein performs corresponding functions, thereby controlling the corresponding components to act according to the requirements of the instructions.

[0078] Among them, the memory 120 can be used to store software codes related to the slow interface acquisition method, the processor 170 can execute the steps of the slow interface acquisition method, and can also schedule other units (such as the above-mentioned input unit 130 and display unit 140) to implement corresponding functions.

[0079] The radio frequency unit 110 (optional) can be used for receiving and sending information or receiving and sending signals during a call, for example, after receiving the downlink information of the base station, it is sent to the processor 170 for processing; in addition, the designed uplink data is sent to the base station. Generally, the RF circuit includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (Low Noise Amplifier, LNA), a duplexer, etc. In addition, the radio frequency unit 110 can also communicate with network devices and other devices through wireless communication. The wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile communication (Global System of Mobile communication, GSM), General Packet Radio Service (General Packet Radio Service, GPRS), Code Division Multiple Access (Code Division Multiple Access, CDMA), Wideband Code Division Multiple Access (Wideband Code Division Multiple Access, WCDMA), Long Term Evolution (Long Term Evolution, LTE), email, Short Messaging Service (SMS), etc.

[0080] In this embodiment of the present application, the RF unit 110 can send data to the server 200 and receive processing results sent by the server 200.

[0081] It should be understood that the radio frequency unit 110 is optional and can be replaced by other communication interfaces, such as a network port.

[0082] The terminal 100 also includes a power supply 190 (such as a battery) for supplying power to various components. Preferably, the power supply can be logically connected to the processor 170 through a power management system, so that the power management system can manage functions such as charging, discharging, and power consumption.

[0083] The terminal 100 further includes an external interface 180 , which may be a standard Micro USB interface or a multi-pin connector, and may be used to connect the terminal 100 to communicate with other devices, or to connect a charger to charge the terminal 100 .

[0084] Although not shown, the terminal 100 may also include a flashlight, a wireless fidelity (WiFi) module, a Bluetooth module, sensors with different functions, etc., which are not described in detail here. Some or all of the methods described below may be applied in the following embodiments. Figure 2 In the terminal 100 shown.

[0085] Reference Figure 3 , Figure 3 A flowchart of a slow interface acquisition method provided in an embodiment of the present application is shown as follows: Figure 3 As shown, a slow interface acquisition method provided in an embodiment of the present application may include steps S301 to S306, and these steps are described in detail below.

[0086] Step S301: Obtain a target interface identifier of a target interface of an application to be tested.

[0087] Exemplarily, the interface identifier of the interface may be a uniform resource locator (URL) or an API path.

[0088] It is understandable that an application under test may have one or more interfaces.

[0089] Step S302: Acquire the target tracking identifier of the target request obtained by the target interface.

[0090] It is understandable that the database 300 can store the correspondence between the interface identifier and the request. Through the database 300, it is possible to obtain which interface is called by which request. The APM database stores the correspondence between the tracking identifier and the call information. Exemplarily, the APM database also stores the correspondence between the request and the tracking identifier. In summary, the present application can obtain the tracking identifier of the request corresponding to each interface.

[0091] Exemplarily, the number of target requests corresponding to the target interface may be one or more. The target tracking identifier of the same target request is unique.

[0092] Step S303: searching for multiple target calling information corresponding to the target tracking identifier from the pre-stored correspondence between the tracking identifier and the calling information, wherein the target calling information includes the interface identifier, the start time of calling the interface corresponding to the interface identifier, and the end time of calling the interface corresponding to the interface identifier.

[0093] Exemplarily, multiple target call information corresponding to the target tracking identifier can be retrieved from the APM database.

[0094] It is understandable that through Figure 1 From the introduction of the APM database, it can be seen that the call information with the same tracking identifier belongs to the call information corresponding to different interfaces called to implement the same request.

[0095] Step S304: determining associated call information from the plurality of target call information, wherein the start time in the associated call information is closest to the start time in the target call information including the target interface identifier.

[0096] The following example illustrates this.

[0097] Assume that the number of multiple target call information is 3, namely the first target call information, the second target call information and the third target call information, wherein the first target call information is {interface identifier A, start time A1, end time A2}, the second target call information is {interface identifier B, start time B1, end time B2}, and the third target call information is {interface identifier C, start time C1, end time C2}. Assume that start time A1 is earlier than start time B1 which is earlier than start time C1; end time C2 is earlier than end time B2 which is earlier than end time A2. Assuming that interface identifier A is the target interface identifier, the second target call information is the associated call information.

[0098] It can be understood that the start time of the associated call information is closest to the start time in the target call information including the target interface identifier, and the start time of the associated call information is later than the start time in the target call information including the target interface identifier.

[0099] Step S305: Determine the difference between the response duration corresponding to the target interface identifier and the first duration as the consumed duration.

[0100] The first duration is the difference between the end time and the start time included in the associated call information; the response duration of the target interface identifier is the difference between the end time and the start time in the target call information including the target interface identifier.

[0101] The following example illustrates this.

[0102] Assume that the calling relationship for the same request is: interface A, interface B and interface C, that is, interface A calls interface B, and interface B calls interface C; Assume that interface A is the target interface, then interface B is the interface corresponding to the associated calling information; It can be understood that the first duration of interface B includes the response duration of interface C and the time consumed by interface B, and the response duration of interface A includes: the response duration of interface C, the time consumed by interface B and the time consumed by interface A. Therefore, the difference between the response duration of interface A and the first duration is the time consumed by interface A.

[0103] Exemplarily, if there are multiple requests corresponding to the target interface, then there are multiple time-consuming durations corresponding to the target interface; the average of the multiple time-consuming durations may be calculated as the final time-consuming duration corresponding to the target interface.

[0104] Step S306: If the time consumption corresponding to the target interface identifier is greater than or equal to a first preset threshold, it is determined that the target interface is a slow interface.

[0105] Exemplarily, the first preset threshold may be set based on actual conditions, which is not limited in this application.

[0106] The embodiment of the present application provides a method for obtaining a slow interface, which obtains a target interface identifier of a target interface of an application to be tested; obtains a target tracking identifier of a target request obtained by the target interface; searches for multiple target call information corresponding to the target tracking identifier from the correspondence between the tracking identifier and the call information stored in advance; determines the associated call information from the multiple target call information; determines that the difference between the response duration corresponding to the target interface identifier and the first duration is the time-consuming duration; the first duration includes the time-consuming durations of other interfaces called by the target interface, so the time-consuming duration corresponding to the target interface identifier is accurate; if the time-consuming duration corresponding to the target interface identifier is greater than or equal to the first preset threshold, the target interface is determined to be a slow interface. Since the time-consuming duration corresponding to the target interface identifier is accurate, the determined slow interface is also accurate.

[0107] It is understandable that there are multiple ways to implement step S304. The embodiment of the present application provides but is not limited to the following method, which includes the following steps A11 to A12 during implementation.

[0108] Step A11: Based on the multiple target call information, determine the call link path corresponding to the target request, where the call link path represents the sorting result of multiple interfaces that are called in sequence to implement the target request.

[0109] Assume that the calling relationships for the same request are: interface A, interface B and interface C, that is, interface A calls interface B, and interface B calls interface C; then the calling link path can be interface A→interface B→interface C.

[0110] Step A12: Determine the associated call information based on the call link path.

[0111] Exemplarily, the target call information corresponding to the next interface of the target interface in the call link path is the associated call information.

[0112] It is understandable that there are multiple ways to implement step A11. The embodiment of the present application provides but is not limited to the following method, which includes the following steps B11 to B13 during implementation.

[0113] Step B11: obtaining processing time intervals corresponding to a plurality of the target call information respectively, wherein the earliest time of the processing time interval of the target call information is the start time included in the target call information, and the latest time of the processing time interval is the end time included in the target call information.

[0114] Assume that the number of multiple target call information is 3, namely the first target call information, the second target call information and the third target call information, wherein the first target call information is {interface identifier A, start time A1, end time A2}, the second target call information is {interface identifier B, start time B1, end time B2}, and the third target call information is {interface identifier C, start time C1, end time C2}. Assume that start time A1 is earlier than start time B1 which is earlier than start time C1; end time C2 is earlier than end time B2 which is earlier than end time A2. Then the processing time interval corresponding to the first target call information is [start time A1, end time A2], the processing time interval corresponding to the second target call information is [start time B1, end time B2], and the processing time interval corresponding to the third target call information is [start time C1, end time C2].

[0115] Step B12: for any pair of the target calling information, if the processing time interval of one target calling information is included in the processing time interval of another target calling information, it is determined that the one target calling information is nested in the other target calling information.

[0116] Step B13: Determine the nested relationship of the multiple target call information as the call link path.

[0117] Still taking the above as an example, assuming that the nested relationship is in the JSON (JavaScript Object Notation) format, the nested relationship among the first target call information, the second target call information and the third target call information is as follows:

[0118] json

[0119] {

[0120] "nestedInvocations": {

[0121] "interfaceA": {

[0122] "interfaceIdentifier": "A",

[0123] "startTime": "A1",

[0124] "endTime": "A2",

[0125] "nested": {

[0126] "interfaceB": {

[0127] "interfaceIdentifier": "B",

[0128] "startTime": "B1",

[0129] "endTime": "B2",

[0130] "nested": {

[0131] "interfaceC": {

[0132] "interfaceIdentifier": "C",

[0133] "startTime": "C1",

[0134] "endTime": "C2"}}}}}}}.

[0135] It is understandable that there are multiple ways to implement step S301, and the embodiments of the present application provide but are not limited to the following two.

[0136] The first implementation of step S301 includes the following steps C11.

[0137] Step C11: Select one or more target interface identifiers from the multiple interface identifiers displayed on the displayed user interface.

[0138] The second implementation of step S301 includes the following steps D11 to D12.

[0139] Step D11: Acquire response durations corresponding to a plurality of interface identifiers of the application to be tested; the response duration of the interface identifier is the difference between the end time and the start time in the call information including the interface identifier.

[0140] Step D12: Determine the interface identifier whose response duration is greater than or equal to the second preset threshold as the target interface identifier.

[0141] Exemplarily, the second preset threshold may be determined based on actual conditions and is not limited here.

[0142] Exemplarily, the first preset threshold may be the same as or different from the second preset threshold.

[0143] It can be understood that, for each interface, the response time of the interface ≥ the time consumed by the interface. If the response time of the interface is less than the second preset threshold, then the time consumed by the interface must be less than the second preset threshold, so the interface is not a slow interface and there is no need to analyze the interface further; if the response time of the interface ≥ the second preset threshold, then the time consumed by the interface may be less than or greater than or equal to the second preset threshold, and the interface needs to be further analyzed.

[0144] Exemplarily, if the time duration corresponding to the target interface identifier is greater than or equal to a first preset threshold, after the step of determining that the target interface is a slow interface, it also includes: searching for the target communication address corresponding to the target interface identifier from the correspondence between the preset interface identifier and the communication address; and sending a management request for managing the target interface to the target communication address.

[0145] It is understandable that the governance R&D personnel for different interfaces may be different or the same.

[0146] In order for those skilled in the art to better understand the embodiments of the present application, the following examples are provided for illustration.

[0147] like Figure 4 As shown, it is a signaling diagram of the slow interface acquisition method provided in an embodiment of the present application.

[0148] For example, Figure 1 The system architecture shown may also include a data lake, KAFKA.

[0149] KAFKA is a distributed stream processing platform, usually classified as a message queue or message broker system. Data Lake is a system that stores large amounts of raw data, which can be structured, semi-structured or unstructured. Figure 4 , the interaction process of the terminal 100, data lake 41, KAFKA 42, and APM database 300 mentioned in the embodiment of the present application is explained.

[0150] It is understandable that when the service corresponding to each interface in the distributed system 200 processes a request, the APM will record the call information corresponding to the Trace ID, and the call information includes the start time, end time and interface ID of the request. After the service corresponding to the interface completes processing the request, the APM will report the collected call information corresponding to the Trace ID to the APM database 300. Figure 4 The distributed system 200 is not represented.

[0151] Step S401: The APM database pushes the corresponding relationship between the tracking identifiers and the call information of all requests of the application to be tested collected on that day to KAFKA 42 based on the subscription message.

[0152] Exemplarily, the terminal may subscribe to a message for the APM database, that is, the terminal may subscribe to the application to be tested. Exemplarily, the subscription message of the terminal may include one or more applications to be tested.

[0153] It is understandable that the APM database can use ES (Elasticsearch) to store the corresponding relationship between the tracking identifiers and call information of all requests of the application to be tested. Exemplarily, each tracking identifier and its corresponding call information can be stored in JSON format.

[0154] Step S402: KAFKA 42 stores the response duration corresponding to each interface and the tracking identifier of the request corresponding to each interface in the data lake 41.

[0155] Step S403: The terminal 100 obtains, from the data lake, a target tracking identifier of a target interface whose response duration is greater than or equal to a second preset threshold.

[0156] Exemplarily, the second preset threshold may be 3s.

[0157] Exemplarily, the execution time of steps S401 to S402 may be the day T, the execution time of step S403 may be the first set time of T+1 day; the execution time of step S404 may be the second set time of T+1 day; and the execution time of step S405 may be the third set time of T+2 day.

[0158] Step S404: the terminal 100 obtains multiple target calling information corresponding to the target tracking identifier from the APM database based on the target tracking identifier.

[0159] Step S405: the terminal 100 determines the time consumption duration corresponding to the target interface based on the multiple target call information; and obtains the average of the multiple time consumption durations corresponding to the target interface.

[0160] A slow interface acquisition method provided in an embodiment of the present application is introduced above, and a device for executing the above slow interface acquisition method will be introduced below.

[0161] See also Figure 5 , Figure 5 This is a schematic diagram of the structure of a slow interface acquisition device provided in an embodiment of the present application. Figure 5 As shown, the slow interface acquisition device includes:

[0162] The first acquisition module 501 is used to acquire a target interface identifier of a target interface of an application to be tested;

[0163] A second acquisition module 502 is used to acquire a target tracking identifier of a target request obtained by the target interface;

[0164] A first search module 503 is used to search for a plurality of target call information corresponding to the target tracking identifier from the pre-stored correspondence between the tracking identifier and the call information, wherein the target call information includes an interface identifier, a start time of calling the interface corresponding to the interface identifier, and an end time of calling the interface corresponding to the interface identifier;

[0165] A first determining module 504 is used to determine associated calling information from the plurality of target calling information, wherein the start time in the associated calling information is closest to the start time in the target calling information including the target interface identifier;

[0166] The second determination module 505 is used to determine that the difference between the response duration corresponding to the target interface identifier and the first duration is the time-consuming duration; the first duration is the difference between the end time and the start time contained in the associated call information; the response duration of the target interface identifier is the difference between the end time and the start time in the target call information containing the target interface identifier;

[0167] The third determination module 506 is configured to determine that the target interface is a slow interface if the time duration corresponding to the target interface identifier is greater than or equal to a first preset threshold.

[0168] In an optional implementation, the first determining module includes:

[0169] A first determining unit, configured to determine a call link path corresponding to the target request based on the plurality of target call information, wherein the call link path represents a sorting result of a plurality of interfaces that are sequentially called to implement the target request;

[0170] The second determining unit is used to determine the associated call information based on the call link path.

[0171] In an optional implementation, the first determining unit includes:

[0172] A first determining subunit is used to obtain processing time intervals corresponding to the plurality of target call information respectively, wherein the earliest time of the processing time interval of the target call information is the start time included in the target call information, and the latest time of the processing time interval is the end time included in the target call information;

[0173] A second determining subunit is configured to determine, for any pair of the target call information, that the one target call information is nested in the other target call information if the processing time interval of the one target call information is included in the processing time interval of the other target call information;

[0174] The third determining subunit is used to determine the nested relationship of multiple target call information as the call link path.

[0175] In an optional implementation, the first acquisition module includes:

[0176] An acquisition unit, used to acquire response durations respectively corresponding to a plurality of interface identifiers of the application to be tested; the response duration of the interface identifier is the difference between the end time and the start time in the call information including the interface identifier;

[0177] The third determining unit is configured to determine the interface identifier whose response duration is greater than or equal to a second preset threshold as the target interface identifier.

[0178] In an optional implementation, the method further includes:

[0179] A second search module, used to search for a target communication address corresponding to the target interface identifier from a correspondence between a preset interface identifier and a communication address;

[0180] The sending module is used to send a management request for managing the target interface to the target communication address.

[0181] The present application also provides an electronic device in an embodiment. Figure 6 As shown, it shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiment of the present application. The electronic device in the embodiment of the present application may include but is not limited to fixed terminals such as mobile phones, laptops, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, etc. Figure 6 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0182] like Figure 6 As shown, the electronic device may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 to a random access memory (RAM) 603. When the electronic device is powered on, various programs and data required for the operation of the electronic device are also stored in the RAM 603. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0183] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a memory card, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although Figure 6 An electronic device having various devices is shown, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0184] An embodiment of the present application also provides a computer program product including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements any slow interface acquisition method provided in the embodiment of the present application.

[0185] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any slow interface acquisition method provided in the embodiment of the present application.

[0186] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.

[0187] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0188] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.

[0189] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.

Claims

1. A slow interface acquisition method, characterized in that: include: Get the target interface identifier of the target interface of the application to be tested; Obtaining a target tracking identifier of a target request obtained by the target interface; Searching for multiple target call information corresponding to the target tracking identifier from the pre-stored correspondence between the tracking identifier and the call information, wherein the target call information includes an interface identifier, a start time of calling the interface corresponding to the interface identifier, and an end time of calling the interface corresponding to the interface identifier; Determine associated call information from the plurality of target call information, wherein the start time in the associated call information is closest to the start time in the target call information containing the target interface identifier; Determine that the difference between the response duration corresponding to the target interface identifier and the first duration is the time-consuming duration; the first duration is the difference between the end time and the start time included in the associated call information; The response duration of the target interface identifier is the difference between the end time and the start time in the target call information containing the target interface identifier; If the time duration corresponding to the target interface identifier is greater than or equal to a first preset threshold, it is determined that the target interface is a slow interface.

2. The slow interface acquisition method according to claim 1, characterized in that: The step of determining associated call information from the plurality of target call information comprises: Based on the plurality of target call information, determining a call link path corresponding to the target request, wherein the call link path represents a sorting result of a plurality of interfaces that are sequentially called to implement the target request; The associated call information is determined based on the call link path.

3. The slow interface acquisition method according to claim 2, characterized in that: The step of determining the call link path corresponding to the target request based on the plurality of target call information comprises: Acquire processing time intervals respectively corresponding to a plurality of target call information, wherein the earliest time of the processing time interval of the target call information is the start time included in the target call information, and the latest time of the processing time interval is the end time included in the target call information; For any two of the target call information, if the processing time interval of one target call information is included in the processing time interval of another target call information, it is determined that the one target call information is nested in the other target call information; The nested relationship of the plurality of target call information is determined as the call link path.

4. The slow interface acquisition method according to any one of claims 1 to 3, characterized in that: The step of obtaining the target interface identifier of the target interface of the application to be tested comprises: Obtaining response durations corresponding to a plurality of interface identifiers of the application to be tested; the response duration of the interface identifier is the difference between the end time and the start time in the call information including the interface identifier; Determine the interface identifier whose response duration is greater than or equal to a second preset threshold as the target interface identifier.

5. The slow interface acquisition method according to claim 1, characterized in that: After the step of determining that the target interface is a slow interface if the time duration corresponding to the target interface identifier is greater than or equal to a first preset threshold, the method further includes: From the correspondence between the preset interface identifier and the communication address, searching for the target communication address corresponding to the target interface identifier; Sending a management request for managing the target interface to the target communication address.

6. A slow interface acquisition device, characterized in that: include: A first acquisition module is used to acquire a target interface identifier of a target interface of an application to be tested; A second acquisition module, used to acquire a target tracking identifier of a target request obtained by the target interface; A first search module is used to search for a plurality of target call information corresponding to the target tracking identifier from a pre-stored correspondence relationship between the tracking identifier and the call information, wherein the target call information includes an interface identifier, a start time of calling the interface corresponding to the interface identifier, and an end time of calling the interface corresponding to the interface identifier; A first determining module, configured to determine associated calling information from a plurality of target calling information, wherein the start time in the associated calling information is closest to the start time in the target calling information containing the target interface identifier; A second determination module is used to determine that the difference between the response duration corresponding to the target interface identifier and the first duration is a time-consuming duration; The first duration is the difference between the end time and the start time included in the associated call information; The response duration of the target interface identifier is the difference between the end time and the start time in the target call information containing the target interface identifier; The third determination module is configured to determine that the target interface is a slow interface if the time duration corresponding to the target interface identifier is greater than or equal to a first preset threshold.

7. The slow interface acquisition device according to claim 6, characterized in that: The first determining module comprises: A first determining unit, configured to determine a call link path corresponding to the target request based on the plurality of target call information, wherein the call link path represents a sorting result of a plurality of interfaces that are sequentially called to implement the target request; The second determining unit is used to determine the associated call information based on the call link path.

8. A computer program product, characterized in that It comprises computer-readable instructions, and when the computer-readable instructions are executed on an electronic device, the electronic device implements the slow interface acquisition method as claimed in any one of claims 1 to 5.

9. An electronic device, characterized in that: The method comprises at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program so that the electronic device can implement the slow interface acquisition method as described in any one of claims 1 to 5.

10. A computer storage medium, characterized in that: The storage medium carries one or more computer programs, and when the one or more computer programs are executed by an electronic device, the electronic device can implement the slow interface acquisition method as described in any one of claims 1 to 5.