Microservice system fault monitoring method, device, equipment, storage medium and product

By performing real-time monitoring and data processing on the microservice system, and using the call chain prediction model to determine faults, the problem of the lack of a global perspective in traditional monitoring methods is solved, accurate monitoring and dependency analysis of microservice system faults are achieved, and monitoring is improved. efficiency.

CN118550799BActive Publication Date: 2024-10-22中邮消费金融有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411018694.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-29
Publication Date
2024-10-22
Estimated Expiration
2044-07-29

AI Technical Summary

Technical Problem

Traditional microservice system fault monitoring methods lack a global perspective and are difficult to explain the potential impact of faults on other microservices. They fail to accurately monitor the dependencies between microservice systems, leading to incorrect monitoring.

Method used

Through real-time monitoring of the microservice system, call chain data is obtained, API dependency topology map analysis and Trace text sequence processing are performed, and the call chain prediction model is input to determine the presence or absence of faults, providing accurate fault monitoring.

Benefits of technology

It achieves accurate monitoring of microservice system failures, can identify the potential impact of failures on other microservices, and improves the accuracy and efficiency of monitoring.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118550799B_ABST
    Figure CN118550799B_ABST
Patent Text Reader

Abstract

The present application discloses a method, device, equipment, storage medium and product for monitoring faults in a microservice system, and relates to the field of system monitoring technology. The method includes: monitoring the microservice system in real time, and obtaining first call chain data from the call chain of the microservice system according to the tracking identifier obtained by monitoring; performing API dependency topology graph parsing and Trace text sequence processing on the first call chain data to obtain second call chain data; inputting the second call chain data into a call chain prediction model to obtain a predicted label value of the call chain; judging whether there is a fault in the call chain based on the predicted label value, so as to monitor the faults of the microservice system. The present application performs API dependency topology graph parsing and Trace text sequence processing on the call chain data in the microservice system, and predicts the call chain data based on the call chain prediction model to identify faults in the call chain, so as to accurately monitor the faults of the microservice system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of system monitoring technology, and in particular to a method, device, equipment, storage medium and product for microservice system fault monitoring. Background Art

[0002] Nowadays, with the widespread application of microservice architecture in software development, the stability and reliability of microservice systems have become particularly important. However, due to the complexity and dynamics of microservice systems, failures are inevitable.

[0003] Traditional monitoring methods lack a global perspective and can often only locate the failure of a single microservice, but have difficulty explaining the potential impact of the failure on other microservices. In other words, they do not take into account the dependencies between microservice systems, which leads to incorrect monitoring. Therefore, the industry is in urgent need of a method that can accurately monitor microservice system failures.

[0004] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention

[0005] The main purpose of this application is to provide a microservice system fault monitoring method, device, equipment, storage medium and product, aiming to solve the technical problem that the existing technology cannot accurately monitor the faults of the microservice system.

[0006] To achieve the above objectives, the present application provides a microservice system fault monitoring method, the method comprising the following steps:

[0007] Monitor the microservice system in real time, and obtain first call chain data from a call chain of the microservice system according to a tracking identifier obtained by monitoring, wherein the call chain includes a plurality of API nodes;

[0008] Performing API dependency topology graph parsing and Trace text sequence processing on the first call chain data to obtain second call chain data;

[0009] Inputting the second call chain data into a call chain prediction model to obtain a predicted label value of the call chain, where the predicted label value is used to represent a category label corresponding to the second call chain data;

[0010] Based on the predicted label value, it is determined whether there is a fault in the call chain, so as to perform fault monitoring on the microservice system.

[0011] In one embodiment, the first call chain data includes link interface data and link node data, and the step of monitoring the microservice system in real time and acquiring the first call chain data from the call chain of the microservice system according to the tracking identifier obtained by monitoring includes:

[0012] Monitor the kafka cluster corresponding to the microservice system in real time, and locate the call chain from the microservice system according to the tracking identifier obtained by monitoring;

[0013] Determine the link interface data included in the call chain according to the tracking segment identifier of the call chain, wherein the tracking segment identifier corresponds to the link interface data one by one;

[0014] Based on the link interface data, link node data is obtained from the call chain, and the link node data is the collected data of the API node in the call chain.

[0015] In one embodiment, the step of performing API dependency topology graph parsing and Trace text sequence processing on the first call chain data to obtain the second call chain data includes:

[0016] Performing API dependency topology analysis on the first call chain data to obtain call frequencies between API nodes in the first call chain data;

[0017] Determine a dependency topology graph between the API nodes according to the call frequency, and acquire key text data from the first call chain data based on the dependency topology graph;

[0018] The key text data is subjected to Trace text sequence processing to splice the key text data according to the arrangement order of the link node data in the call chain to obtain the second call chain data.

[0019] In one embodiment, the step of determining whether there is a fault in the call chain based on the predicted tag value includes:

[0020] Determine the failure probability of the call chain data in the call chain based on the predicted tag value to determine whether there is a failure in the call chain;

[0021] If so, locate the fault in the call chain, generate visualization content based on the fault and display it to the user;

[0022] If not, the next call chain of the microservice system is monitored for faults.

[0023] To achieve the above objectives, the present application provides a microservice system fault monitoring method, the method comprising the following steps:

[0024] Performing API dependency topology analysis and Trace text sequence processing on the first historical data of the sample call chain in the microservice system to obtain second historical data, where the second historical data includes historical link interface data and historical link node data;

[0025] The second historical data is input into the initial model for training to obtain a call chain prediction model, wherein the structure of the initial model includes a model encoding layer, an attention sharing layer and a model prediction layer.

[0026] In one embodiment, the model encoding layer includes a graph attention encoding layer and a Transformer encoding layer, and the step of inputting the second historical data into the initial model for training to obtain the call chain prediction model includes:

[0027] Inputting the historical link interface data into a graph attention encoding layer to obtain a first output vector, wherein the graph attention encoding layer is used to encode the corresponding API node in the historical link interface data into a vector;

[0028] Inputting the historical link node data into a Transformer encoding layer to obtain a second output vector, wherein the Transformer encoding layer is used to encode the corresponding sequence text in the historical link node data into a vector;

[0029] Predicting the sample call chain based on the first output vector and the second output vector to obtain a prediction probability, and calculating a loss value of the initial model based on a loss function;

[0030] The initial model is optimized in parameters according to the loss value to obtain a call chain prediction model.

[0031] In one embodiment, the step of predicting the sample call chain based on the first output vector and the second output vector to obtain a prediction probability includes:

[0032] Performing a linear transformation on the first output vector to obtain a third output vector and a fourth output vector, and performing a linear transformation on the second output vector to obtain a fifth output vector;

[0033] Calculating attention weight values ​​of the third output vector and the fifth output vector using a dot product operation, and weighting the fourth output vector according to the attention weight value to obtain a fusion vector;

[0034] The sample call chain is predicted based on the fusion vector to obtain a prediction probability.

[0035] In addition, to achieve the above purpose, the present application also proposes a microservice system fault monitoring device, the microservice system fault monitoring device comprising:

[0036] A real-time monitoring module is used to monitor the microservice system in real time, and obtain first call chain data from the call chain of the microservice system according to the tracking identifier obtained by monitoring, wherein the call chain includes a plurality of API nodes;

[0037] A data processing module, used for performing API dependency topology analysis and Trace text sequence processing on the first call chain data to obtain second call chain data;

[0038] a data prediction module, used to input the second call chain data into a call chain prediction model to obtain a predicted label value of the call chain, wherein the predicted label value is used to represent a category label corresponding to the second call chain data;

[0039] A fault monitoring module is used to determine whether there is a fault in the call chain based on the predicted label value, so as to perform fault monitoring on the microservice system.

[0040] In addition, to achieve the above-mentioned purpose, the present application also proposes a microservice system fault monitoring device, which includes: a memory, a processor, and a microservice system fault monitoring program stored in the memory and executable on the processor, and the microservice system fault monitoring program is configured to implement the steps of the microservice system fault monitoring method described above.

[0041] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a microservice system fault monitoring program is stored on the storage medium. When the microservice system fault monitoring program is executed by the processor, the steps of the microservice system fault monitoring method described above are implemented.

[0042] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer program product, which includes a microservice system fault monitoring program, and when the microservice system fault monitoring program is executed by a processor, it implements the steps of the microservice system fault monitoring method described above.

[0043] The present application monitors the microservice system in real time, and obtains the first call chain data from the call chain of the microservice system according to the tracking identifier obtained by monitoring, wherein the call chain contains several API nodes; the first call chain data is subjected to API dependency topology graph parsing and Trace text sequence processing to obtain the second call chain data; the second call chain data is input into the call chain prediction model to obtain the predicted label value of the call chain, wherein the predicted label value is used to represent the category label corresponding to the second call chain data; based on the predicted label value, it is judged whether there is a fault in the call chain to perform fault monitoring on the microservice system. Compared with the traditional microservice system fault monitoring method, the above method of the present application obtains the second call chain data after performing API dependency topology graph parsing and Trace text sequence processing on the first call chain data in the microservice system, and predicts the second call chain data based on the call chain prediction model to determine whether there is a fault in the call chain, thereby being able to accurately perform fault monitoring on the microservice system. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 A schematic diagram of the structure of a microservice system fault monitoring device in a hardware operating environment involved in an embodiment of the present application;

[0045] Figure 2 This is a flow chart of the first embodiment of the microservice system fault monitoring method of the present application;

[0046] Figure 3 This is a schematic diagram of the call chain data model in the microservice system fault monitoring method of this application;

[0047] Figure 4 This is a flow chart of the second embodiment of the microservice system fault monitoring method of the present application;

[0048] Figure 5 This is a schematic diagram of the API dependency graph adjacency matrix G in the call chain prediction model construction method of this application;

[0049] Figure 6 This is a flowchart of the first embodiment of the method for building a call chain prediction model in this application;

[0050] Figure 7 A schematic diagram of a call chain prediction model in the call chain prediction model construction method of this application;

[0051] Figure 8 This is a structural block diagram of the first embodiment of the microservice system fault monitoring device of the present application.

[0052] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0053] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0054] Reference Figure 1 , Figure 1 This is a schematic diagram of the structure of a microservice system fault monitoring device in the hardware operating environment involved in the embodiment of the present application.

[0055] like Figure 1 As shown, the microservice system fault monitoring device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (Wireless-Fidelity, Wi-Fi) interface). The memory 1005 may be a high-speed random access memory (RandomAccess Memory, RAM), or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk storage. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0056] Those skilled in the art will understand that Figure 1 The structure shown in does not constitute a limitation on the microservice system fault monitoring device, and may include more or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.

[0057] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a microservice system fault monitoring program.

[0058] exist Figure 1 In the microservice system fault monitoring device shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the microservice system fault monitoring device of the present application can be set in the microservice system fault monitoring device, and the microservice system fault monitoring device calls the microservice system fault monitoring program stored in the memory 1005 through the processor 1001, and executes the microservice system fault monitoring method provided in the embodiment of the present application.

[0059] The present application embodiment provides a microservice system fault monitoring method, referring to Figure 2 , Figure 2 This is a flow chart of the first embodiment of the microservice system fault monitoring method of the present application.

[0060] In this embodiment, the microservice system fault monitoring method includes the following steps:

[0061] Step S10: monitor the microservice system in real time, and obtain first call chain data from the call chain of the microservice system according to the tracking identifier obtained by monitoring, wherein the call chain includes a plurality of API nodes.

[0062] It should be noted that the execution subject of the method of this embodiment can be a terminal device with data acquisition, data processing and program running functions, such as a smart phone, a computer, etc., or an electronic device with the same or similar functions, such as the above-mentioned microservice system fault monitoring device. The following takes the microservice system fault monitoring device (hereinafter referred to as the monitoring device) as an example to illustrate this embodiment and the following embodiments.

[0063] It is understandable that the above microservice system is also called microservice architecture, which is a cloud-native architecture method that can design software applications into multiple small, autonomous service units. The above trace identifier (TraceId) is a unique identifier used to track requests in a distributed system. In a microservice system, a request may involve calls to multiple services and components, and TraceId helps us track and view the entire request process and call chain. The above first call chain data may include link interface data and link node data.

[0064] In the microservice system, API represents the interface (i.e., the link interface data mentioned above). The call chain data concerned in this embodiment is at the API level. When a request reaches an API node, an API Span can be generated, and each API Span can correspond to an API node. API Span represents the link node data of the request (i.e., the link node data mentioned above). In this embodiment, it is hoped to obtain the call chain at the API level, so an API Span is the collected data of an API, and the link composed of multiple API Spans under one request constitutes the call chain. Trace represents the call chain of a request. A request will pass through multiple API nodes, and each API node will generate an API Span. A call chain describes the start of a request, the link process, and the request result. The request entry represents the first API Span of a Trace, that is, the entry API Span, and the parent of the entry API Span is empty. The Trace result represents the response result of the last API Span of each call chain Trace as the final result of the link. Due to the diversity of business scenarios, the Trace result is not a simple success or failure, and there may be more possible results (i.e., it is a multi-classification problem).

[0065] It should be understood that reference can be made to Figure 3 , Figure 3 This is a schematic diagram of the call chain data model in the microservice system fault monitoring method of this application, where SpanId represents the tracking segment identifier, ParentSpanId represents the unique identifier of the parent Span of the current Span, ApiId represents the identifier of the API node, msg represents the message, and status represents the status. In actual operation, it is allowed to Figure 3 The call chain data model shown is expanded to record custom events or important metadata in the Span. Through this data model, the present embodiment can obtain labeled training data to prepare for subsequent model training. The purpose of the data acquisition module of this embodiment is to generate and collect the required target data for a call. These data can be exported for further processing to input model training and perform subsequent related work such as call chain monitoring visualization. This embodiment uses the open source tracing library OpenTelemetry. This open source tool can generate a unique TraceId for a request in a microservice system to trace a call chain, and generate a SpanId in each API Span to obtain link data identified by a unique TraceId. It provides a set of APIs and SDKs that can be easily integrated into applications to collect tracing data and export data. Through this tool, this method can obtain the API Span information and Trace results of each call chain Trace.

[0066] Step S20: performing API dependency topology graph parsing and Trace text sequence processing on the first call chain data to obtain second call chain data.

[0067] It should be noted that the API dependency topology diagram is a graphical representation method used to show the dependencies between different APIs. In a microservice architecture, different services communicate through APIs, so understanding the dependencies between these APIs is crucial for the stability, scalability, and maintainability of the system. Trace text sequence processing generally refers to the process of parsing, analyzing, and processing trace data that records the runtime behavior or performance of the system. These trace data may come from various sources, such as application logs, system monitoring tools, etc.

[0068] It should be understood that the absolute path of each API is recorded during the data collection process, and the API dependency graph (i.e., directed graph) of the microservice system can be parsed through the directory structure of the API and the order in which they are called in the request.

[0069] Step S30: input the second call chain data into a call chain prediction model to obtain a predicted label value of the call chain, where the predicted label value is used to represent a category label corresponding to the second call chain data.

[0070] In a specific implementation, the above-mentioned call chain prediction model can be obtained after training. In the self-developed link prediction system, the call chain Trace data (i.e., the above-mentioned second call chain data) is input after the model call interface is connected. Through model prediction, the probability distribution of the call chain can be calculated to determine which category label the call chain data belongs to. The category label is the prediction result.

[0071] Step S40: determining whether there is a fault in the call chain based on the predicted tag value, so as to perform fault monitoring on the microservice system.

[0072] In the specific implementation, the probability of the call chain belonging to each category can be known based on the above-mentioned predicted label values, so as to determine which category it is most likely to belong to (that is, predict the fault type of the call chain), and then realize fault monitoring of the microservice system.

[0073] This embodiment monitors the microservice system in real time, and obtains the first call chain data from the call chain of the microservice system according to the tracking identifier obtained by monitoring, wherein the call chain includes several API nodes; the first call chain data is subjected to API dependency topology graph parsing and Trace text sequence processing to obtain the second call chain data; the second call chain data is input into the call chain prediction model to obtain the predicted label value of the call chain, wherein the predicted label value is used to represent the category label corresponding to the second call chain data; based on the predicted label value, it is judged whether there is a fault in the call chain to perform fault monitoring on the microservice system. Compared with the traditional microservice system fault monitoring method, the above method of this embodiment obtains the second call chain data after performing API dependency topology graph parsing and Trace text sequence processing on the first call chain data in the microservice system, and predicts the second call chain data based on the call chain prediction model to determine whether there is a fault in the call chain, thereby being able to accurately perform fault monitoring on the microservice system.

[0074] refer to Figure 4 , Figure 4 This is a flow chart of the second embodiment of the microservice system fault monitoring method of the present application.

[0075] In a feasible implementation manner, the first call chain data includes link interface data and link node data, and the step S10 may include:

[0076] Step S101: monitor the kafka cluster corresponding to the microservice system in real time, and locate the call chain from the microservice system according to the tracking identifier obtained by monitoring.

[0077] Step S102: determining the link interface data contained in the call chain according to the tracing segment identifier of the call chain, wherein the tracing segment identifier corresponds to the link interface data one by one.

[0078] It should be noted that the above-mentioned tracing segment identifier (SpanId) can be a 64-bit unique identifier used to represent an operation or transaction within a service in a microservice system. It represents the processing process of a request within a single service and together with TraceId constitutes a complete distributed tracing link.

[0079] It should be understood that the one-to-one correspondence between the above-mentioned tracking segment identifier and the above-mentioned link interface data means that the tracking segment identifier can definitely find a unique link interface data corresponding to it.

[0080] Step S103: acquiring link node data from the call chain based on the link interface data, wherein the link node data is the collected data of the API node in the call chain.

[0081] In a feasible implementation manner, the step S20 may include:

[0082] Step S201: performing API dependency topology graph analysis on the first call chain data to obtain the call frequency between API nodes in the first call chain data.

[0083] It should be understood that this method uses the calling frequency per unit time f As the edge weight information between API nodes, the calculation formula of the call frequency is as follows:

[0084]

[0085] This is because the calling frequency between APIs can reflect the key link characteristics and help understand which APIs interact most frequently, thereby providing more useful monitoring information in fault monitoring. Assuming that the number of APIs is M, the API dependency topology graph can be represented as an adjacency matrix G (refer to Figure 5 , Figure 5 This is a schematic diagram of the API dependency graph adjacency matrix G in the method for building a call chain prediction model for this application). G is an M*M square matrix. If the i-th API and the j-th API have a dependency relationship, the weight of Gij is the call frequency between them, that is, Gij= f ,Therefore, the adjacency matrix can not only reflect the structural information of the global API ,dependency, but also reflect the importance of the dependency (high call frequency means a large ,volume of requests and is a critical link).

[0086] Step S202: determining a dependency topology graph between the API nodes according to the calling frequency, and acquiring key text data from the first calling chain data based on the dependency topology graph.

[0087] Step S203: performing Trace text sequence processing on the key text data to splice the key text data according to the arrangement order of the link node data in the call chain to obtain second call chain data.

[0088] In the specific implementation, assuming that there are N call chain trace sample data, this embodiment needs to process the important features of the trace data. Based on the previous data collection, this embodiment has obtained important text data on the API Span, including monitoring logs, response results, and even some custom business events. The order accumulation of these important text information on the call link can reflect the call mode. Therefore, this embodiment splices the key text data on the trace according to the arrangement order of the link node data in the call chain, and obtains a sequence text for each trace as the input of the subsequent model.

[0089] In a feasible implementation manner, the step S40 may include:

[0090] Step S401: determining the failure probability of the call chain data in the call chain based on the predicted tag value to determine whether there is a failure in the call chain.

[0091] Step S402: If so, locate the fault in the call chain, generate visualization content based on the fault and display it to the user.

[0092] Step S403: If it does not exist, then perform fault monitoring on the next call chain of the microservice system.

[0093] It should be understood that the above-mentioned visualization content may include call chain link visualization, fault type visualization, etc., which is not limited in this embodiment.

[0094] This embodiment monitors the kafka cluster corresponding to the microservice system in real time, and locates the call chain from the microservice system according to the tracking identifier obtained by monitoring; determines the link interface data contained in the call chain according to the tracking segment identifier of the call chain, and the tracking segment identifier corresponds to the link interface data one by one; obtains link node data from the call chain based on the link interface data, and the link node data is the collection data of the API node in the call chain; performs API dependency topology graph analysis on the first call chain data to obtain the call frequency between API nodes in the first call chain data; determines the API according to the call frequency A dependency topology diagram between nodes, and based on the dependency topology diagram, key text data is obtained from the first call chain data; Trace text sequence processing is performed on the key text data to splice the key text data according to the arrangement order of the link node data in the call chain to obtain the second call chain data; the failure probability of the call chain data in the call chain is determined based on the predicted label value to determine whether there is a fault in the call chain; if there is, the fault in the call chain is located, and visual content is generated based on the fault and displayed to the user; if there is no fault, the next call chain of the microservice system is monitored for faults. Compared with the traditional microservice system fault monitoring method, the above method of this embodiment obtains global call chain data from the perspective of the call chain, which helps to deal with the perspective limitation of the traditional detection method, in order to achieve a global and intuitive monitoring effect; at the same time, a more fine-grained monitoring effect can be obtained through API-level link monitoring. Compared with the service-level call chain analysis, the API-level call chain data helps operation and maintenance personnel to quickly and accurately locate the fault location, thereby improving operation and maintenance efficiency.

[0095] refer to Figure 6 , Figure 6 This is a flow chart of the first embodiment of the method for building a call chain prediction model in this application.

[0096] In this embodiment, the call chain prediction model construction method includes the following steps:

[0097] Step S1: performing API dependency topology analysis and Trace text sequence processing on the first historical data of the sample call chain in the microservice system to obtain second historical data, where the second historical data includes historical link interface data and historical link node data.

[0098] Step S2: Input the second historical data into the initial model for training to obtain a call chain prediction model, wherein the structure of the initial model includes a model encoding layer, an attention sharing layer and a model prediction layer.

[0099] It should be understood that the second historical data can be divided into a training set, a validation set, and a test set in a ratio of 8:1:1 according to the traditional model training method, and the performance of the trained model can be evaluated using the validation set. Finally, the generalization ability of the model is verified on the test set to obtain a high-accuracy call chain prediction model, and an external interface is provided for the model to be called. Later, in real-time fault prediction, each new incoming call chain trace data will be evaluated using this interface, and the interface will return the evaluation result (that is, the fault label).

[0100] It is understandable that existing methods either focus on the analysis of the call chain structure or on the accumulated log information on the call chain, and fail to comprehensively consider the call patterns reflected by the structural information and the text sequence. In order to learn both the structure and link pattern of the call chain, this embodiment designs the above-mentioned call chain prediction model, which can learn the graph structure information of API dependencies and the pattern information of the call chain Trace. The model consists of three parts: graph attention encoding graph structure data, Transformer encoder encoding sequence text data, and the shared layer uses the attention mechanism to share the output of the graph attention layer and the Transformer encoding layer, so that the model can comprehensively consider the structural information and pattern information.

[0101] In a feasible implementation, the model encoding layer includes a graph attention encoding layer and a Transformer encoding layer, and step S2 may include:

[0102] Step S21: Input the historical link interface data into the graph attention coding layer to obtain a first output vector, wherein the graph attention coding layer is used to encode the corresponding API nodes in the historical link interface data into vectors.

[0103] It is understandable that this embodiment uses graph attention to encode API dependency graph structure data. Graph attention can effectively encode graph structure information and can allocate more attention to important nodes through the attention mechanism. In order to further capture deep neighborhood information, multiple graph attention layers can be used in the model design of this embodiment to encode the API dependency graph. See Figure 7 The API topology graph input part in the model input illustrates the graph structure of the API nodes. The purpose is to show the structural information of the graph. This structure can be represented as an adjacency matrix. The graph attention layer is a way to extract and update the features of the graph structure data that constitutes the graph attention network. This embodiment stacks three layers to realize the feature extraction of the graph and obtain the representation vectors of the nodes of the graph, that is, the representation vectors of all APIs. The reason for stacking 3 layers is to obtain high-order domain feature information of the graph. The number of layers is 3 is an empirical setting.

[0104] Step S22: Input the historical link node data into a Transformer coding layer to obtain a second output vector, wherein the Transformer coding layer is used to encode the corresponding sequence text in the historical link node data into a vector.

[0105] In the specific implementation, the important text information collected from the API Span on the call chain trace can be spliced ​​and fed to the Transformer encoder to learn the text sequence. This is a common and effective text data encoding method. The text data on a call chain can reflect its call pattern, that is, the call patterns of those with similar text information are similar. Figure 7 The call chain sequence text input part of the model input, which illustrates the text concatenation of several API spans on each call chain.

[0106] Step S23: predicting the sample call chain based on the first output vector and the second output vector to obtain a prediction probability, and calculating a loss value of the initial model based on a loss function.

[0107] Step S24: Optimize the parameters of the initial model according to the loss value to obtain a call chain prediction model.

[0108] It should be understood that this embodiment can use the cross entropy loss function to calculate the loss of the above initial model. The cross entropy loss function is used to measure the difference between the probability distribution predicted by the model and the actual label. Assume that the call chain sample has N The sample categories are S After model prediction, the distribution vector of this type is obtained p, the calculation formula of the cross entropy loss function is as follows:

[0109]

[0110] in, It is n The sample s The actual label of each category (one-hot encoding, value is 0 or 1), It is n The sample s The predicted probability value of each category (after Softmax Function processing). The cross entropy loss function calculates the overall loss value of the initial model by comparing the predicted probability value of each category of each sample with the actual label. Usually when training a neural network, the back propagation algorithm is used to minimize the cross entropy loss function to adjust the model parameters so that the initial model can better fit the training data.

[0111] In a feasible implementation manner, the step S23 may include:

[0112] Step S231: performing a linear transformation on the first output vector to obtain a third output vector and a fourth output vector, and performing a linear transformation on the second output vector to obtain a fifth output vector.

[0113] It should be noted that after encoding, the graph attention layer can obtain the representation of each node (that is, API) in the API dependency graph (that is, a D-dimensional vector, that is, the first output vector mentioned above), and the representation of the API can reflect the structural characteristics of the API; after Transformer encoding, a text sequence representation of a call chain Trace can be obtained (that is, a D-dimensional vector, that is, the second output vector mentioned above), which can reflect the calling pattern of the call chain.

[0114] Step S232: Use a dot product operation to calculate the attention weight values ​​of the third output vector and the fifth output vector, and weight the fourth output vector according to the attention weight values ​​to obtain a fusion vector.

[0115] In the specific implementation, since the API Span is the data obtained when the request reaches the API, an API Span must be able to find a unique API corresponding to it. Because multiple requests may pass through this API, an API will correspond to multiple API Spans. In order to learn the pattern information and structure information of the call chain Trace, this embodiment designs a cross-modal attention sharing layer. First, the API Span on a call chain Trace is mapped to the API node through the API path, and the API Span set of the Trace can be obtained.

[0116] You can refer to Figure 7 , assuming that a Trace call chain passes through three API spans, and these three API spans correspond to API nodes with index numbers 1, 2, and 3 respectively, then the API association set of the Trace is {1, 2, 3}. This embodiment first uses a fully connected layer to perform a linear transformation on the graph structure output vector of the model encoding layer to obtain two sets of D-dimensional vectors, {K1, K2, K3} (i.e., the third output vector mentioned above) and {V1, V2, V3} (i.e., the fourth output vector mentioned above). Then, the fully connected layer is also used to perform a linear transformation on the text sequence output vector of the model encoding layer to obtain a D-dimensional vector Q (i.e., the fifth output vector mentioned above). The dot product operation is used to calculate the attention weight values ​​{a1, a2, a3} of Q and {K1, K2, K3}. The attention value is used to weight {V1, V2, V3} to obtain a fusion vector x (D-dimensional vector x=[x1,x2,…,xD ]). This fusion vector x comprehensively learns the structural features of the API and the calling mode of the call chain, which helps to improve the accuracy of the prediction. Transformer Encoder represents the Transformer encoder. In addition, Figure 7 The shared layer in the figure illustrates the shared layer calculation of one of the trace call chains. The same calculation method is used for all other trace call chain data.

[0117] Step S233: predicting the sample call chain based on the fusion vector to obtain a prediction probability.

[0118] In the specific implementation, the output of the shared layer (D-dimensional vector x=[x1,x2,…,xD ]) can be processed by the fully connected layer to obtain an S-dimensional vector z , the calculation formula is z = Wx + b ,in x is the D-dimensional vector output by the shared layer, W is a transformation matrix of size D*S, b is an F-dimensional bias vector.

[0119] Then, use Softmax Function processing, whose role is to convert the vector into a probability distribution, so that the probability value of each category is between 0 and 1, and the sum of the probabilities of all categories is 1. Softmax The function formula is as follows:

[0120]

[0121] in, pIt is an S-dimensional vector, which represents the probability distribution of each category. Based on the probability distribution, we can know the probability that the call chain belongs to each category, and thus determine which category it is most likely to belong to (that is, predict the fault type of the call chain).

[0122] In this embodiment, the first historical data of the sample call chain in the microservice system is parsed by API dependency topology graph and Trace text sequence processing to obtain the second historical data, wherein the second historical data includes historical link interface data and historical link node data; the historical link interface data is input into the graph attention coding layer to obtain the first output vector, and the graph attention coding layer is used to encode the corresponding API node in the historical link interface data into a vector; the historical link node data is input into the Transformer coding layer to obtain the second output vector, and the Transformer coding layer is used to encode the corresponding sequence text in the historical link node data into a vector; the first output vector is linearly transformed to obtain the third output vector and the fourth output vector, and the second output vector is linearly transformed to obtain the fifth output vector; the dot product operation is used to calculate the attention weight values ​​of the third output vector and the fifth output vector, and the fourth output vector is weighted according to the attention weight value to obtain a fusion vector; the sample call chain is predicted based on the fusion vector to obtain a prediction probability, and the loss value of the initial model is calculated based on the loss function; the parameters of the initial model are optimized according to the loss value to obtain a call chain prediction model. The above method of this embodiment performs data processing and analysis based on the collected detailed call data, and designs a cross-modal sharing layer to comprehensively learn structural features and call patterns, thereby constructing a call chain prediction model that can comprehensively consider the global topological structure information and call patterns of the API dependency graph, thereby improving the accuracy of model prediction.

[0123] In addition, an embodiment of the present application further proposes a storage medium, on which a microservice system fault monitoring program is stored. When the microservice system fault monitoring program is executed by a processor, the steps of the microservice system fault monitoring method described above are implemented.

[0124] Reference Figure 8 , Figure 8 This is a structural block diagram of the first embodiment of the microservice system fault monitoring device of the present application.

[0125] like Figure 8 As shown, the microservice system fault monitoring device proposed in the embodiment of the present application includes:

[0126] The real-time monitoring module 801 is used to monitor the microservice system in real time, and obtain first call chain data from the call chain of the microservice system according to the tracking identifier obtained by monitoring, wherein the call chain includes a plurality of API nodes;

[0127] The data processing module 802 is used to perform API dependency topology analysis and Trace text sequence processing on the first call chain data to obtain second call chain data;

[0128] A data prediction module 803 is used to input the second call chain data into a call chain prediction model to obtain a predicted label value of the call chain, where the predicted label value is used to represent a category label corresponding to the second call chain data;

[0129] The fault monitoring module 804 is used to determine whether there is a fault in the call chain based on the predicted label value, so as to perform fault monitoring on the microservice system.

[0130] This embodiment monitors the microservice system in real time, and obtains the first call chain data from the call chain of the microservice system according to the tracking identifier obtained by monitoring, wherein the call chain includes several API nodes; the first call chain data is subjected to API dependency topology graph parsing and Trace text sequence processing to obtain the second call chain data; the second call chain data is input into the call chain prediction model to obtain the predicted label value of the call chain, wherein the predicted label value is used to represent the category label corresponding to the second call chain data; based on the predicted label value, it is judged whether there is a fault in the call chain to perform fault monitoring on the microservice system. Compared with the traditional microservice system fault monitoring method, the above method of this embodiment obtains the second call chain data after performing API dependency topology graph parsing and Trace text sequence processing on the first call chain data in the microservice system, and predicts the second call chain data based on the call chain prediction model to determine whether there is a fault in the call chain, thereby being able to accurately perform fault monitoring on the microservice system.

[0131] Based on the first embodiment of the microservice system fault monitoring device of the present application, a second embodiment of the microservice system fault monitoring device of the present application is proposed.

[0132] In this embodiment, the first call chain data includes link interface data and link node data. The real-time monitoring module 801 is also used to monitor the kafka cluster corresponding to the microservice system in real time, and locate the call chain from the microservice system according to the tracking identifier obtained by monitoring; determine the link interface data contained in the call chain according to the tracking segment identifier of the call chain, and the tracking segment identifier corresponds to the link interface data one by one; obtain link node data from the call chain based on the link interface data, and the link node data is the collection data of the API node in the call chain.

[0133] Furthermore, the data processing module 802 is also used to perform API dependency topology graph analysis on the first call chain data to obtain the call frequency between API nodes in the first call chain data; determine the dependency topology graph between the API nodes based on the call frequency, and obtain key text data from the first call chain data based on the dependency topology graph; perform Trace text sequence processing on the key text data to splice the key text data according to the arrangement order of the link node data in the call chain to obtain the second call chain data.

[0134] Furthermore, the fault monitoring module 804 is also used to determine the fault probability of the call chain data in the call chain based on the predicted label value to determine whether there is a fault in the call chain; if so, locate the fault in the call chain, and generate visualization content based on the fault and display it to the user; if not, perform fault monitoring on the next call chain of the microservice system.

[0135] Furthermore, the fault monitoring module 804 is also used to perform API dependency topology graph parsing and Trace text sequence processing on the first historical data of the sample call chain in the microservice system to obtain second historical data, wherein the second historical data includes historical link interface data and historical link node data; the second historical data is input into the initial model for training to obtain a call chain prediction model, wherein the structure of the initial model includes a model encoding layer, an attention sharing layer and a model prediction layer.

[0136] Furthermore, the model encoding layer includes a graph attention encoding layer and a Transformer encoding layer, and the fault monitoring module 804 is also used to input the historical link interface data into the graph attention encoding layer to obtain a first output vector, and the graph attention encoding layer is used to encode the corresponding API node in the historical link interface data into a vector; input the historical link node data into the Transformer encoding layer to obtain a second output vector, and the Transformer encoding layer is used to encode the corresponding sequence text in the historical link node data into a vector; predict the sample call chain based on the first output vector and the second output vector to obtain a prediction probability, and calculate the loss value of the initial model based on the loss function; optimize the parameters of the initial model according to the loss value to obtain a call chain prediction model.

[0137] Furthermore, the fault monitoring module 804 is also used to perform a linear transformation on the first output vector to obtain a third output vector and a fourth output vector, and to perform a linear transformation on the second output vector to obtain a fifth output vector; use a dot product operation to calculate the attention weight values ​​of the third output vector and the fifth output vector, and weight the fourth output vector according to the attention weight values ​​to obtain a fusion vector; and predict the sample call chain based on the fusion vector to obtain a prediction probability.

[0138] Other embodiments or specific implementations of the microservice system fault monitoring device of the present application can refer to the above-mentioned method embodiments and will not be repeated here.

[0139] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.

[0140] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0141] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as a read-only memory / random access memory, a disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0142] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A microservice system fault monitoring method, characterized in that: The method comprises the following steps: Monitor the microservice system in real time, and obtain first call chain data from a call chain of the microservice system according to a tracking identifier obtained by monitoring, wherein the call chain includes a plurality of API nodes; Performing API dependency topology graph parsing and Trace text sequence processing on the first call chain data to obtain second call chain data; Inputting the second call chain data into a call chain prediction model to obtain a predicted label value of the call chain, where the predicted label value is used to represent a category label corresponding to the second call chain data; Determining whether there is a fault in the call chain based on the predicted label value, so as to perform fault monitoring on the microservice system; The call chain prediction model is constructed based on the following steps: Performing API dependency topology analysis and Trace text sequence processing on the first historical data of the sample call chain in the microservice system to obtain second historical data, where the second historical data includes historical link interface data and historical link node data; Inputting the second historical data into an initial model for training to obtain a call chain prediction model, wherein the structure of the initial model includes a model encoding layer, an attention sharing layer, and a model prediction layer; The model encoding layer includes a graph attention encoding layer and a Transformer encoding layer, and the step of inputting the second historical data into the initial model for training to obtain a call chain prediction model includes: Inputting the historical link interface data into a graph attention encoding layer to obtain a first output vector, wherein the graph attention encoding layer is used to encode the corresponding API node in the historical link interface data into a vector; Inputting the historical link node data into a Transformer encoding layer to obtain a second output vector, wherein the Transformer encoding layer is used to encode the corresponding sequence text in the historical link node data into a vector; Predicting the sample call chain based on the first output vector and the second output vector to obtain a prediction probability, and calculating a loss value of the initial model based on a loss function; The initial model is optimized in parameters according to the loss value to obtain a call chain prediction model.

2. The microservice system fault monitoring method according to claim 1, characterized in that: The first call chain data includes link interface data and link node data. The step of monitoring the microservice system in real time and acquiring the first call chain data from the call chain of the microservice system according to the tracking identifier obtained by monitoring includes: Monitor the kafka cluster corresponding to the microservice system in real time, and locate the call chain from the microservice system according to the tracking identifier obtained by monitoring; Determine the link interface data included in the call chain according to the tracking segment identifier of the call chain, wherein the tracking segment identifier corresponds to the link interface data one by one; Based on the link interface data, link node data is obtained from the call chain, and the link node data is the collected data of the API node in the call chain.

3. The microservice system fault monitoring method according to claim 1, characterized in that: The step of performing API dependency topology graph parsing and Trace text sequence processing on the first call chain data to obtain the second call chain data includes: Performing API dependency topology analysis on the first call chain data to obtain call frequencies between API nodes in the first call chain data; Determine a dependency topology graph between the API nodes according to the call frequency, and acquire key text data from the first call chain data based on the dependency topology graph; The key text data is subjected to Trace text sequence processing to splice the key text data according to the arrangement order of the link node data in the call chain to obtain the second call chain data.

4. The microservice system fault monitoring method according to claim 1, characterized in that: The step of judging whether there is a fault in the call chain based on the predicted tag value includes: Determine the failure probability of the call chain data in the call chain based on the predicted tag value to determine whether there is a failure in the call chain; If so, locate the fault in the call chain, generate visualization content based on the fault and display it to the user; If not, the next call chain of the microservice system is monitored for faults.

5. The microservice system fault monitoring method according to claim 1, characterized in that: The step of predicting the sample call chain based on the first output vector and the second output vector to obtain a prediction probability includes: Performing a linear transformation on the first output vector to obtain a third output vector and a fourth output vector, and performing a linear transformation on the second output vector to obtain a fifth output vector; Calculating attention weight values ​​of the third output vector and the fifth output vector using a dot product operation, and weighting the fourth output vector according to the attention weight value to obtain a fusion vector; The sample call chain is predicted based on the fusion vector to obtain a prediction probability.

6. A microservice system fault monitoring device, characterized in that: The microservice system fault monitoring device comprises: A real-time monitoring module is used to monitor the microservice system in real time, and obtain first call chain data from the call chain of the microservice system according to the tracking identifier obtained by monitoring, wherein the call chain includes a plurality of API nodes; A data processing module, used for performing API dependency topology analysis and Trace text sequence processing on the first call chain data to obtain second call chain data; a data prediction module, used to input the second call chain data into a call chain prediction model to obtain a predicted label value of the call chain, wherein the predicted label value is used to represent a category label corresponding to the second call chain data; A fault monitoring module, used to determine whether there is a fault in the call chain based on the predicted tag value, so as to perform fault monitoring on the microservice system; The call chain prediction model is constructed based on the following steps: Performing API dependency topology analysis and Trace text sequence processing on the first historical data of the sample call chain in the microservice system to obtain second historical data, where the second historical data includes historical link interface data and historical link node data; Inputting the second historical data into an initial model for training to obtain a call chain prediction model, wherein the structure of the initial model includes a model encoding layer, an attention sharing layer, and a model prediction layer; The model encoding layer includes a graph attention encoding layer and a Transformer encoding layer, and the step of inputting the second historical data into the initial model for training to obtain a call chain prediction model includes: Inputting the historical link interface data into a graph attention encoding layer to obtain a first output vector, wherein the graph attention encoding layer is used to encode the corresponding API node in the historical link interface data into a vector; Inputting the historical link node data into a Transformer encoding layer to obtain a second output vector, wherein the Transformer encoding layer is used to encode the corresponding sequence text in the historical link node data into a vector; Predicting the sample call chain based on the first output vector and the second output vector to obtain a prediction probability, and calculating a loss value of the initial model based on a loss function; The initial model is optimized in parameters according to the loss value to obtain a call chain prediction model.

7. A microservice system fault monitoring device, characterized in that: The device comprises: a memory, a processor, and a microservice system fault monitoring program stored in the memory and executable on the processor, wherein the microservice system fault monitoring program is configured to implement the steps of the microservice system fault monitoring method according to any one of claims 1 to 5.

8. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a microservice system fault monitoring program is stored on the storage medium. When the microservice system fault monitoring program is executed by the processor, the steps of the microservice system fault monitoring method according to any one of claims 1 to 5 are implemented.