Communication fault detection method and device, electronic equipment and storage medium
By obtaining endpoint information of the GRPC service endpoint, sending test requests and filtering target metadata, and identifying erroneous metadata, the problem of frequent tool switching and manual integration in GRPC service endpoint detection is solved, achieving automated fault diagnosis and cost savings.
Patent Information
- Application Number
- CN202512032470.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-30
- Publication Date
- 2026-03-10
AI Technical Summary
Existing technologies for GRPC server endpoint detection require multiple tools and manual integration of results, resulting in high detection costs, fragmented processes, and frequent tool switching.
By obtaining endpoint information of the GRPC service endpoint, sending test requests and receiving raw communication messages, filtering target metadata using preset files, identifying error metadata, and matching fault causes from the database.
It enables automated fault diagnosis, saves computing resources and manual integration costs, and accurately analyzes GRPC server endpoint faults.
Smart Images

Figure CN121644408A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, in particular, the present application relates to a communication fault detection method and device, electronic equipment and storage medium. BACKGROUND
[0002] In the detection process of the prior art for GRPC service endpoint, a plurality of detection tools need to be used, and the results output by each detection tool only have data, which requires additional manual intervention for integration. In the detection process, each process is fragmented, and the detection code and detection tools need to be frequently switched each time the detection is performed, and the detection cost is high. SUMMARY
[0003] The present application aims to at least solve one of the above technical defects, and the technical scheme provided by the embodiments of the present application is as follows: In a first aspect, the embodiments of the present application provide a communication fault detection method, comprising: obtaining endpoint information of a GRPC service endpoint to be detected; sending a test request to the GRPC service endpoint based on the endpoint information, and receiving an original communication message returned by the GRPC service endpoint in response to the test request; the original communication message includes a plurality of metadata, and the data value of the metadata is used to indicate the communication state in the detection process; filtering a plurality of target metadata from the plurality of metadata based on a first preset file stored in advance; the first preset file includes a plurality of target metadata for communication fault reason analysis; for each target metadata, if it is determined that the data value of the target metadata is not in the corresponding value range, the target metadata is determined as an error metadata; According to each error metadata, the corresponding communication fault reason is matched and indicated from the preset database.
[0004] In a second aspect, the embodiments of the present application provide a communication fault detection device, comprising: an endpoint information acquisition module configured to obtain endpoint information of a GRPC service endpoint to be detected; a test request sending module configured to send a test request to the GRPC service endpoint based on the endpoint information, and receive an original communication message returned by the GRPC service endpoint in response to the test request; the original communication message includes a plurality of metadata, and the data value of the metadata is used to indicate the communication state in the detection process; a metadata filtering module configured to filter a plurality of target metadata from the plurality of metadata based on a first preset file stored in advance; the first preset file includes a plurality of target metadata for communication fault reason analysis; an error data determination module configured to determine, for each target metadata, the target metadata as error metadata if it is determined that the data value of the target metadata is not in the corresponding value range; a fault analysis module configured to match and indicate the corresponding communication fault cause from a preset database according to each error metadata.
[0005] In a third aspect, an embodiment of the present application provides an electronic device, including a memory, a processor and a computer program stored in the memory; The processor executes the computer program to implement the method provided in the first aspect or any optional embodiment of the first aspect.
[0006] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, and the computer readable storage medium stores a computer program. When the computer program is executed by a processor, the method provided in the first aspect or any optional embodiment of the first aspect is implemented.
[0007] The technical scheme provided by the embodiments of the present application has the following beneficial effects: Firstly, the scheme provided by the present application can send a test request to a GRPC service endpoint to obtain original communication messages about the communication state of the GRPC service, which facilitates subsequent analysis of the communication state. Secondly, the scheme provided by the present application can filter all metadata through a first preset file to filter out metadata related only to the communication state, which can save computing resources consumed during subsequent fault analysis. Finally, the scheme provided by the present application can determine error metadata that has errors according to the value range of each metadata that appears abnormally, and determine the cause of the communication fault from a preset database according to each error metadata, which can accurately analyze and diagnose the fault of the GRPC service endpoint.
[0008] The scheme of the present application can link each detection step, which can avoid switching of detection tools in the prior art, and can analyze the corresponding fault cause according to the detected data and display it without manual integration, which can save costs. BRIEF DESCRIPTION OF DRAWINGS
[0009] In order to more clearly illustrate the technical scheme in the embodiments of the present application, the drawings needed in the description of the embodiments of the present application will be briefly introduced.
[0010] Figure 1 A flowchart of a communication fault detection method provided by an embodiment of the present application; Figure 2Fig. 1 is a flowchart of an overall flowchart of a communication fault detection method according to an example of an embodiment of the present application; Figure 3 Fig. 2 is a structural block diagram of a communication fault detection device according to an example of an embodiment of the present application; Figure 4 Fig. 3 is a structural diagram of an electronic device according to an example of an embodiment of the present application. DETAILED DESCRIPTION
[0011] Embodiments of the present application will be described below with reference to the accompanying drawings. It should be understood that the embodiments described below in conjunction with the drawings are exemplary descriptions of the technical solutions of the embodiments of the present application, and do not limit the technical solutions of the embodiments of the present application.
[0012] Those skilled in the art can understand that the singular forms "a", "an" and "the" used herein include plural forms unless specifically stated otherwise. It should be further understood that the terms "comprise" and "include" used in the embodiments of the present application mean that the corresponding features can be implemented as the presented features, information, data, steps, operations, elements and / or components, but do not exclude other features, information, data, steps, operations, elements, components and / or combinations thereof supported by the present technology. It should be understood that when we say that an element is "connected" or "coupled" to another element, the element can be directly connected or coupled to the other element, or it can mean that the element and the other element are connected through an intermediate element. In addition, "connected" or "coupled" used herein can include wireless connection or wireless coupling. The term "and / or" used herein means that at least one of the items defined by the term, for example, "A and / or B" can be implemented as "A", or as "B", or as "A and B".
[0013] To make the purposes, technical solutions and advantages of the present application clearer, the embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
[0014] The technical solutions of the embodiments of the present application and the technical effects produced by the technical solutions of the present application will be described below through the description of several exemplary embodiments. It should be noted that the following embodiments can be mutually referenced, borrowed or combined, and the same terms, similar features and similar implementation steps in different embodiments will not be described repeatedly.
[0015] Figure 1 Fig. 1 is a flowchart of a communication fault detection method according to an example of an embodiment of the present application, the execution subject of the method can be a terminal (such as a computer, a mobile phone, etc.) or an agent, etc., as shown in Fig. 1, the method can include: Figure 1 Step S101, obtaining endpoint information of a GRPC service endpoint to be detected.
[0016] In the embodiments of the present application, GRPC (GRPC Remote Procedure Calls, a framework name) is a high-performance, open-source general RPC framework. It is based on the HTTP / 2 protocol and the Protocol Buffers (protobuf) serialization protocol, and supports multiple programming languages. The GRPC service endpoint is a remote method contract defined by the service and rpc keywords in the Protocol Buffers (proto file, i.e. the first preset file in the embodiments of the present application) and can be called through a specific path on the network. It specifies the method name, request / response message structure, and communication mode (unary, server stream, client stream, or bidirectional stream).
[0017] Specifically, when a certain GRPC service endpoint needs to be detected, a detection tool provided by the embodiments of the present application can be started in the terminal, and then the endpoint information of the GRPC service endpoint is input into a preset input box in the detection tool. The endpoint information can include service address (IP: port), service name, method name, and HTTP / 2 connection parameters (such as maximum concurrent stream number, stream window size), and the like, which are not limited in the embodiments of the present application.
[0018] Step S102, sending a test request to the GRPC service endpoint based on the endpoint information, and receiving an original communication message returned by the GRPC service endpoint in response to the test request; the original communication message includes multiple metadata, and the data value of the metadata is used to indicate the communication state in the detection process.
[0019] In the embodiments of the present application, the original communication message can be a binary data stream containing serialized request / response data and metadata transmitted between GRPC services based on the HTTP / 2 protocol. The metadata can be the timeout time (timeout), error code (grpc-status), custom header information (such as trace-id), and the like in the present test process, which are not limited in the embodiments of the present application.
[0020] Specifically, after setting the endpoint information of the GRPC service endpoint to be detected, a test request can be initiated to the GRPC service endpoint according to the endpoint information, which can be a data acquisition request, a service start request, etc. The embodiments of the present application do not limit here. After receiving the test request, the GRPC service endpoint will respond to the test request accordingly and return the corresponding original communication message to the terminal. The original communication message can include the response result of the test request and a plurality of metadata, which can reflect whether the communication state in the test process is good.
[0021] In step S103, a plurality of target metadata are filtered from the plurality of metadata based on a first preset file stored in advance; the first preset file includes a plurality of target metadata for communication fault cause analysis.
[0022] In the embodiments of the present application, the first preset file, i.e. the proto file described above, can have metadata for communication state analysis written in advance, and then the first preset file is stored in the terminal. In this way, after receiving the original communication message, the terminal can filter the metadata according to the first preset file, and only keep the target metadata for communication state analysis.
[0023] Specifically, after receiving the original communication message returned by the GRPC service endpoint, the terminal will find and read the first preset file stored in advance, obtain the target metadata written in advance in the first preset file, and then filter the metadata included in the original communication message, and only keep the target metadata in the first preset file.
[0024] In step S104, for each target metadata, if it is determined that the data value of the target metadata is not in the corresponding value range, the target metadata is determined as error metadata.
[0025] In the embodiments of the present application, the value range of each target metadata can represent the range in which the data value of the target metadata should be when the communication state is normal. When the communication state is abnormal, if the data value of the target metadata is not in the value range, it means that the target metadata is error metadata.
[0026] Specifically, after determining each target metadata, the data value range of each target metadata in the normal communication state needs to be obtained first, which can be read from the first preset file. If the first preset file does not store the data value range of each target metadata, the data value range can be determined through networking or historical data, which is not limited in the embodiments of the present application. Then, the data value of each target metadata in the current test request process is compared with the corresponding data value range one by one. If the data value of the target metadata is within the corresponding data value range, it indicates that the current communication state exception is not caused by the target metadata. If the data value of the target metadata is not within the corresponding data value range, it indicates that the current communication state exception is related to the target metadata, and the target metadata is determined as error metadata.
[0027] In step S105, the corresponding communication failure reason is matched and indicated from the preset database according to each error metadata.
[0028] In the embodiments of the present application, the preset database stores each communication failure reason that may occur in the communication state and the error metadata that appears when each communication failure reason appears.
[0029] Specifically, after determining each error metadata, the corresponding communication failure reason that appears when each error metadata appears can be found from the preset database according to each error metadata, and then the communication failure reason is displayed on the preset display screen of the terminal.
[0030] Firstly, the scheme provided by the present application can obtain the original communication message about the communication state of the GRPC service by sending a test request to the GRPC service endpoint, which can facilitate subsequent analysis of the communication state. Secondly, the scheme provided by the present application can filter all metadata through the first preset file, and filter out only the metadata related to the communication state, which can save the computing resources consumed during subsequent fault analysis. Finally, the scheme provided by the present application can determine the error metadata that appears error according to the abnormal value range of each metadata after filtering, and determine the communication failure reason from the preset database according to each error metadata, which can accurately realize the analysis and diagnosis of the fault of the GRPC service endpoint.
[0031] The scheme of the present application can associate each detection step, which can avoid the switching of detection tools in the prior art scheme, and can analyze the corresponding failure reason according to the detected data and display it without manual integration, which can save costs.
[0032] On the basis of each of the above embodiments, as an optional embodiment, after sending the test request to the GRPC service endpoint based on the endpoint information, the method further comprises the step of initiating a network intrusion to the GRPC service endpoint; The method further comprises: acquiring a time length between a time when the test request is sent and a time when the original communication message returned by the GRPC service endpoint is received; determining the resistance of the GRPC service endpoint to the network intrusion based on the time length; wherein the resistance is negatively correlated with the time length.
[0033] Specifically, the test performed by the embodiment of the application to the GRPC service endpoint can include testing the resistance of the GRPC service endpoint to the network intrusion. The testing manner can be initiating a network intrusion to the GRPC service endpoint at the same time or after sending the test request. The network intrusion can be initiated in the form of a DDOS attack, etc. The network intrusion initiation manner of the embodiment of the application is not limited herein. After the network intrusion is initiated, the terminal enters a state of waiting for a response result of the GRPC service endpoint. When the original communication message returned by the GRPC service endpoint is received, a time when the original communication message is received is recorded. Then, a time length from the initiation of the test request to the reception of the original communication message is calculated. The resistance of the GRPC service endpoint to the network intrusion is determined based on the time length. It can be understood that the longer the time length is, the slower the recovery speed of the GRPC service endpoint after being subjected to the network intrusion is, and the weaker the resistance of the GRPC service endpoint to the network intrusion is. Therefore, the resistance is negatively correlated with the time length.
[0034] Optionally, if the terminal does not receive the original communication message returned by the GRPC service endpoint after sending the test request for more than a preset time length, it can be considered that the GRPC service endpoint has no resistance to the network intrusion.
[0035] On the basis of each of the above embodiments, as an optional embodiment, the test request further comprises a second preset file. The test request instructs the GRPC service endpoint to return the received second preset file. receiving the original communication message returned by the GRPC service endpoint for the test request, specifically comprising: receiving the third preset file returned by the GRPC service endpoint; The method further comprises: determining a difference between the second preset file and the third preset file; determining the stability of the GRPC service endpoint based on the difference; the stability represents the file transmission capability of the GRPC service endpoint under the condition of being subjected to the network intrusion. The stability is negatively correlated with the difference.
[0036] In the embodiments of the present application, the second preset file can be any format file sent by the terminal to the GRPC service endpoint, such as a document format, a video format, an audio format, and the like, which are not limited in the embodiments of the present application. The third preset file is a file returned by the GRPC service endpoint to the terminal.
[0037] Specifically, the test performed by the terminal to the GRPC service endpoint can include testing the stability of the file transmission capability of the GRPC service endpoint. Specifically, the terminal can send a second preset file in any format to the GRPC service endpoint, and then instruct the GRPC service endpoint to transmit the second preset file back intact and losslessly. When the GRPC service endpoint receives the instruction and returns a third preset file, the terminal can compare the third preset file with the originally sent second preset file to determine the difference between the second preset file and the third preset file.
[0038] It can be understood that the smaller the difference between the second preset file and the third preset file, the stronger the stability of the GRPC service endpoint, and thus the stability and the difference are negatively correlated.
[0039] Optionally, the difference between the second preset file and the third preset file can be determined by a hash check (such as MD5) and the like, and the transmission rate, interruption recovery time, and the like can be recorded to assist in determining the stability.
[0040] On the basis of the above-mentioned various embodiments, as an optional embodiment, the preset database stores a plurality of preset communication failure causes, each preset communication failure cause is provided with at least one corresponding error metadata and a category to which each error metadata belongs; the category represents the relationship between the data value of the error metadata and the value range; According to the matching of each error metadata to the corresponding communication failure cause from the preset database, specifically comprising: For each error metadata, according to the relationship between the data value of the error metadata and the value range, the category of the error metadata is determined; For each error metadata, the communication failure cause matched with the error metadata and the category of the error metadata is obtained from the preset database.
[0041] Specifically, in the embodiments of the present application, for each error metadata, it is further necessary to classify the error metadata according to the relationship between the data value thereof and the value range, for example, the error metadata with the data value higher than the upper limit of the value range and the data value lower than the lower limit of the value range usually belong to completely different types of errors, so the embodiments of the present application need to further classify these error metadata according to the actual data value of the error metadata, and then match the corresponding communication failure cause from the preset database according to the category of each error metadata.
[0042] On the basis of the above various embodiments, as an optional embodiment, for each error metadata, if the preset database does not exist the communication failure cause matching the error metadata and the category of the error metadata, the method further specifically comprises: displaying the error metadata, the category of the error metadata and the input box on the display screen; the input box is used for inputting the communication failure cause matching the error metadata and the category of the error metadata; storing the communication failure cause, the error metadata and the category of the error metadata into the preset database in association in response to the communication failure cause inputted in the input box.
[0043] In the embodiments of the present application, the display screen can be installed on the terminal and used for displaying the interface required to be displayed by the terminal. The input box can be the control displayed by the detection tool installed on the terminal when the user needs to input information, and the user can input the necessary information in the input box to make the terminal respond correspondingly.
[0044] Specifically, since the number of communication failure causes stored in the preset database itself is limited, and the types of communication failure causes caused in actual operation are various, it is inevitable that there will be a case that the corresponding communication failure cause of each error metadata does not exist in the preset database, so it is necessary to constantly improve and expand the preset database to make the preset database cover as many communication failure causes as possible, and the expansion mode can be that when the terminal cannot match the appropriate communication failure cause according to the error metadata, the input box corresponding to the input of the communication failure cause of this test is displayed on the display screen of the terminal, the user manually intervenes in the judgment, and then the user inputs the communication failure cause of this test caused by the test request into the input box, and the terminal stores the communication failure cause inputted by the user in the input box and the category of the error metadata of this test in the preset database, so as to match and judge when the same category of error metadata appears again in the future.
[0045] Optionally, the addition of new communication failure causes to the preset database in the embodiments of the present application can also be freely added and set by the user according to the actual demand, and the user is not required to add only when the terminal does not match the corresponding communication failure cause.
[0046] On the basis of each of the above embodiments, as an optional embodiment, the obtaining of the endpoint information of the GRPC service endpoint to be detected further comprises: receiving a modification request for the endpoint information, the modification request comprising modified endpoint information, and storing the endpoint information in a preset space; The method further comprises: reading the stored endpoint information from the preset space according to a first preset period; replacing the endpoint information of the current GRPC service endpoint to be detected with the endpoint information read from the preset space, and deleting the read endpoint information from the preset space.
[0047] In the embodiments of the present application, the first preset period can be freely set by the user, and in general, the first preset period is set to a relatively short time (such as 3 seconds, etc.). The preset space can be a part of the terminal storage space.
[0048] Specifically, when the user needs to replace the tested GRPC service endpoint, the terminal can be executed to initiate a modification request to the terminal, and the initiated modification request can include the endpoint information of the modified GRPC service endpoint. After receiving the modification request, the terminal will first store the endpoint information in the preset space, and then every first preset period, the terminal will read the stored endpoint information from the preset space, and replace the original endpoint information with the read endpoint information, to update the endpoint information. At the same time, after reading is completed, the endpoint information stored in the preset space needs to be cleared to ensure that it will not be read repeatedly next time. Through the above-mentioned manner, hot updating of the endpoint information can be realized, and after sending the modification request, the user does not need to restart the terminal or the detection tool, which can save time and improve the user's experience.
[0049] On the basis of each of the above embodiments, as an optional embodiment, the sending of the test request to the GRPC service endpoint based on the endpoint information further comprises: obtaining a second preset period; The sending of the test request to the GRPC service endpoint based on the endpoint information comprises: sending the test request to the GRPC service endpoint according to the second preset period.
[0050] In the embodiments of the present application, the second preset period can be freely set by the user according to actual needs, which is not limited in the embodiments of the present application.
[0051] Specifically, the detection tool in this application embodiment also provides a timed testing function. That is, the user can set a second preset period, and the terminal can send a test request to the GRPC server endpoint once every second preset period. This method can monitor the communication status of the GRPC server endpoint in real time. When the communication status of the GRPC server endpoint is abnormal, the cause of the communication failure can be fed back to the user in a timely manner so that the user can take corresponding measures in a timely manner.
[0052] The following is combined with Figure 2 The overall process of the communication fault detection method provided in the embodiments of this application is described, such as... Figure 2 As shown, the communication fault detection method provided in this application embodiment can be divided into the following steps: Step S1: Receive the endpoint information of the GRPC service endpoint to be detected, which is input by the user. The endpoint information includes the service address (IP), service name, method name, and HTTP / 2 connection parameters of the service endpoint.
[0053] Step S2: Obtain the first preset file pre-stored by the user. The preset file includes the filtering conditions for the original communication messages sent to the GRPC server endpoint (the original communication messages include metadata that characterizes the communication status and process in this communication process, such as timeout time, error code and other data).
[0054] Step S3: Next, a test request (containing pre-set test cases) is sent to the server endpoint. The server endpoint can then return the corresponding original communication message to the terminal. The terminal will then filter the metadata in the original communication message according to the first pre-set file, retaining only the target metadata that needs to be parsed later.
[0055] Step S4: Analyze the target metadata selected in step S3. Compare the current data value of each target metadata with the value range of the metadata under normal communication conditions. If the current data value of the metadata is within the corresponding value range, it indicates that the metadata has no error. If the metadata is not within its corresponding value range, it indicates that the metadata has an error.
[0056] Step S5: After obtaining the metadata of the error, the corresponding fault cause can be found from the preset database according to the category of the error metadata, and then the fault cause can be output to the display screen of the current terminal.
[0057] Step EX1, while sending a test request to the GRPC service endpoint, a simulated network abnormal environment can be set, for example, a DDOS attack is sent to the service endpoint at the same time as the test request is sent, so that the service endpoint has packet loss or delay increase, when the GRPC service endpoint encounters the above situation, it will try to resist or repair the attack, in this process, the time of receiving the original communication message will be increased, according to the length of this time, the recovery ability or stability of the GRPC service endpoint can be judged.
[0058] Step EX2, when the first preset file or the endpoint information of the GRPC service endpoint needs to be modified, the user can directly input the modified first preset file or the endpoint information of the GRPC service information into the terminal, and the terminal will store these contents in the preset file, and then update the current first preset file or endpoint information according to the information stored in the background at regular intervals, without the need for the user to restart the terminal.
[0059] Step EX3, the user can also set the second preset time length, and then the terminal can send a test request to the GRPC service endpoint every second preset time length to perform a detection.
[0060] Figure 3 The structure block diagram of a communication fault detection device provided by the embodiment of the application is shown in Figure 3 As shown in the figure, the travel information planning device 300 can include an endpoint information acquisition module 301, a test request sending module 302, a metadata screening module 303, an error data determination module 304, and a fault analysis module 305, wherein, The endpoint information acquisition module 301 is configured to acquire endpoint information of a GRPC service endpoint to be detected; The test request sending module 302 is configured to send a test request to the GRPC service endpoint based on the endpoint information, and receive an original communication message returned by the GRPC service endpoint in response to the test request; the original communication message includes a plurality of metadata, and a data value of the metadata is used to indicate a communication state in the detection process; The metadata screening module 303 is configured to screen a plurality of target metadata from the plurality of metadata based on a first preset file stored in advance; the first preset file includes a plurality of target metadata for communication fault reason analysis; The error data determination module 304 is configured to, for each target metadata, if it is determined that the data value of the target metadata is not in a corresponding value range, determine the target metadata as error metadata; The fault analysis module 305 is configured to match and indicate a corresponding communication fault reason from a preset database according to each error metadata.
[0061] The scheme provided by the embodiment of the application can first obtain the original communication message about the communication state of the GRPC service by sending a test request to the GRPC service endpoint, and can facilitate subsequent analysis of the communication state; Secondly, the scheme provided by the application can filter all metadata through the first preset file, and filter out only the metadata related to the communication state, which can save the computing resources consumed during subsequent fault analysis; Finally, the scheme provided by the application can determine the error metadata that appears errors according to the value range of each metadata that appears abnormal after filtering, and determine the cause of the communication failure from the preset database according to each error metadata, which can accurately analyze and diagnose the fault of the GRPC service endpoint.
[0062] The scheme provided by the application can link each detection step, which can avoid the switching of detection tools in the prior art, and can analyze and display the corresponding fault cause according to the detected data without manual integration, thereby saving costs.
[0063] On the basis of each of the above embodiments, as an optional embodiment, the device further includes a network intrusion module, which is specifically configured to: obtain the duration between the time when the test request is sent and the time when the original communication message returned by the GRPC service endpoint is received; determine the resistance of the GRPC service endpoint to network intrusion based on the duration; wherein the resistance is negatively correlated with the duration.
[0064] On the basis of each of the above embodiments, as an optional embodiment, the test request further includes a second preset file, and the test request instructs the GRPC service endpoint to return the received second preset file; The test request sending module is specifically configured to: receive the third preset file returned by the GRPC service endpoint; The device further includes a stability determination module, which is specifically configured to: determine the difference between the second preset file and the third preset file; determine the stability of the GRPC service endpoint based on the difference; the stability represents the file transmission capability of the GRPC service endpoint under the condition of network intrusion, and the stability is negatively correlated with the difference.
[0065] On the basis of each of the above embodiments, as an optional embodiment, the preset database stores a plurality of preset communication failure causes, each preset communication failure cause is provided with at least one corresponding error metadata and a category to which each error metadata belongs; the category represents the relationship between the data value of the error metadata and the value range; The fault analysis module is specifically configured to: For each error metadata, the category of the error metadata is determined based on the relationship between the data value and the range of values. For each error metadata, retrieve the communication failure reason that matches the error metadata and its category from the preset database.
[0066] Based on the above embodiments, as an optional embodiment, the device includes a communication failure cause extension module, which, for each error metadata, if there is no communication failure cause in the preset database that matches the error metadata and the error metadata category, is used for: The error metadata, the category of the error metadata, and an input box are displayed on the screen; the input box is used to enter the reason for the communication failure that matches the error metadata and the category of the error metadata. In response to the reason for the communication failure entered in the input box, the reason for the communication failure, error metadata, and the category of error metadata are associated and stored in the preset database.
[0067] Based on the above embodiments, as an optional embodiment, the device further includes an endpoint information modification module, specifically used for: Receive a modification request for endpoint information, the modification request includes the modified endpoint information, and store the endpoint information in a preset space; The device also includes an endpoint information update module, specifically used for: Read the stored endpoint information from the preset space according to the first preset cycle; Replace the endpoint information of the current GRPC service endpoint to be detected with the endpoint information read from the preset space, and delete the read endpoint information from the preset space.
[0068] Based on the above embodiments, as an optional embodiment, the test request sending module is specifically used for: Obtain the second preset cycle; Test requests are sent to the GRPC server endpoint according to the second preset cycle.
[0069] The following is for reference. Figure 4 It illustrates an electronic device suitable for implementing embodiments of this application (e.g., performing...). Figure 1 The diagram shows the structure of the terminal device or server 400 of the method shown. The electronic devices in the embodiments of this application may include, but are not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), wearable devices, etc., as well as fixed terminals such as digital TVs, desktop computers, etc. Figure 4The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0070] The electronic device includes a memory and a processor. The memory stores a program for executing the methods described in the above-described method embodiments; the processor is configured to execute the program stored in the memory. The processor may be referred to as processing device 401 as described below, and the memory may include at least one of read-only memory (ROM) 402, random access memory (RAM) 403, and storage device 408 as described below, as follows: like Figure 4 As shown, electronic device 400 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 401, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 402 or a program loaded from storage device 408 into random access memory (RAM) 403. RAM 403 also stores various programs and data required for the operation of electronic device 400. Processing device 401, ROM 402, and RAM 403 are interconnected via bus 404. Input / output (I / O) interface 405 is also connected to bus 404.
[0071] Typically, the following devices can be connected to I / O interface 405: input devices 406 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 407 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 408 including, for example, magnetic tapes, hard disks, etc.; and communication devices 409. Communication device 409 allows electronic device 400 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 4 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have alternatively.
[0072] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication device 409, or installed from storage device 408, or installed from ROM 402. When the computer program is executed by processing device 401, it performs the functions defined in the methods of embodiments of this application.
[0073] It should be noted that the computer-readable storage medium described above in this application can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0074] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0075] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0076] The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: Obtain endpoint information of the GRPC service endpoint to be tested; send a test request to the GRPC service endpoint based on the endpoint information, and receive the original communication message returned by the GRPC service endpoint in response to the test request; the original communication message includes multiple metadata, and the data values of the metadata are used to indicate the communication status during this test; filter multiple target metadata from the multiple metadata based on a pre-stored first preset file; the first preset file includes multiple target metadata for analyzing the causes of communication failures; for each target metadata, if it is determined that the data value of the target metadata is not within the corresponding value range, the target metadata is determined to be erroneous metadata; match and indicate the corresponding cause of communication failure from a preset database according to each erroneous metadata.
[0077] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including but not limited to object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0078] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0079] The modules or units described in the embodiments of this application can be implemented in software or hardware. The names of modules or units do not necessarily limit the specific unit; for example, a first constraint acquisition module can also be described as a "module for acquiring the first constraint".
[0080] The functions described above in this document can be performed at least in part by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), system-on-a-chip (SoCs), complex programmable logic devices (CPLDs), and so on.
[0081] In the context of this application, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0082] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0083] The above description is only a partial embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method of communication fault detection, the method comprising: The method comprises: obtaining endpoint information of a GRPC service endpoint to be detected; sending a test request to the GRPC service endpoint based on the endpoint information, and receiving an original communication message returned by the GRPC service endpoint in response to the test request; the original communication message comprises a plurality of metadata, and a data value of the metadata is used to indicate a communication state in the detection process; filtering a plurality of target metadata from the plurality of metadata based on a first preset file stored in advance; the first preset file comprises a plurality of target metadata for communication fault reason analysis; for each target metadata, if it is determined that the data value of the target metadata is not within a corresponding value range, the target metadata is determined as an error metadata; according to each error metadata, matching and indicating a corresponding communication fault reason from a preset database.
2. The method of claim 1, wherein, After sending the test request to the GRPC service endpoint based on the endpoint information, the method further comprises the step of initiating a network intrusion on the GRPC service endpoint; the method further comprises: obtaining a time length between a time when the test request is sent and a time when the original communication message returned by the GRPC service endpoint is received; determining a resistance of the GRPC service endpoint to the network intrusion based on the time length; wherein the resistance is negatively correlated with the time length.
3. The method of claim 2, wherein, the test request further comprises a second preset file, and the test request instructs the GRPC service endpoint to return the received second preset file; the step of receiving the original communication message returned by the GRPC service endpoint in response to the test request comprises: receiving a third preset file returned by the GRPC service endpoint; the method further comprises: determining a difference between the second preset file and the third preset file; determining a stability of the GRPC service endpoint based on the difference; the stability represents a file transmission capability of the GRPC service endpoint under the network intrusion, and the stability is negatively correlated with the difference.
4. The method of claim 1, wherein, the preset database stores a plurality of preset communication fault reasons, each preset communication fault reason is provided with at least one corresponding error metadata and a category to which each error metadata belongs; the category represents a relationship between a data value of the error metadata and a value range; the step of matching a corresponding communication fault reason from the preset database according to each error metadata comprises: for each error metadata, determining the category of the error metadata according to the relationship between the data value of the error metadata and the value range; for each error metadata, obtaining a communication fault reason matching the error metadata and the category of the error metadata from the preset database.
5. The method of claim 4, wherein, for each error metadata, if the communication fault reason matching the error metadata and the category of the error metadata does not exist in the preset database, the method further comprises: displaying the error metadata, the category of the error metadata, and an input box on a display screen; the input box is used to input a communication fault reason matching the error metadata and the category of the error metadata. In response to the communication failure reason entered in the input box, the communication failure reason, the error metadata, and the category of the error metadata are associated and stored in the preset database.
6. The method of claim 1, wherein, The step of obtaining the endpoint information of the GRPC service endpoint to be detected also includes: Receive a modification request for the endpoint information, the modification request including the modified endpoint information, and store the endpoint information in a preset space; The method further includes: According to the first preset period, the stored endpoint information is read from the preset space; Replace the endpoint information of the current GRPC service endpoint to be detected with the endpoint information read from the preset space, and delete the read endpoint information from the preset space.
7. The method of claim 1, wherein, Before sending the test request to the GRPC service endpoint based on the endpoint information, the process also includes: Obtain the second preset cycle; Sending a test request to the GRPC service endpoint based on the endpoint information includes: Test requests are sent to the GRPC server endpoint according to the second preset period.
8. A communication fault detection apparatus characterized by comprising: include: The endpoint information acquisition module is used to acquire the endpoint information of the GRPC service endpoint to be detected. The test request sending module is used to send a test request to the GRPC service endpoint based on the endpoint information and to receive the original communication message returned by the GRPC service endpoint in response to the test request. The original communication message includes multiple metadata, and the data values of the metadata are used to indicate the communication status during this detection process; The metadata filtering module is used to filter multiple target metadata from the multiple metadata based on a pre-stored first preset file; The first preset file includes multiple target metadata for analyzing the causes of communication failures; The error data determination module is used to determine the target metadata as error metadata if it is determined that the data value of the target metadata is not within the corresponding value range for each target metadata. The fault analysis module is used to match and indicate the cause of the corresponding communication fault from a preset database based on various error metadata.
9. An electronic device comprising a memory, a processor, and a computer program stored on the memory, wherein the computer program, when executed by the processor, is arranged to perform the method of any one of claims 1 to 8. The processor executes the computer program to implement the method of any one of claims 1-7.
10. A computer-readable storage medium having stored thereon a computer program, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1-7.