Interface detection method, device, equipment, medium and product
Through the automated interface detection method, we can quickly and accurately determine the interface repair situation by counting the abnormal ratio through multiple detections, solving the problem of low manual detection efficiency and error, and achieving efficient and accurate abnormal interface detection.
Patent Information
- Application Number
- CN202410659645.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-24
- Publication Date
- 2024-09-17
AI Technical Summary
In the existing technology, manual detection of abnormal interfaces prolongs the processing time and increases labor costs, and the detection efficiency is low and errors are easily introduced.
By obtaining the interface detection task of the abnormal interface, executing multiple interface detection tasks, counting the detection data, calculating the abnormality ratio, and determining the repair status of the interface based on the ratio and the preset threshold, the detection process is automated.
This shortens the processing time of abnormal interfaces, improves detection efficiency, reduces labor costs, and ensures the accuracy of detection results.
Smart Images

Figure CN118656237A
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of interface detection, and in particular to an interface detection method, an interface detection device, an electronic device, a computer-readable storage medium, and a computer program product. Background Art
[0002] Typically, on the Internet, data is exchanged between systems through specific communication protocol interfaces (eg, Hypertext Transfer Protocol (HTTP) interfaces, etc.), and the stability between the upstream interface and the downstream interface determines the stability of the network service.
[0003] For abnormal interfaces, manual detection is usually used to determine whether the abnormal interfaces have been repaired. However, the above method will prolong the processing time of the abnormal interfaces, increase labor costs, and reduce the detection efficiency of the abnormal interfaces. Summary of the invention
[0004] The present application provides an interface detection method, an interface detection device, an electronic device, a computer-readable storage medium and a computer program product, which can effectively shorten the processing time of abnormal interfaces and improve the detection efficiency of abnormal interfaces.
[0005] In the first aspect, the present application provides an interface detection method, which includes: obtaining an interface detection task for an abnormal interface; executing the interface detection task N times to obtain N detection data, where N is an integer greater than 1; performing statistics on the N detection data to obtain an abnormal ratio of abnormal data in the N detection data; and determining the repair status of the abnormal interface based on the abnormal ratio and a preset ratio threshold.
[0006] In the second aspect, the present application provides an interface detection device, which includes: a generation module, used to obtain an interface detection task for an abnormal interface; an execution module, used to execute the interface detection task N times, and obtain N detection data, where N is an integer greater than 1; a statistical module, used to count the N detection data, and obtain the abnormal ratio of abnormal data in the N detection data; a determination module, used to determine the repair status of the abnormal interface based on the abnormal ratio and a preset ratio threshold.
[0007] In a third aspect, the present application provides an electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores one or more computer programs executable by the at least one processor, and one or more of the computer programs are executed by the at least one processor so that the at least one processor can execute the above-mentioned interface detection method.
[0008] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the above-mentioned interface detection method when executed by a processor.
[0009] In a fifth aspect, the present application provides a computer program product, comprising a computer-readable code, or a non-volatile computer-readable storage medium carrying a computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device implements the above-mentioned interface detection method when executed.
[0010] The embodiment provided by the present application, first, for different abnormal interfaces, obtain the interface detection task of the abnormal interface, so as to detect the abnormal interface using the interface detection task; then, by executing N times of interface detection tasks, N detection data are obtained, N is an integer greater than 1, and the abnormal interface can be detected multiple times, and the state of the abnormal interface is measured based on the obtained N detection data to determine whether the abnormal interface is repaired. Compared with the manual detection method in the prior art, the present application can automatically obtain N detection data, and then count the N detection data, obtain the abnormal ratio of abnormal data in the N detection data, and reflect the abnormal ratio of the abnormal interface in the process of executing multiple tasks through the abnormal ratio, so as to ensure the accuracy of the final detection result; by comparing the abnormal ratio with the preset ratio threshold, the repair of the abnormal interface can be quickly and accurately determined. In summary, compared with the conventional manual verification method, the above-mentioned detection method is used to detect the abnormal interface, which can effectively shorten the processing time of the abnormal interface, improve the detection efficiency of the abnormal interface, and reduce the labor cost.
[0011] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] The accompanying drawings are used to provide a further understanding of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the present application and do not constitute a limitation of the present application. The above and other features and advantages will become more apparent to those skilled in the art by describing detailed example embodiments with reference to the accompanying drawings. In the accompanying drawings:
[0013] Figure 1 A flow chart of an interface detection method provided in an embodiment of the present application is shown.
[0014] Figure 2 A block diagram showing the composition of an interface detection system provided in an embodiment of the present application is shown.
[0015] Figure 3 A flow chart of an interface detection method provided in an embodiment of the present application is shown.
[0016] Figure 4 A flow chart of an interface detection method provided in an embodiment of the present application is shown.
[0017] Figure 5 A flow chart of an interface detection method provided in an embodiment of the present application is shown.
[0018] Figure 6 A block diagram showing the composition of an interface detection device provided in an embodiment of the present application is shown.
[0019] Figure 7 A block diagram of the composition of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0020] In order to enable those skilled in the art to better understand the technical solution of the present application, the exemplary embodiments of the present application are described below in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0021] In the absence of conflict, the embodiments of the present application and the features therein may be combined with each other.
[0022] As used herein, the term "and / or" includes any and all combinations of one or more related enumerated items. The terms used herein are only used to describe specific embodiments and are not intended to limit the present application. As used herein, the singular forms "a" and "the" are also intended to include the plural forms, unless the context clearly indicates otherwise. It will also be understood that when the terms "including" and / or "made of..." are used in this specification, the presence of the features, wholes, steps, operations, elements and / or components is specified, but the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or groups thereof is not excluded. "Connected" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect.
[0023] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by those of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and this application, and will not be interpreted as having an idealized or overly formal meaning unless explicitly defined herein.
[0024] Typically, on the Internet, data is exchanged between systems through specific communication protocol interfaces (eg, Hypertext Transfer Protocol (HTTP) interfaces, etc.), and the stability between the upstream interface and the downstream interface determines the stability of the network service.
[0025] When an abnormality occurs in a downstream interface, the downstream interface will usually no longer be used for data transmission; within a period of time thereafter, the function of the downstream interface will need to be manually verified to determine whether the abnormality of the downstream interface has been repaired, and the data transmission function of the downstream interface will be restored after manual confirmation that the downstream interface has been repaired.
[0026] However, the above-mentioned manual detection method will prolong the detection time of the faulty interface and increase the labor cost; moreover, in the process of manual detection of abnormal interfaces, detection errors will be introduced, reducing the detection efficiency of abnormal interfaces.
[0027] According to the interface detection method of the embodiment of the present application, for different abnormal interfaces, an interface detection task of the abnormal interface is obtained, so that the abnormal interface can be detected using the interface detection task; then, by executing the interface detection task N times, N detection data are obtained, N is an integer greater than 1, and the abnormal interface can be detected multiple times, and the state of the abnormal interface can be measured based on the obtained N detection data to determine whether the abnormal interface is repaired. Compared with the manual detection method in the prior art, the present application can automatically obtain N detection data, and then count the N detection data to obtain the abnormal ratio of the abnormal data in the N detection data, and use the abnormal ratio to reflect the ratio of the abnormal interface that still has abnormalities in the process of executing multiple tasks, thereby ensuring the accuracy of the final detection result; by comparing the abnormal ratio with the preset ratio threshold, the repair status of the abnormal interface can be quickly and accurately determined. Compared with the conventional manual verification method, the use of the above detection method to detect the abnormal interface can effectively shorten the processing time of the abnormal interface, improve the detection efficiency of the abnormal interface, and reduce labor costs.
[0028] The interface detection method according to the embodiment of the present application can be performed by an electronic device such as a terminal device or a server. The terminal device can be a vehicle-mounted device, a user equipment (User Equipment, UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (Personal Digital Assistant, PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. The server can be an independent physical server, a server cluster composed of multiple physical servers, or a cloud server capable of cloud computing. The method can be implemented by a processor calling a computer-readable program instruction stored in a memory. Alternatively, the method can be executed by a server.
[0029] Figure 1 A schematic diagram of a flow chart of an interface detection method provided in an embodiment of the present application is shown. Figure 1 , the method comprising:
[0030] Step S101, obtaining an interface detection task for an abnormal interface.
[0031] The interface detection task is a task to request data from the service main address using the virtual parameter information corresponding to the abnormal interface. The service main address is the address of the server that provides data services to the terminal device through the interface. For example, if a data server can provide data services to the terminal, the address of the data server can be used as the service main address (for example, mainUrl, or http: / / 201.23.101.002, or http: / / AAA.BB.CC.DD, etc.).
[0032] By acquiring the interface detection task of the abnormal interface, the abnormal interface can be detected by explicitly requesting data from the service main address to determine whether the abnormal interface is repaired, thereby speeding up the detection speed of the abnormal interface.
[0033] In some exemplary embodiments, obtaining an interface detection task for an abnormal interface includes: generating an interface detection task according to a service primary address and virtual parameter information of the abnormal interface.
[0034] Among them, the virtual parameter information is set based on the actual parameter information of the abnormal interface. For example, the virtual parameter information is the configuration parameter information set based on the actual parameter information corresponding to the abnormal interface, and the abnormal interface is an interface with abnormal data acquisition from the service main address. For example, the actual parameter information corresponding to the abnormal interface includes: product code (such as, the actual value is "000xxyy") and application number (such as, the actual value is "000aabbcc").
[0035] When setting the virtual parameter information corresponding to the abnormal interface, the virtual parameter information of the abnormal interface can be obtained by changing the values of its product code and application number. For example, the virtual parameter information corresponding to the abnormal interface is set to: product code (virtual value is "0001122"), application number (virtual value is "000223344"). Correspondingly, the interface detection task can be characterized as a task of requesting data corresponding to the product code from the service main address based on the product code ("0001122") and application number ("000223344").
[0036] In some exemplary embodiments, the abnormal interface is an interface in which an abnormality occurs in obtaining data from a service main address; before executing step S101, the method further includes: detecting the preset interface based on actual parameter information and the service main address of the preset interface to obtain a detection result; when the detection result indicates that an abnormality exists in the preset interface, determining that the preset interface is an abnormal interface.
[0037] Since the preset interface may be abnormal during data processing, it is necessary to detect the preset interface once every certain period of time (eg, 30 seconds) to determine whether the preset interface can work normally.
[0038] The detection result includes that the data obtained by the preset interface from the service main address is abnormal data. In other words, the preset interface sends a request to obtain data to the service main address, and the data fed back by the service main address is erroneous data, and it can be determined that the detection result indicates that the preset interface is abnormal. For example, by setting an abnormal interface list, the identifiers of multiple abnormal interfaces can be recorded in the abnormal interface list.
[0039] In some embodiments, the service address corresponding to each abnormal interface may be set as a service standby address, and the service standby address is used to respond to an operation request of the abnormal interface.
[0040] When an abnormality is detected in a preset interface, the service address corresponding to the preset interface needs to be set from the original normal service main address (such as http: / / mainUrl) to the service backup address (such as http: / / backUrl) so as to respond to the data request of the abnormal interface through the service backup address. In other words, the data request messages sent through the abnormal interface are all received by the service backup address to reduce the request frequency of the abnormal interface to the service main address, thereby reducing the response frequency of the service main address to abnormal data, so that the service main address can provide data services for other interfaces without abnormalities more quickly.
[0041] By detecting the preset interface in a targeted manner according to the actual parameter information and service main address of the preset interface, it is determined whether the preset interface has an abnormality. When the detection result indicates that the preset interface has an abnormality, the preset interface can be detected as an abnormal interface, and the identifier of the abnormal interface is stored in the abnormal interface list. The number of abnormal interfaces stored in the abnormal interface list is used to characterize the number of abnormal interfaces in the system, so as to facilitate global management of each abnormal interface in the system and improve the security of data transmission in the system.
[0042] Step S102, executing N interface detection tasks to obtain N detection data.
[0043] Where N represents the preset number of detections. Each time an interface detection task is executed, a detection data is obtained.
[0044] The detection data can reflect whether the data fed back by the service main address after the abnormal interface requests data from the service main address is correct. That is, the detection data may include correct data fed back by the service main address, or erroneous data fed back by the service main address (or, if the service main address does not respond to data, it is also confirmed that the detection data is erroneous data).
[0045] In some exemplary embodiments, step S102 may be implemented as follows: when the interface detection task is executed for the i-th time, message interaction is performed with the service main address according to the virtual parameter information and the type of data flowing through the abnormal interface to obtain the i-th detection data.
[0046] The virtual parameter information is information of virtual parameters set based on the actual parameter information corresponding to the abnormal interface. i is an integer less than or equal to N, and the type of data flowing through the abnormal interface includes a data download type or a data upload type.
[0047] For example, when the interface detection task is executed for the i-th time, a data request message corresponding to the type of data flowing through the abnormal interface is generated according to the virtual parameter name, the virtual parameter value and the type of data flowing through the abnormal interface, and the data request message is sent to the service main address; in response to the data response message fed back by the service main address, the i-th detection data is obtained.
[0048] In some embodiments, the data download type can be characterized as a GET type, i.e., requesting the service main address to obtain certain data resources stored thereon (e.g., video data, or audio data, etc.). The data upload type can be characterized as a POST type, i.e., uploading locally stored data to the service main address.
[0049] By performing multiple message interactions with the service main address based on the virtual parameter information and the type of data flowing through the abnormal interface, multiple detection data can be obtained, which facilitates subsequent confirmation of whether the abnormal interface has been repaired based on multiple detection data, thereby improving the detection accuracy of the abnormal interface.
[0050] In some exemplary embodiments, the virtual parameter information includes a virtual parameter name and a virtual parameter value; based on the virtual parameter information and the type of data flowing through the abnormal interface, message interaction is performed with the service main address to obtain the i-th detection data, including: constructing a virtual parameter key-value pair based on the virtual parameter name and the virtual parameter value; generating a data request message based on the virtual parameter key-value pair and the type of data flowing through the abnormal interface; sending the data request message to the service main address; in response to a data response message fed back by the service main address to the data request message, performing semantic analysis on the data response message to obtain the i-th detection data.
[0051] The data response message includes abnormal data or normal data. The virtual parameter key-value pair can be expressed as key-value, where key represents the virtual parameter name and value represents the virtual parameter value. For example, the virtual parameter key-value pair is expressed as {"fileId":"00000000"-"appKey":"00000001"}.
[0052] For example, based on the above-mentioned virtual parameter key-value pair key-value and data download type, a data request message for data download is generated, and then the data request message is sent to the service main address to request the data stored in the service main address that matches the virtual parameter key-value pair key-value; after receiving the data response message fed back by the service main address, the data response message is parsed to obtain the detection data, and then the detection data is semantically analyzed to determine that the detection data is correct data that matches the virtual parameter key-value pair (or, erroneous data that does not match the virtual parameter key-value pair), thereby determining that the i-th detection data is normal data (or, abnormal data).
[0053] For another example, based on the above-mentioned virtual parameter key-value pair key-value and data upload type, a data request message for data upload is generated, and then the data request message is sent to the service main address to upload the locally stored data that matches the virtual parameter key-value pair key-value to the service main address; after receiving the data response message fed back by the service main address, the data response message is parsed to obtain the detection data, and then the detection data is semantically analyzed to determine whether the detection data represents a successful upload (or a failed upload), thereby determining that the i-th detection data is normal data (or abnormal data).
[0054] By interacting with the service main address through messages based on virtual parameter key-value pairs and the type of data flowing through the abnormal interface, it is possible to detect whether the data requested from the service main address through the abnormal interface is normal data, thereby realizing the detection of the data processing function of the abnormal interface, clarifying whether the abnormal interface can work normally, and obtaining normal data.
[0055] In some exemplary embodiments, after sending the data request message to the service primary address, the method further includes: if no data response message is received within the virtual detection timeout period, determining that the i-th detection data is abnormal data.
[0056] Among them, the virtual detection timeout period is a pre-set period. For example, if the virtual detection timeout period is set to 10 seconds, the timing starts from the time the data request message is sent. If the data response message fed back by the service main address is still not received within 10 seconds after the data request message is sent, it indicates that the service main address has not received the data request message sent through the abnormal interface, or there is an abnormality in the data transmission channel between the service main address and the abnormal interface. At this time, it can be determined that the abnormal interface still cannot work normally, that is, the abnormal interface has not been repaired; at this time, the i-th detection data can be set as abnormal data, so as to facilitate subsequent statistics based on the number of abnormal data to determine the detection result of the abnormal interface.
[0057] Step S103, performing statistics on the N detection data to obtain the abnormal ratio of abnormal data in the N detection data.
[0058] The abnormality ratio represents the ratio of the number of abnormal data to the preset number of detections. For example, if the number of abnormal data is set to A and the preset number of detections is M, then the abnormality ratio = A / M.
[0059] Measuring the failure rate of requesting data from the service main address through the abnormal ratio can effectively determine whether the abnormal interface can accurately interact with the service main address for data, and then determine whether the abnormal interface has been repaired, thereby improving the detection efficiency of the abnormal interface.
[0060] Step S104: determining the repair status of the abnormal interface according to the abnormal ratio and a preset ratio threshold.
[0061] The repair status of the abnormal interface includes: the abnormal interface has been repaired to a normal interface, or the abnormal interface has not been repaired.
[0062] The detected repair status of the abnormal interface can reflect whether the abnormal interface has been repaired or still has an abnormality (ie, has not been completely repaired), so as to facilitate subsequent monitoring of the abnormal interface.
[0063] In some exemplary embodiments, step S104 can be implemented in the following manner: when the abnormal ratio is greater than a preset ratio threshold, the repair status of the abnormal interface is determined to be unrepaired; when the abnormal ratio is less than or equal to the preset ratio threshold, the repair status of the abnormal interface is determined to be repaired.
[0064] The preset ratio threshold is a preset threshold, for example, the preset ratio threshold is set to 80%, which indicates that when more than 80% of the received multiple detection data are abnormal data, it can be determined that the abnormal interface has not been repaired. When less than or equal to 80% of the received multiple detection data are abnormal data, it indicates that the abnormal interface has been repaired.
[0065] By comparing the abnormal ratio with the preset ratio threshold, it is possible to quickly and easily determine whether the abnormal interface has been repaired, without the need for manual inspection of the abnormal interface. This not only reduces labor costs, but also improves the detection efficiency of abnormal interfaces and ensures the accuracy of detection of abnormal interfaces.
[0066] In some exemplary embodiments, the abnormal interface corresponds to a service backup address, and the service backup address is used to respond to operation requests of the abnormal interface; the method also includes: when the repair situation indicates that the abnormal interface has not been repaired, the address used to respond to operation requests of the abnormal interface is set to the service backup address; when the repair situation indicates that the abnormal interface has been repaired, the address used to respond to operation requests of the abnormal interface is switched from the service backup address to the service main address.
[0067] When the repair status indicates that the abnormal interface has not been repaired, it means that there is still an abnormality in the data transmission through the abnormal interface, and the correct data cannot be obtained from the service main address. Therefore, it is necessary to set the address used to respond to the operation request of the abnormal interface to the service backup address, so that the data requested through the abnormal interface flows to the service backup address, reducing the request frequency of the abnormal interface to the service main address, thereby reducing the response frequency of the service main address to abnormal data, so that the service main address can provide data services for other interfaces without abnormalities more quickly.
[0068] When the repair status indicates that the abnormal interface has been repaired, the abnormal interface can be restored to normal communication by switching the service backup address corresponding to the abnormal interface to the service primary address and deleting the identifier of the abnormal interface from the abnormal interface list.
[0069] Among them, since the abnormal interface has been repaired, it means that the correct data can be obtained from the service main address through the abnormal interface. Therefore, the service backup address corresponding to the abnormal interface can be switched to the service main address, so that normal data can be obtained from the service main address through the abnormal interface; the normal operation of the abnormal interface can be restored in time to improve the efficiency of data transmission.
[0070] Furthermore, by deleting the identifier of the abnormal interface from the abnormal interface list, the abnormal interface will not be detected next time the abnormal interface list is traversed, thereby improving the detection efficiency of other abnormal interfaces in the abnormal interface list.
[0071] According to an embodiment of the present application, for different abnormal interfaces, an interface detection task of the abnormal interface is obtained so as to detect the abnormal interface using the interface detection task; then, by executing the interface detection task N times, N detection data are obtained, N is an integer greater than 1, and the abnormal interface can be detected multiple times, and the state of the abnormal interface can be measured based on the obtained N detection data to determine whether the abnormal interface is repaired. Compared with the manual detection method in the prior art, the present application can automatically obtain N detection data, and then count the N detection data to obtain the abnormal ratio of the abnormal data in the N detection data, and reflect the ratio of the abnormal interface that still has abnormalities in the process of executing multiple tasks through the abnormal ratio, thereby ensuring the accuracy of the final detection result; by comparing the abnormal ratio with the preset ratio threshold, the repair status of the abnormal interface can be quickly and accurately determined. Compared with the conventional manual verification method, the use of the above-mentioned detection method to detect the abnormal interface can effectively shorten the processing time of the abnormal interface, improve the detection efficiency of the abnormal interface, and reduce labor costs.
[0072] The following is a detailed description of the interface detection method according to an embodiment of the present application.
[0073] Figure 2 FIG. 1 is a block diagram showing a composition of an interface detection system provided by an embodiment of the present application. Figure 2 As shown, the interface detection system 200 provided in this embodiment includes but is not limited to the following modules: a detection policy configuration module 201 , an interface detection module 202 , an automatic backup scheduling module 203 , and an automatic recovery scheduling module 204 .
[0074] The detection strategy configuration module 201 is used to configure the interface identifier (or called the service code of the interface), the service primary address, the service backup address, the data type of the detection data obtained based on the virtual detection parameters, the preset virtual detection timeout period, the detection script, the preset ratio threshold, the detection time, the virtual parameter information, etc.
[0075] For example, when the interface is an ID card recognition interface, Table 1 shows a list of configuration information of the interface provided in an embodiment of the present application.
[0076] Table 1 List of configuration information of interfaces provided in the embodiment of the present application
[0077]
[0078] As shown in Table 1, the identifier of the interface is used to uniquely identify the interface.
[0079] The service backup address is used to replace the service primary address and respond to operation requests of abnormal interfaces.
[0080] The detection script is a script for realizing the detection of the preset interface or abnormal interface. Among them, the antrl script can be used to realize the function of the detection script. When the output of the script is "TRUE", it can be determined that the detection of the preset interface (or abnormal interface) is successful, that is, the data obtained through the preset interface (or abnormal interface) is correct. When the output of the script is "FALSE", it can be determined that the detection of the preset interface (or abnormal interface) fails, that is, the data obtained through the preset interface (or abnormal interface) is wrong.
[0081] Detection duration is used to determine the detection duration of the preset interface (or abnormal interface), and the unit is ms.
[0082] The types of data flowing through the abnormal interface include: data download type (GET) or data upload type (POST).
[0083] The preset virtual detection timeout duration is used for the timeout duration in ms when the service primary address does not feedback a response message during the process of requesting data from the service primary address through the abnormal interface based on the virtual parameter information.
[0084] The preset detection times indicate the number of data request messages sent to the service primary address through the abnormal interface.
[0085] The virtual parameter information includes a virtual parameter name and a virtual parameter value. For example, the virtual parameter name is the product code "00000000", and its corresponding virtual parameter value is "00000001".
[0086] The interface detection module 202 is used to perform real-time detection on a preset interface (for example, an interface identified as ocr_rec) when it is determined that the information configured by the detection policy configuration module 201 is effective, determine whether there is an abnormality in the process of making data requests through each preset interface, and store the preset interface with the abnormality in an abnormal interface list; and / or, perform real-time detection on the abnormal interface in the abnormal interface list to determine whether the abnormal interface has been repaired, and when it is determined that the abnormal interface has been repaired, delete the identifier of the abnormal interface from the abnormal interface list.
[0087] The automatic backup scheduling module 203 is used to scan multiple preset interfaces at intervals of a first detection time, determine whether each preset interface has an abnormality in the process of making data requests, and obtain the abnormality ratio corresponding to each preset interface; when the abnormality ratio of the preset interface is greater than the preset ratio threshold, determine that the preset interface is an abnormal interface, and store the identifier of the abnormal interface and its corresponding downgrade identifier (for example, the downgrade identifier is "1" or "TRUE", etc.) in the abnormal interface list; at the same time, change the service primary address corresponding to the abnormal interface to a service backup address, so that data can only be accessed to the service backup address through the abnormal interface.
[0088] The automatic recovery scheduling module 204 is used to confirm whether multiple abnormal interfaces in the abnormal interface list have resumed normal operation every second detection time interval, and obtain the abnormal ratio corresponding to the abnormal interface; when the abnormal ratio corresponding to the abnormal interface is less than or equal to the preset ratio threshold, it is determined that the abnormal interface has been repaired; then, the service backup address corresponding to the abnormal interface is switched to the service main address, and the identifier of the abnormal interface is deleted from the abnormal interface list.
[0089] In this embodiment, the interface detection module 202 performs real-time detection on the preset interface (or, abnormal interface) respectively, so as to realize automatic detection of the interface, reduce manual intervention, and reduce the occurrence rate of detection errors caused by manual operation; and the automatic backup scheduling module 203 scans multiple preset interfaces to determine whether each preset interface has an abnormality in the process of making data requests, and changes the preset interface with the abnormality to the abnormal interface, and changes the service main address corresponding to the abnormal interface to the service backup address, so as to reduce the calling frequency of the abnormal interface to the service main address; and stores the identifier of the abnormal interface in the abnormal interface list, so as to facilitate the automatic recovery scheduling module 204 to detect whether the abnormal interface has restored normal operation. When an abnormal interface in the abnormal interface list has been repaired, the identifier of the abnormal interface can be deleted from the abnormal interface list, and the service backup address corresponding to the abnormal interface can be switched to the service main address, so as to realize the automatic conversion of the abnormal judgment of the preset interface and the recovery of the abnormal interface, and effectively ensure the continuity of data transmission and business processing through each interface. Compared with the conventional manual verification method, the interface detection system provided in this embodiment can effectively shorten the processing time of the abnormal interface and reduce the labor cost.
[0090] Figure 3 FIG. 2 is a flow chart of an interface detection method provided in an embodiment of the present application. The interface detection method is applied to the interface monitoring module 202. Figure 3 As shown, the interface detection method includes but is not limited to the following steps.
[0091] Step S301, obtaining actual parameter information corresponding to a preset interface, a degradation identifier corresponding to the preset interface, a service primary address, and a service backup address.
[0092] The actual parameter information corresponding to the preset interface includes: product code and / or application number, etc. The downgrade identifier corresponding to the preset interface is an identifier obtained from the preset database, and the downgrade identifier is used to indicate whether the preset interface is an abnormal interface.
[0093] For example, if the degradation flag is "1" (or "TURE"), it indicates that the preset interface is an abnormal interface; if the degradation flag is "0" (or "FALSE"), it indicates that the preset interface is not an abnormal interface.
[0094] In some embodiments, the preset database is a Redis database, which is an open source log-type, Key-Value database written in a preset programming language, supporting the network, and capable of persistence based on memory. The Redis database can provide APIs in multiple languages to the outside world. Among them, the downgrade identifier corresponding to the preset interface can be specifically stored in the downgrade list set of the Redis database.
[0095] The service primary address can be represented as mainUrl; the service backup address can be represented as backUrl. The above two addresses are address information configured by the detection strategy configuration module 201.
[0096] Step S302: judging whether the preset interface is an abnormal interface according to the degradation flag corresponding to the preset interface.
[0097] If it is determined that the preset interface is not an abnormal interface, step S303 is executed; if it is determined that the preset interface is an abnormal interface, step S308 is executed.
[0098] Step S303: Generate an interface detection task according to the actual parameter information and service main address corresponding to the preset interface.
[0099] Step S304, repeatedly executing the interface detection task within a preset time period to obtain a plurality of detection data; and performing statistics on the plurality of detection data to obtain an abnormality ratio.
[0100] The number of detection data is the preset detection number N.
[0101] In some embodiments, the interface detection task can be repeatedly performed in the form of a test script. For example, an antrl script is pre-written, in which an interface detection message is generated based on actual parameter information corresponding to a preset interface and a service main address, and the interface detection message is cyclically sent to the service main address according to a preset number of detections to obtain detection data.
[0102] For example, the antrl script is expressed as:
[0103]
[0104] It should be noted that, when it is determined that the acquired detection data code is empty (that is, the preset interface cannot obtain the detection data from the service main address), the i-th detection data is determined to be abnormal data; when it is determined that the acquired detection data code is not empty (that is, the preset interface can normally obtain the detection data from the service main address), the i-th detection data is determined to be normal data.
[0105] Wherein, i is an integer less than or equal to N.
[0106] In some embodiments, it is set that statistics are collected on a plurality of detection data every 10 seconds to obtain an abnormality ratio.
[0107] Step S305 , judging whether the abnormal ratio is greater than a preset ratio threshold, so as to determine whether the preset interface is changed to an abnormal interface.
[0108] When it is determined that the abnormality ratio is less than or equal to a preset ratio threshold (for example, set to 90%), it is determined that the detection result of the preset interface indicates that no abnormality occurs in the preset interface, indicating that the preset interface can still work normally, and step S306 is executed.
[0109] When it is determined that the abnormal ratio is greater than the preset ratio threshold, it is determined that the detection result of the preset interface indicates that the preset interface is abnormal, indicating that the preset interface has been changed to an abnormal interface, and step S307 is executed.
[0110] Step S306, record the time information of obtaining the detection result of the preset interface, keep the degradation flag corresponding to the preset interface as "0", and store the above information in the preset database.
[0111] Among them, the information stored in the preset database is a microservice built in the form of ocr_rec service.
[0112] Step S307, record the time information of obtaining the detection result of the preset interface, update the degradation flag corresponding to the preset interface to "1", and store the above information in the preset database.
[0113] Step S308: Switch the service primary address corresponding to the abnormal interface to the service backup address.
[0114] Among them, switching the mainUrl corresponding to the abnormal interface to backUrl can effectively reduce the frequency of obtaining data from the service main address through the abnormal interface, thereby reducing the number of invalid visits to the service main address.
[0115] In this embodiment, a downgrade flag corresponding to a preset interface is used to determine whether the preset interface has been determined as an abnormal interface. When it is determined that the preset interface is not an abnormal interface, an interface detection task is generated through the actual parameter information and the service main address corresponding to the preset interface. Then, the interface detection task is repeatedly executed to obtain multiple detection data; and statistics are performed on the multiple detection data to obtain an abnormal ratio, so that it is possible to characterize whether there is an abnormality in the preset interface during data transmission based on the abnormal ratio. When it is determined that the abnormal ratio is greater than a preset ratio threshold, it is determined that the preset interface has been changed to an abnormal interface, and it is necessary to update the downgrade flag corresponding to the preset interface, and switch the service main address corresponding to the abnormal interface to a service standby address, so that the data requested by the abnormal interface flows to the service standby address, reducing the request frequency of the abnormal interface to the service main address, thereby reducing the response frequency of the service main address to abnormal data, so that the service main address can provide data services for other preset interfaces more quickly.
[0116] Figure 4A flow chart of an interface detection method provided by an embodiment of the present application is shown. The interface detection method is applied to the automatic backup scheduling module 203. The automatic backup scheduling module 203 executes the interface detection method once every first detection time (eg, 2 seconds).
[0117] like Figure 4 As shown, the interface detection method includes but is not limited to the following steps.
[0118] Step S401, obtaining the information list configured by the detection strategy configuration module 201.
[0119] The information list includes at least one of the following information: interface identifier (also called service code serviceCode), service main address (mainUrl), service backup address (backUrl), preset duration (timeGap), and preset ratio threshold (checkRate).
[0120] For example, the information list includes N service codes, where N is an integer greater than or equal to 1. Each service code corresponds to a mainUrl (or a backUrl).
[0121] Step S402, determining whether the j-th service code is stored in the abnormal interface list.
[0122] Wherein, j is an integer greater than or equal to 1 and less than or equal to N-1. The abnormal interface list may be a downgrade list set in the Redis database.
[0123] If it is determined that the j-th service code is not stored in the demotion list set of the Redis database, step S403 is executed; if it is determined that the j-th service code is already stored in the demotion list set of the Redis database, step S407 is executed.
[0124] Step S403: Search the data stored in the Redis database according to the j-th service code to obtain a detection data list corresponding to the j-th service code.
[0125] The detection data list corresponding to the jth service code includes multiple detection data, each of which is obtained by executing the interface detection task, and the difference between the current time (currentTime) and the end time (endTime) of the interface detection task is less than or equal to timeGap, that is, currentTime-endTime<=timeGap
[0126] Step S404, obtaining the abnormal ratio within the timeGap through statistics.
[0127] The abnormal ratio represents the detection data as the ratio of the number of abnormal data to the preset detection times (errorRate).
[0128] Step S405, determining whether the abnormal ratio is greater than a preset ratio threshold.
[0129] If it is determined that the abnormality ratio is greater than checkRate, step S406 is executed; if it is determined that the abnormality ratio is less than or equal to checkRate, step S407 is executed.
[0130] Step S406, marking the degradation flag of the jth service code as "1"; and storing the jth service code and its corresponding degradation flag in the abnormal interface list.
[0131] Step S407, perform a self-increment operation on j to obtain the value of j+1, and set the value amplitude of j+1 to j.
[0132] After executing step S407, return to continue executing step S402.
[0133] By cyclically executing the above steps S402 to S407, each service code in the information list is processed until all N service codes are processed.
[0134] Figure 5 A flow chart of an interface detection method provided by an embodiment of the present application is shown. The interface detection method is applied to the automatic recovery scheduling module 204. The automatic recovery scheduling module 204 executes the interface detection method once every second detection time (eg, 10 seconds, 30 seconds, etc.).
[0135] like Figure 5 As shown, the interface detection method includes but is not limited to the following steps.
[0136] Step S501 , obtaining the abnormal interface list output by the automatic backup scheduling module 203 .
[0137] The abnormal interface list includes the identifiers of M abnormal interfaces (eg, service codes of the abnormal interfaces) and the detection strategies corresponding to the abnormal interfaces. M is an integer greater than or equal to 1.
[0138] Step S502: Search the abnormal interface list according to the serviceCode of the kth abnormal interface to obtain the detection strategy corresponding to the kth abnormal interface.
[0139] Here, k is an integer greater than or equal to 1 and less than or equal to M-1.
[0140] The detection strategy corresponding to the k-th abnormal interface includes: mainUrl, checkRate, virtual parameter information (virtualParamInfo), virtual detection timeout (virtualReadTimeOut), virtual detection data request type (virtualMethodType), and preset detection times (virtualCount).
[0141] The following steps S503 to S510 may be used to characterize the execution process of the detection strategy corresponding to the kth abnormal interface.
[0142] Step S503: for the kth abnormal interface, construct a virtual parameter key-value pair according to the virtual parameter name and the virtual parameter value; and generate a data request message according to the virtual parameter key-value pair and the data request type.
[0143] The virtual parameter key-value pair can be expressed as key-value, where key represents the virtual parameter name and value represents the virtual parameter value. For example, the virtual parameter key-value pair is expressed as {"fileId":"00000000"-"appKey":"00000001"}.
[0144] Step S504: Send a data request message to the service primary address.
[0145] The type of data flowing through the abnormal interface (virtualMethodType) includes: data download type or data upload type. The data download type indicates that a request is made to the service main address to obtain the data stored therein and download the data to the current device. For example, the GET instruction is used for indication.
[0146] The data upload type indicates uploading the data stored in the current device to the service main address, for example, using the POST instruction.
[0147] Step S505 , in response to the data response message fed back by the service primary address, semantic analysis is performed on the data response message to determine the data type of the kth detection data.
[0148] The data type of the detection data includes abnormal data or normal data.
[0149] In some embodiments, if no data response message is received within a preset virtual detection timeout period (virtualReadTimeOut), for example, virtualReadTimeOut is set to 3 seconds, and the timing starts from the time the data request message is sent. If no data response message is received within 3 seconds, the data type of the kth detection data is determined to be abnormal data.
[0150] Step S506, repeating the above steps S503 to S505 according to a preset number of detection times to obtain a plurality of detection data.
[0151] The number of detection data is a preset number of detection times. For example, the preset number of detection times can be set to 10 times.
[0152] Step S507, performing statistics on a plurality of detection data to obtain an abnormality ratio.
[0153] The error rate (errorRate) = the number of detected data that are abnormal data / preset detection times (virtualCount).
[0154] Step S508, determining whether the abnormal ratio is greater than a preset ratio threshold.
[0155] When it is determined that the abnormal ratio is greater than a preset ratio threshold (for example, set to 90%), the detection result of the abnormal interface is determined to be that the abnormal interface has not been repaired, and step S509 is executed; when it is determined that the abnormal ratio is less than or equal to the preset ratio threshold, the detection result of the abnormal interface is determined to be that the abnormal interface has been repaired, and step S510 is executed.
[0156] Step S509: keep the service standby address corresponding to the abnormal interface unchanged.
[0157] After executing step S509, continue to execute step S511.
[0158] Step S510: switch the service standby address corresponding to the abnormal interface to the service primary address, and delete the identifier of the abnormal interface from the abnormal interface list.
[0159] In some embodiments, the abnormal interface list may further store the identifier of the microservice corresponding to the abnormal interface. For example, when it is determined that the kth abnormal interface has been repaired, the identifier of the microservice corresponding to the serviceCode of the kth abnormal interface is deleted from the abnormal interface list.
[0160] The microservice corresponding to the serviceCode of the kth abnormal interface may be the ocr_rec service, that is, a service for characterizing the identification of the user.
[0161] Step S511, perform a self-increment operation on k to obtain the value of k+1, and set the value amplitude of k+1 to k.
[0162] After executing step S511, the process returns to executing step S502 until all the M abnormal interfaces in the abnormal interface list are processed.
[0163] In this embodiment, by detecting multiple abnormal interfaces in the abnormal interface list in turn, a data request message can be generated based on the virtual parameter information and data request type corresponding to the abnormal interface; then, the data request message is repeatedly sent to the service main address multiple times to obtain multiple detection data fed back by the service main address, and multiple detection data are used to reflect whether the abnormal interface can normally obtain normal data from the service main address. Compared with the conventional manual verification method, the use of the above-mentioned detection method to detect the abnormal interface can effectively shorten the processing time of the abnormal interface and reduce labor costs; further, multiple detection data are counted, and the obtained abnormal ratio reflects the ratio of the abnormal interface that still has abnormalities in the process of executing multiple tasks; then, the abnormal ratio is compared with the preset ratio threshold, so as to quickly and accurately determine whether the abnormal interface has been repaired, thereby improving the detection efficiency of the abnormal interface.
[0164] It can be understood that the above-mentioned various method embodiments mentioned in this application can be combined with each other to form a combined embodiment without violating the principle logic. Due to space limitations, this application will not go into details. Those skilled in the art can understand that in the above-mentioned method of the specific implementation method, the specific execution order of each step should be determined by its function and possible internal logic.
[0165] In addition, the present application also provides an interface detection device, an electronic device, a computer-readable storage medium and a computer program product, all of which can be used to implement any interface detection method provided by the present application. The corresponding technical solutions and descriptions are referred to in the corresponding records of the method part and will not be repeated here.
[0166] Figure 6 FIG. 1 is a block diagram showing a composition of an interface detection device provided in an embodiment of the present application. Figure 6 As shown, the interface detection device 600 provided in the embodiment of the present application includes but is not limited to the following modules.
[0167] A generating module 601 is used to obtain an interface detection task of an abnormal interface;
[0168] An execution module 602 is used to execute N interface detection tasks to obtain N detection data, where N is an integer greater than 1;
[0169] The statistical module 603 is used to perform statistics on the N detection data to obtain the abnormal ratio of abnormal data in the N detection data;
[0170] The determination module 604 is used to determine the repair status of the abnormal interface according to the abnormal ratio and the preset ratio threshold.
[0171] It should be noted that the interface detection device in the embodiment of the present application can implement any interface detection method provided in the embodiment of the present application, which will not be described in detail here.
[0172] According to the interface detection device in this embodiment, for different abnormal interfaces, a generation module is used to obtain an interface detection task of the abnormal interface, so as to detect the abnormal interface using the interface detection task; then, by using the execution module to execute N interface detection tasks, N detection data are obtained, N is an integer greater than 1, and the abnormal interface can be detected multiple times, and the state of the abnormal interface can be measured based on the obtained N detection data to determine whether the abnormal interface is repaired. Compared with the manual detection method in the prior art, the present application can automatically obtain N detection data, and then use the statistical module to count the N detection data to obtain the abnormal ratio of the abnormal data in the N detection data, and the abnormal ratio is used to reflect the ratio of the abnormal interface that still has abnormalities in the process of executing multiple tasks, thereby ensuring the accuracy of the final detection result; by comparing the abnormal ratio with the preset ratio threshold through the determination module, the repair status of the abnormal interface can be quickly and accurately determined. Compared with the conventional manual verification method, the above-mentioned detection method is used to detect the abnormal interface, which can effectively shorten the processing time of the abnormal interface, improve the detection efficiency of the abnormal interface, and reduce the labor cost.
[0173] Each module in the above interface detection device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module.
[0174] Figure 7 A block diagram of the composition of an electronic device provided in an embodiment of the present application is shown.
[0175] like Figure 7 As shown, the electronic device includes: at least one processor 701, at least one memory 702, and one or more I / O interfaces 703. The processor 701, the memory 702, and the I / O interface 703 are interconnected via a bus 704. The memory 702 stores one or more computer programs, and the one or more computer programs are executed by the at least one processor 701, so that the at least one processor 701 can implement any one of the interface detection methods described in the above embodiments.
[0176] Among them, the interface detection method includes: obtaining an interface detection task for an abnormal interface; executing the interface detection task N times to obtain N detection data, where N is an integer greater than 1; performing statistics on the N detection data to obtain the abnormal ratio of abnormal data in the N detection data; and determining the repair status of the abnormal interface based on the abnormal ratio and a preset ratio threshold.
[0177] In some exemplary embodiments, the repair status of the abnormal interface is determined based on the abnormal ratio and the preset ratio threshold, including: when the abnormal ratio is greater than the preset ratio threshold, the repair status of the abnormal interface is determined to be unrepaired; when the abnormal ratio is less than or equal to the preset ratio threshold, the repair status of the abnormal interface is determined to be repaired.
[0178] In some exemplary embodiments, the abnormal interface is an interface in which there is an abnormality in obtaining data from the service main address; the method also includes: detecting the preset interface according to the actual parameter information and the service main address of the preset interface to obtain a detection result; when the detection result indicates that there is an abnormality in the preset interface, determining that the preset interface is an abnormal interface.
[0179] In some exemplary embodiments, the abnormal interface corresponds to a service backup address, and the service backup address is used to respond to operation requests of the abnormal interface; the method also includes: when the repair situation indicates that the abnormal interface has not been repaired, the address used to respond to operation requests of the abnormal interface is set to the service backup address; when the repair situation indicates that the abnormal interface has been repaired, the address used to respond to operation requests of the abnormal interface is switched from the service backup address to the service main address.
[0180] In some exemplary embodiments, obtaining an interface detection task for an abnormal interface includes: generating an interface detection task according to a service primary address and virtual parameter information of the abnormal interface; wherein the virtual parameter information is set based on actual parameter information of the abnormal interface.
[0181] In some exemplary embodiments, N interface detection tasks are performed to obtain N detection data, including: when the interface detection task is performed for the i-th time, message interaction is performed with the service main address according to the virtual parameter information and the type of data flowing through the abnormal interface to obtain the i-th detection data; wherein i is an integer less than or equal to N, and the type of data flowing through the abnormal interface includes a data download type or a data upload type.
[0182] In some exemplary embodiments, the virtual parameter information includes a virtual parameter name and a virtual parameter value; based on the virtual parameter information and the type of data flowing through the abnormal interface, message interaction is performed with the service main address to obtain the i-th detection data, including: constructing a virtual parameter key-value pair based on the virtual parameter name and the virtual parameter value; generating a data request message based on the virtual parameter key-value pair and the type of data flowing through the abnormal interface; sending the data request message to the service main address; in response to a data response message fed back by the service main address to the data request message, performing semantic analysis on the data response message to obtain the i-th detection data.
[0183] In some exemplary embodiments, after sending the data request message to the service primary address, the method further includes: if no data response message is received within the virtual detection timeout period, determining that the i-th detection data is abnormal data.
[0184] Each module in the above electronic device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0185] The embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored, wherein the computer program implements the above-mentioned interface detection method when executed by a processor. The computer-readable storage medium may be a volatile or non-volatile computer-readable storage medium.
[0186] An embodiment of the present application also provides a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the above-mentioned interface detection method.
[0187] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In a hardware implementation, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or may be implemented as hardware, or may be implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable storage medium, which may include a computer storage medium (or a non-transitory medium) and a communication medium (or a temporary medium).
[0188] As is known to those of ordinary skill in the art, the term computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable program instructions, data structures, program modules or other data). Computer storage media include, but are not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), static random access memory (SRAM), flash memory or other memory technology, portable compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and can be accessed by a computer. In addition, it is known to those of ordinary skill in the art that communication media typically contain computer-readable program instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transmission mechanism, and may include any information delivery medium.
[0189] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.
[0190] The computer program instructions for performing the operation of the present application can be assembler instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions can be executed completely on a user's computer, partially on a user's computer, executed as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet). In some embodiments, by using the state information of a computer-readable program instruction to personalize an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA) or a programmable logic array (PLA), the electronic circuit can execute a computer-readable program instruction, thereby realizing various aspects of the present application.
[0191] The computer program product described herein may be implemented in hardware, software, or a combination thereof. In one optional embodiment, the computer program product is embodied as a computer storage medium, and in another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (SDK), etc.
[0192] Various aspects of the present application are described herein with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present application. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0193] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0194] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0195] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the logical function of the specification. In some alternative implementations, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can also be executed in the opposite order sometimes, depending on the function involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be realized by a dedicated hardware-based system that performs the function or action of the specification, or can be realized by a combination of special-purpose hardware and computer instructions.
[0196] Example embodiments have been disclosed herein, and although specific terms are employed, they are used and should be interpreted only in a general illustrative sense and not for limiting purposes. In some instances, it will be apparent to those skilled in the art that, unless otherwise expressly noted, features, characteristics, and / or elements described in conjunction with a particular embodiment may be used alone or in combination with features, characteristics, and / or elements described in conjunction with other embodiments. Therefore, those skilled in the art will appreciate that various changes in form and detail may be made without departing from the scope of the present application as set forth in the appended claims.
Claims
1. An interface detection method, characterized in that: include: Get the interface detection task of abnormal interface; Execute the interface detection task N times to obtain N detection data, where N is an integer greater than 1; Performing statistics on the N detection data to obtain an abnormal ratio of abnormal data in the N detection data; A repair status of the abnormal interface is determined according to the abnormal ratio and a preset ratio threshold.
2. The method according to claim 1, characterized in that The determining, according to the abnormal ratio and a preset ratio threshold, a repair status of the abnormal interface includes: In the case where the abnormal ratio is greater than the preset ratio threshold, determining that the repair status of the abnormal interface is not repaired; When the abnormal ratio is less than or equal to the preset ratio threshold, it is determined that the repair status of the abnormal interface has been repaired.
3. The method according to claim 1, characterized in that The abnormal interface is an interface in which data obtained from the service main address is abnormal; the method also includes: According to the actual parameter information of the preset interface and the service main address, the preset interface is detected to obtain a detection result; When the detection result indicates that the preset interface is abnormal, the preset interface is determined to be the abnormal interface.
4. The method according to claim 1, characterized in that: The abnormal interface corresponds to a service standby address, and the service standby address is used to respond to the operation request of the abnormal interface; the method also includes: When the repair situation indicates that the abnormal interface has not been repaired, setting the address used to respond to the operation request of the abnormal interface as the service standby address; When the repair situation indicates that the abnormal interface has been repaired, the address used to respond to the operation request of the abnormal interface is switched from the service standby address to the service primary address.
5. The method according to claim 1, characterized in that The interface detection task of obtaining the abnormal interface includes: The interface detection task is generated according to the service main address and the virtual parameter information of the abnormal interface; wherein the virtual parameter information is set based on the actual parameter information of the abnormal interface.
6. The method according to claim 5, characterized in that The performing of the interface detection task N times to obtain N detection data includes: When the interface detection task is executed for the i-th time, a message interaction is performed with the service main address according to the virtual parameter information and the type of data flowing through the abnormal interface to obtain the i-th detection data; Wherein, i is an integer less than or equal to N, and the type of data flowing through the abnormal interface includes a data download type or a data upload type.
7. The method according to claim 6, characterized in that The virtual parameter information includes a virtual parameter name and a virtual parameter value; The method of performing message interaction with the service main address according to the virtual parameter information and the type of data flowing through the abnormal interface to obtain the i-th detection data includes: Constructing a virtual parameter key-value pair according to the virtual parameter name and the virtual parameter value; Generate a data request message according to the virtual parameter key-value pair and the type of data flowing through the abnormal interface; Sending the data request message to the service primary address; In response to a data response message fed back by the service primary address in response to the data request message, a semantic analysis is performed on the data response message to obtain the i-th detection data.
8. The method according to claim 7, characterized in that After sending the data request message to the service primary address, the method further includes: When the data response message is not received within the virtual detection timeout period, it is determined that the i-th detection data is abnormal data.
9. An interface detection device, characterized in that: include: A generation module is used to obtain interface detection tasks of abnormal interfaces; An execution module, used for executing the interface detection task N times to obtain N detection data, where N is an integer greater than 1; A statistical module, used for performing statistics on the N detection data to obtain an abnormal ratio of abnormal data in the N detection data; A determination module is used to determine the repair status of the abnormal interface according to the abnormal ratio and a preset ratio threshold.
10. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores one or more computer programs executable by the at least one processor, and the one or more computer programs are executed by the at least one processor to enable the at least one processor to perform the interface detection method according to any one of claims 1 to 8.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the computer program implements the interface detection method according to any one of claims 1 to 8.
12. A computer program product, characterized in that The invention comprises a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device implements the interface detection method as described in any one of claims 1 to 8 when executing the code.
Citation Information
Cited By
Communication processing method and device, electronic equipment and storage medium
CN121125449A
