Root cause location method, medium and device for microservice system with missing data
Feature extraction and reconstruction of microservice monitoring data are performed through convolutional networks and GRU timing networks, which solves the problem of missing microservice system monitoring data under cloud native architecture and improves the accuracy of fault root cause location and system stability.
Patent Information
- Application Number
- CN202411025507.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2044-07-30
AI Technical Summary
Under the cloud native architecture, the monitoring indicator data of the microservice system is missing due to limited resources, which affects the accuracy of data analysis and fault root cause location.
Convolutional networks are used to construct vector features in time and space dimensions, hidden layer states and encoder outputs are obtained through GRU sequential networks and multi-layer perceptrons, attention alignment and decoding are performed, missing data features are reconstructed, and node failure probabilities are finally predicted to achieve Sequencing of root causes of failures.
It improves the stability and observability of the microservice system, ensures the time and space completion of microservice monitoring data without losing the original characteristics, and achieves accurate sorting of root causes of faults.
Smart Images

Figure CN118550757B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of intelligent operation and maintenance, and more specifically, to a method, medium and device for locating the root cause of missing data in a microservice system. Background Art
[0002] Microservice system indicators are crucial for maintaining system health and diagnosing faults. However, due to the characteristics of cloud-native architecture, some monitoring indicator data is missing. This incompleteness may seriously affect the accuracy of subsequent data analysis and root cause location.
[0003] In modern microservice architectures, the mainstream indicator collection method adopts the sidecar design pattern. Specifically, this involves running a sidecar process next to the business process, which is responsible for real-time monitoring and collecting monitoring indicator data of the business process. The collected data is then integrated and reported, and finally stored in a specific database for subsequent analysis. This design pattern allows the monitoring logic to be separated from the business logic so as not to interfere with the operation of the main business. However, the indicator data collection process itself has a demand for computing, storage, and network resources that cannot be ignored. In an environment with limited resources, especially when machine resources are tight, the sidecar process is likely to encounter work interruptions, resulting in discontinuity in the data collection task and the loss of some detection data, which brings new challenges to the traditional microservice root cause location task. Summary of the invention
[0004] The purpose of the present invention is to provide a method, medium and device for locating the root cause of a microservice system with missing data, which can achieve fault root cause sorting and improve the stability and observability of maintaining the microservice system.
[0005] The present invention provides a method for locating root causes of missing data in a microservice system, comprising the following steps:
[0006] S1: Obtain microservice monitoring data, preprocess the microservice monitoring data, and obtain original sequence data and target sequence;
[0007] S2: extract time features from the original sequence data to obtain a time feature vector of microservice monitoring data and a space feature vector of microservice monitoring data, and merge the time feature vector of microservice monitoring data and the space feature vector of microservice monitoring data to obtain a concatenated vector;
[0008] S3: Based on the concatenated vector, 1D convolution, GRU temporal network and encoder hidden layer multi-layer sensor are used to obtain the hidden state and encoder output;
[0009] S4: Get the energy score, attention weight and context vector based on the encoder output and hidden state;
[0010] S5: According to the context vector, the GRU decoder is used to obtain the reconstructed data features;
[0011] S6: Based on the reconstructed data features, the failure probability of the node is predicted to obtain the root cause of the system failure.
[0012] Furthermore, step S1 of the above-mentioned method for locating the root cause of missing data in a microservice system includes the following steps:
[0013] S11: Obtain microservice monitoring data, which includes CPU utilization, memory usage, and disk IO;
[0014] S12: Remove outliers, standardize, and interpolate the microservice monitoring data to obtain the original sequence data and the target sequence.
[0015] Furthermore, step S2 of the above-mentioned method for locating the root cause of missing data in a microservice system includes the following steps:
[0016] S21: Extract the time features of the original sequence data to obtain the time feature vector of the microservice monitoring data, as shown in the formula:
[0017]
[0018] ,
[0019] Among them, X ′ time (b,h,t,n) is the time feature vector of microservice monitoring data, with the shape of [ B, H t , T, N ], B is the data batch size, H t Represents the number of features output by the convolutional layer in the time dimension, T is the number of time steps, N is the number of microservice system nodes, X time () is the reshaped input data, the shape is [B, F, T, N], F is the number of indicators monitored by each node; b is the batch index, indicating which batch of samples is currently being processed; f is the feature channel index, indicating which feature is currently being processed; h is the output channel index, corresponding to a specific "depth" or "channel" in the output feature map of the convolutional layer; t is the time step index, indicating the position in the time dimension after the convolution operation; nis the node index, indicating which node is currently being processed; ReLU() is the activation function; k t is the convolution kernel size in the time dimension; m is the local index of the convolution kernel; W t () is the weight parameter of the convolution kernel in the time dimension; b t () is the bias term of the convolution operation in the time dimension;
[0020] S22: Extract spatial features from the original sequence data to obtain the spatial feature vector of microservice monitoring data, as shown in the formula:
[0021] ,
[0022] Among them, X′ node ( b, h, f, t ) is the spatial feature vector of microservice monitoring data, with the shape of [B,H n ,T,N], B is the data batch size, H n Represents the number of features output by the convolutional layer in the spatial dimension, T is the number of time steps, and N is the number of nodes in the microservice system; b is the batch index, h is the output channel index, f is the feature channel index, t is the time step index; ReLU() is the activation function; k n is the convolution kernel size in the spatial dimension; X node () is the reshaped input data, the shape is [B, N, F, T]; m is the local index of the convolution kernel; W n () is the weight parameter of the convolution kernel in the spatial dimension; b n () is the bias term of the convolution operation in the spatial dimension;
[0023] S23: Merge the time feature vector of the microservice monitoring data and the space feature vector of the microservice monitoring data to obtain a concatenated vector, as shown in the formula:
[0024] ,
[0025] Among them, X combined is the concatenated vector, concat(., dim=1) means concatenating two vectors in the second dimension, X′ time is the time feature vector of microservice monitoring data, X′ node Monitoring data space feature vectors for microservices.
[0026] Furthermore, step S3 of the above-mentioned method for locating the root cause of missing data in a microservice system includes the following steps:
[0027] S31: Use 1D convolution to reshape the concatenated vector to obtain the reshaped sequence vector, as shown in the formula:
[0028] ,
[0029] Among them, X seq [ b, h′, t′ ] is the reshaped sequence vector, b is the batch index, h′ Output channel index of 1D convolution; t′ is the time step index of 1D convolution, ReLU() is the activation function; H t is the number of features output by the convolutional layer in the time dimension, H n is the number of features output by the convolutional layer in the spatial dimension, k is the convolution kernel size of 1D convolution, s is the step length, h is the output channel index, m is the local index of the convolution kernel, W[ h′, h, m ] is the weight of the 1D convolutional layer, b [ h′ ] is the bias term of the 1D convolution operation;
[0030] S32: Based on the reshaped sequence vector, the hidden state is obtained using the GRU timing network, as shown in the formula:
[0031]
[0032]
[0033]
[0034]
[0035] in, h t is the hidden state, z t To update the gate, h t-1 represents the hidden state at the previous time step, Represents element-wise multiplication; is a candidate hidden state, σ Represents the sigmoid function, ensuring that the value of the gate control signal is between 0 and 1; W z ,W r,W h is the weight matrix, X seq,t Indicates that at time step t The input feature vector of b z ,b r ,b h is the bias term; r t To reset the gate, tanh Provides nonlinear activation for computing candidate hidden states;
[0036] S33: According to the hidden state, the encoder hidden layer multi-layer sensor is used to obtain the encoder output.
[0037] Furthermore, step S4 of the above-mentioned method for locating the root cause of missing data in a microservice system includes the following steps:
[0038] S41: According to the encoder output and hidden state, the energy score is obtained, as shown in the formula:
[0039]
[0040] Where E is the energy score, tanh is a nonlinear activation, W attn is the weight matrix, h t-1 ′ is the hidden state of the decoder at the previous moment, O enc is the encoder output, b attn is the bias term;
[0041] S42: According to the energy score, the attention weight is obtained, as shown in the formula:
[0042]
[0043] Among them, A is the attention weight, softmax() is the normalized exponential function, v is a learnable parameter, E is the energy score, and softmax(.,dim=1) means operating on the two parameters in the second dimension;
[0044] S43: According to the attention weight and encoder output, the context vector is obtained, as shown in the formula:
[0045]
[0046] Among them, C t is the context vector, T is the number of time steps, Ati is the first in the attention weight i elements, representing the t The decoding step is i The degree of attention of each encoder output; O enc,i is the first i The output of time steps.
[0047] Furthermore, step S5 of the above-mentioned method for locating the root cause of missing data in a microservice system specifically includes:
[0048] According to the context vector in step S4, the reconstructed data features are obtained using the GRU decoder, as shown in the formula:
[0049]
[0050] Among them, H M is the decoder output, which represents the sequence features obtained after reconstructing the missing data; h t is the current decoder hidden state; RNN() represents a recurrent neural network; Concat() is a connection function, input t is the input of the current time step, C t is the context vector, h t-1 ′ is the decoder hidden state at the previous time step, and is obtained by comparing the target sequence and the reconstructed sequence H M The loss is calculated based on the difference between the predicted and actual values, and the mean square error (MSE) is used as the loss function for the reconstruction task. The gradient of the model parameters is calculated through the back propagation algorithm based on the result of the loss function, and the Adam optimizer is used to update the weights of the model to reduce the difference between the predicted and actual values.
[0051] Furthermore, step S6 of the above-mentioned method for locating the root cause of missing data in a microservice system specifically includes:
[0052] According to the reconstructed data features, the failure probability of the node is predicted to obtain the failure probability of each node. According to the failure probability of each node, the root cause of the system failure is obtained, as shown in the formula:
[0053]
[0054] Among them, Faults is the fault probability of the node, argsort() means to sort the elements from small to large and extract the index number corresponding to the element; exp is a natural exponential function, N is the number of nodes in the microservice system, i is the first of the fully connected output vectorsi values, W is the weight matrix of the fully connected layer, H G H M The one-dimensional vector after PCA dimensionality reduction, b f is the bias vector.
[0055] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-mentioned method for root cause location of a microservice system for missing data.
[0056] The present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the above-mentioned method for locating the root cause of a microservice system facing missing data are implemented.
[0057] Implementing the method, medium and device for locating the root cause of missing data in a microservice system provided by the present invention has the following beneficial effects:
[0058] The present invention constructs vector features of time and space dimensions for input data based on a convolutional network and obtains a splicing vector, obtains the hidden layer state of the splicing vector through a gated recurrent unit (GRU) temporal network encoder, and inputs it into a multilayer perceptron (MLP) to obtain an encoder output; performs attention alignment on the encoder output to obtain an attention context vector of the decoder; thereby, the original low-quality microservice monitoring data is complemented in time and space without losing the original features, and finally a gated recurrent unit (GRU) decoder is used to decode the attention context vector to obtain reconstructed data features, and based on the reconstructed data features, the failure probability of the node is predicted, and finally the root cause sorting of the failure is achieved, thereby improving the stability and observability of the maintenance microservice system. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] Figure 1 It is a flow chart of the root cause location method of a microservice system for missing data provided by the present invention;
[0060] Figure 2 It is a schematic diagram of the overall working process of the root cause location method of a microservice system for missing data provided by the present invention;
[0061] Figure 3 It is a structural block diagram of the computer device provided by the present invention. DETAILED DESCRIPTION
[0062] In order to have a clearer understanding of the technical features, purposes and effects of the present invention, specific embodiments of the present invention are now described in detail with reference to the accompanying drawings.
[0063] Figure 1 A schematic diagram of a method for locating the root cause of missing data in a microservice system according to an embodiment of the present invention is shown. In this embodiment, the method for locating the root cause of missing data in a microservice system comprises the following steps:
[0064] S1: Obtain microservice monitoring data, preprocess the microservice monitoring data, and obtain original sequence data and target sequence;
[0065] Specifically, step S1 of the root cause location method for microservice system with missing data includes the following steps: S11: obtaining microservice monitoring data, the microservice monitoring data including CPU utilization, memory usage, and disk IO; S12: removing outliers, standardizing, and interpolating the microservice monitoring data to obtain original sequence data and target sequence;
[0066] S2: extract time features from the original sequence data to obtain a time feature vector of microservice monitoring data and a space feature vector of microservice monitoring data, and merge the time feature vector of microservice monitoring data and the space feature vector of microservice monitoring data to obtain a concatenated vector;
[0067] Specifically, step S2 of the above-mentioned method for locating the root cause of missing data in a microservice system includes the following steps:
[0068] S21: Extract the time features of the original sequence data to obtain the time feature vector of the microservice monitoring data, as shown in the formula:
[0069]
[0070] ,
[0071] Among them, X ′ time (b,h,t,n) is the time feature vector of microservice monitoring data, with the shape of [ B, H t , T, N ] , B is the data batch size, H t Represents the number of features output by the convolutional layer in the time dimension, T is the number of time steps, N is the number of microservice system nodes, X time () is the reshaped input data, the shape is [B, F, T, N], F is the number of indicators monitored by each node; bis the batch index, indicating which batch of samples is currently being processed; f is the feature channel index, indicating which feature is currently being processed; h is the output channel index, corresponding to a specific "depth" or "channel" in the output feature map of the convolutional layer; t is the time step index, indicating the position in the time dimension after the convolution operation; n is the node index, indicating which node is currently being processed; ReLU() is the activation function; k t is the convolution kernel size in the time dimension; m is the local index of the convolution kernel; W t () is the weight parameter of the convolution kernel in the time dimension; b t () is the bias term of the convolution operation in the time dimension;
[0072] S22: Extract spatial features from the original sequence data to obtain the spatial feature vector of microservice monitoring data, as shown in the formula:
[0073]
[0074] Among them, X′ node ( b, h, f, t ) is the spatial feature vector of microservice monitoring data, with the shape of [B,H n ,T,N], B is the data batch size, H n Represents the number of features output by the convolutional layer in the spatial dimension, T is the number of time steps, and N is the number of nodes in the microservice system; b is the batch index, h is the output channel index, f is the feature channel index, t is the time step index; ReLU() is the activation function; k n is the convolution kernel size in the spatial dimension; X node () is the reshaped input data, the shape is [B, N, F, T]; m is the local index of the convolution kernel; W n () is the weight parameter of the convolution kernel in the spatial dimension; b n () is the bias term of the convolution operation in the spatial dimension;
[0075] S23: Merge the time feature vector of the microservice monitoring data and the space feature vector of the microservice monitoring data to obtain a concatenated vector, as shown in the formula:
[0076]
[0077] Among them, X combined is the concatenated vector, concat(., dim=1) means concatenating two vectors in the second dimension, X′ time is the time feature vector of microservice monitoring data, X′ node Monitor data space feature vectors for microservices;
[0078] S3: Based on the concatenated vector, 1D convolution, GRU temporal network and encoder hidden layer multi-layer sensor are used to obtain the hidden state and encoder output;
[0079] Specifically, step S3 of the above-mentioned method for locating the root cause of missing data in a microservice system includes the following steps:
[0080] S31: Use 1D convolution to reshape the concatenated vector to obtain the reshaped sequence vector, as shown in the formula:
[0081] ,
[0082] Among them, X seq [ b, h′, t′ ] is the reshaped sequence vector, b is the batch index, h′ Output channel index of 1D convolution; t′ is the time step index of 1D convolution, ReLU() is the activation function; H t is the number of features output by the convolutional layer in the time dimension, H n is the number of features output by the convolutional layer in the spatial dimension, k is the convolution kernel size of 1D convolution, s is the step length, h is the output channel index, m is the local index of the convolution kernel, W[ h′, h, m ] is the weight of the 1D convolutional layer, b [ h′ ] is the bias term of the 1D convolution operation;
[0083] S32: Based on the reshaped sequence vector, the hidden state is obtained using the GRU timing network, as shown in the formula:
[0084]
[0085] ,
[0086]
[0087]
[0088] in,h t is the hidden state, z t To update the gate, h t-1 represents the hidden state at the previous time step, represents element-wise multiplication; is a candidate hidden state, σ Represents the sigmoid function, ensuring that the value of the gate control signal is between 0 and 1; W z ,W r ,W h is the weight matrix, X seq,t Indicates that at time step t The input feature vector of b z ,b r ,b h is the bias term; r t To reset the gate, tanh Provides nonlinear activation for computing candidate hidden states;
[0089] S33: Obtain encoder output using multiple layers of encoder hidden layer sensors according to the hidden state;
[0090] S4: Get the energy score, attention weight and context vector based on the encoder output and hidden state;
[0091] Specifically, step S4 of the above-mentioned method for locating the root cause of missing data in a microservice system includes the following steps:
[0092] S41: According to the encoder output and hidden state, the energy score is obtained, as shown in the formula:
[0093]
[0094] Where E is the energy score, tanh is a nonlinear activation, W attn is the weight matrix, h t-1 ′ is the hidden state of the decoder at the previous moment, O enc is the encoder output, b attn is the bias term;
[0095] S42: According to the energy score, the attention weight is obtained, as shown in the formula:
[0096]
[0097] Among them, A is the attention weight, softmax() is the normalized exponential function, v is a learnable parameter, E is the energy score, and softmax(.,dim=1) means operating on the two parameters in the second dimension;
[0098] S43: According to the attention weight and encoder output, the context vector is obtained, as shown in the formula:
[0099]
[0100] Among them, C t is the context vector, T is the number of time steps, A ti is the first in the attention weight i elements, representing the t The decoding step is i The degree of attention of each encoder output; O enc,i is the first i Output of time steps;
[0101] S5: According to the context vector, the GRU decoder is used to obtain the reconstructed data features;
[0102] Specifically, step S5 of the above-mentioned method for locating the root cause of missing data in a microservice system specifically includes:
[0103] According to the context vector in step S4, the reconstructed data features are obtained using the GRU decoder, as shown in the formula:
[0104]
[0105] Among them, H M is the decoder output, which represents the sequence features obtained after reconstructing the missing data; h t is the current decoder hidden state; RNN() represents a recurrent neural network; Concat() is a connection function, input t is the input of the current time step, C t is the context vector, h t-1 ′ is the decoder hidden state at the previous time step, and is obtained by comparing the target sequence and the reconstructed sequence H MThe loss is calculated by the difference between the predicted and actual values, and the mean square error (MSE) is used as the loss function for the reconstruction task. The gradient of the model parameters is calculated through the back propagation algorithm based on the result of the loss function, and the Adam optimizer is used to update the weights of the model to reduce the difference between the predicted and actual values;
[0106] S6: Based on the reconstructed data features, the failure probability of the node is predicted to obtain the root cause of the system failure;
[0107] Specifically, step S6 of the above-mentioned method for locating the root cause of missing data in a microservice system specifically includes:
[0108] According to the reconstructed data features, the failure probability of the node is predicted to obtain the failure probability of each node. According to the failure probability of each node, the root cause of the system failure is obtained, as shown in the formula:
[0109]
[0110] Among them, Faults is the fault probability of the node, argsort() means to sort the elements from small to large and extract the index number corresponding to the element; exp is a natural exponential function, N is the number of nodes in the microservice system, i is the first of the fully connected output vectors i values, W is the weight matrix of the fully connected layer, H G H M The one-dimensional vector after PCA dimensionality reduction, b f is the bias vector.
[0111] In some embodiments, the aforementioned microservice system root cause location method for missing data may also be implemented in the following manner.
[0112] In an embodiment, Figure 2 As shown in Figure 1, the root cause location method for missing data in a microservice system includes the following steps: S1: preprocessing the monitoring data of the microservice system by removing outliers, standardizing, and interpolating; S2: constructing vector features of the time and space dimensions of the input data based on a convolutional network and splicing them into X combined ; S3: Get the concatenated vector X in S2 through the GRU temporal network encoder combined The hidden layer state is input into MLP to get the encoder output O enc ; S4: Output the encoder in S3 O encPerform attention alignment to obtain the attention context vector C of the decoder; S5: decode the attention context vector C through the GRU decoder to obtain the reconstructed data features; S6: predict the failure probability of the node based on the reconstructed data features to achieve fault root cause sorting;
[0113] Specifically, step S1 of the root cause location method for microservice system with missing data is as follows: using the 3-sigma anomaly detection method to remove outliers from the collected microservice monitoring data (for example, CPU utilization, memory usage, disk IO and other indicators); using the Z-score method for standardization; for the missing parts in the data, preliminarily filling them by average interpolation so that the model can be trained in a supervised learning environment; assuming that the shape of the input data X is [B, T, F, N], where B is the data batch size, T is the number of time steps, N is the number of nodes in the microservice system, and F is the number of indicators monitored by each node;
[0114] Specifically, step S2 of the root cause location method for missing data in a microservice system is as follows: S21: learning the time-level features of the input preprocessed data based on the dynamic features of the time series and the relationship between nodes; assuming X time is the input data of X after shape adjustment, the shape is [B, F, TN], then the convolution in the time dimension can be expressed as:
[0115]
[0116] in: b is the batch index, indicating which batch of samples is currently being processed; h is the output channel index, corresponding to a specific "depth" or "channel" in the output feature map of the convolutional layer; t is the time step index, indicating the position in the time dimension after the convolution operation; n is the node index, indicating which node is currently being processed; m is the local index of the convolution kernel; W t is the weight parameter of the convolution kernel in the time dimension; b t is the bias term of the convolution operation in the time dimension. ′ time The shape is [ B, H t , T, N ],in H t represents the number of features output by the convolutional layer in the time dimension; S22: vectorized indicator data in the spatial dimension; for the convolution in the spatial dimension, let the convolution kernel size be (kn ,N) ,in k n is the convolution kernel size in the spatial dimension; let X′ node is the reshaped input data with the shape of [B, N, F, T], then the convolution of the spatial dimension of the indicator data node can be expressed as:
[0117]
[0118] Among them, W n is the weight parameter of the convolution kernel in the spatial dimension; b n is the bias term of the spatial dimension convolution operation; S23: merge the feature vectors of the indicator data in the time dimension and the spatial dimension; the convolution output of the time dimension is X ′ time The convolution output X′ of the node space dimension node Merge on the feature dimension (assuming it is the second dimension, i.e., the channel dimension); X obtained in the previous step ′ time and X′ node The shapes are and , the merge operation can be expressed as:
[0119]
[0120] concat(., dim=1) means concatenating two vectors in the second dimension. combined The shape becomes [ B, (H t + H n ), T, N ];
[0121] Specifically, step S3 of the root cause location method for the microservice system with missing data is as follows: S31: X is convolved by 1D convolution. combined Reshape to match the input shape expected by 1D convolution to speed up sequence data processing; merge the time step T and the number of nodes N into a new dimension, so X combined Reshaped as [ B, H t +H n ,T × N ]; Assume that the convolution kernel size of 1D convolution is k , the step length is s , the 1D convolution slides along the combined T×N dimension, and each slide covers kconsecutive elements and generate a new eigenvalue; this process can be expressed as:
[0122]
[0123] in, h′ Output channel index of 1D convolution; t′ is the time step index of the 1D convolution; after the 1D convolution layer, the output is X seq The shape is [ B, H out , T × N ],in B is the batch size, H out is the number of features output by the convolutional layer, T × N Represents the combined dimension of time steps and number of nodes; S32: Obtain hidden layer features through GRU time series network; First, X seq The shape of B, H out , T × N ] is reshaped into [ B, H out , T, N ], the time step T and number of nodes N Clearly separate; then use the Permute operation to seq Transpose the dimensions of B, T, H out ,N ], each time step T contains H out ×N features; finally, the last two dimensions are merged through the Reshape operation to obtain the final shape [ B, T, H out ×N ], so that the feature dimension corresponding to each time step is the number of nodes multiplied by the number of convolution output features; for each time step t , the hidden state update formula of GRU is:
[0124]
[0125] in,
[0126]
[0127]
[0128]
[0129] X seq,t represents the input feature vector at time step t; ht-1 represents the hidden state of the previous time step; z t To update the gate, r t To reset the gate, is the candidate hidden state; represents element-wise multiplication; W z ,W r ,W h is the weight matrix, b z ,b r ,b h is the bias term; σ Represents the sigmoid function, ensuring that the value of the gate control signal is between 0 and 1; tanh Provide nonlinear activation for calculating candidate hidden states; S33: convert hidden states h t Feed The MLP of the layer finally gets the encoder output , whose shape is ,in is the batch size, is the number of time steps, H enc is the size of the encoder hidden layer;
[0130] Specifically, step S4 of the root cause location method for microservice system with missing data is as follows: S41: Calculate the energy score; use GRU as the decoder backbone network, based on the hidden state of the decoder at the previous moment h t-1 ′ and encoder output O enc Calculate the energy score, denoted as E, and the calculation process is as follows:
[0131]
[0132] in W attn is a shape of [ H dec +H enc ,H dec ] is the weight matrix, H dec represents the hidden layer size of the decoder, b attn is the bias term; the shape of E is [ B, T, H dec], indicating the contribution of each time step to the current decoding step; S42: Calculate the attention weight; Next, calculate the attention weight by applying the softmax function to the energy score E :
[0133]
[0134] in v is a learnable parameter; the energy score is converted into a probability distribution by calculating the attention weight, which indicates the importance of each input sequence element to the current decoding step; S43: Finally, the output of the encoder is O enc Perform weighted summation to obtain the context matrix C:
[0135]
[0136] in, A ti is the first in the attention weight i elements, representing the t The decoding step is i The degree of attention of each encoder output; O enc,i is the first i The output of time steps; the context vector C t It is obtained by weighted averaging all encoder outputs. Combining the above steps, the context vector C can be expressed as:
[0137]
[0138] Specifically, step S5 of the root cause location method for the microservice system with missing data is as follows: based on the information of the encoder and the previous output, the state of the decoder is updated, and the context vector C t and the input of the current time step input t Send them to the decoder GRU unit for processing:
[0139]
[0140] in input t is the input of the current time step, C t is the context vector, h t-1 ′ is the decoder hidden state at the previous time step. M is the decoder output, which represents the sequence features obtained after reconstructing the missing data;
[0141] By comparing the target sequence and the reconstructed sequence H M The loss is calculated by the difference between the predicted and actual values, and the mean square error (MSE) is used as the loss function for the reconstruction task. The gradient of the model parameters is calculated through the back propagation algorithm based on the result of the loss function, and the Adam optimizer is used to update the weights of the model to reduce the difference between the predicted and actual values;
[0142] Specifically, step S6 of the root cause location method for the microservice system with missing data is as follows: M The dimension is reduced to a one-dimensional vector, and then input into the fully connected layer for dimension mapping, and then the probability prediction is performed through the softmax layer to obtain the fault probability Faults of each node:
[0143]
[0144] Where N is the number of nodes in the microservice system. is the first of the fully connected output vectors i values, W and b f It is the weight matrix and bias vector of the fully connected layer. argsort() means to arrange the elements from small to large and extract the index number corresponding to the element. Then the nodes in Faults are sorted according to the fault probability. The larger the probability, the more likely it is to be the root cause of the fault.
[0145] In this embodiment, the Sockshop microservice system is used as the data set source; SockShop is a real running software system that fully adopts cloud native technology and microservice architecture for containerization; this application is an online store selling socks, focusing on providing users with a front-end interactive interface; it is designed to demonstrate and test the practicality of microservice architecture and cloud native technology; SockShop includes multiple microservice instances, such as front-end service, order service, payment service, user service, user database service, shopping cart service, classification service, shopping service and message queue service, etc. These services work together to support the operation of the microservice system; the embodiment performs specific masking on the selected data set to generate a fixed type of incomplete indicator number, aiming to provide a unified and fair experimental environment under incomplete indicator data for different comparison methods;
[0146] Hit Rate is often used to evaluate the accuracy of root cause location tasks. In this example, HR@1, HR@3, HR@5 accuracy and Top5 (Avg5) accuracy are used as the main evaluation criteria. HR@k provides a clear metric that can quantify the accuracy of the root cause node prediction. kThe probability that a predicted instance contains a true root cause instance is an indicator commonly used to measure the system's positioning capability in root cause location work in the field; HR@k can be calculated mathematically using the following formula:
[0147]
[0148] in, F is the set of samples with errors in the test set, RC i For the i samples, and their real abnormal root cause instances; C pk Represents the Top-k abnormal instance set results predicted by the model; k Represents the specific corresponding indicator HR@ value;
[0149] In addition to the basic evaluation indicators, this embodiment introduces Avg5 as an additional indicator in this scenario to clearly compare the performance of various methods. The specific calculation method is as follows:
[0150]
[0151] Finally, by comparing with the advanced methods PC_based, GES_based, LiNGAM_based and CausalRCA that use indicator data for root cause analysis, the root cause location method proposed in this invention achieved better results, as shown in Table 1.
[0152] Table 1: Root cause localization performance on the Sockshop dataset
[0153]
[0154] This embodiment provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned microservice system root cause location method for missing data are implemented. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory (Flash Memory), a hard disk drive (HDD) or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above-mentioned types of memory.
[0155] This embodiment provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the steps of the above-mentioned method for locating the root cause of a microservice system with missing data are implemented.
[0156] like Figure 3 As shown, the computer device may include: at least one processor 121, such as a CPU (Central Processing Unit), at least one communication interface 123, a memory 124, and at least one communication bus 122. Among them, the communication bus 122 is used to realize the connection and communication between these components. Among them, the communication interface 123 may include a display screen (Display), a keyboard (Keyboard), and the optional communication interface 123 may also include a standard wired interface and a wireless interface. The memory 124 may be a high-speed RAM memory (Random Access Memory, volatile random access memory), or a non-volatile memory (non-volatile memory), such as at least one disk memory. The memory 124 may also be at least one storage device located away from the aforementioned processor 121. Among them, the memory 124 stores an application program, and the processor 121 calls the program code stored in the memory 124 to perform any of the above method steps. Among them, the communication bus 122 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The communication bus 122 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3Only one line is used to represent it, but it does not mean that there is only one bus or one type of bus. Among them, the memory 124 may include a volatile memory (English: volatile memory), such as a random access memory (English: random-access memory, abbreviated: RAM); the memory may also include a non-volatile memory (English: non-volatile memory), such as a flash memory (English: flash memory), a hard disk drive (English: hard disk drive, abbreviated: HDD) or a solid-state drive (English: solid-state drive, abbreviated: SSD); the memory 124 may also include a combination of the above-mentioned types of memory. Among them, the processor 121 may be a central processing unit (English: central processing unit, abbreviated: CPU), a network processor (English: network processor, abbreviated: NP) or a combination of CPU and NP. Among them, the processor 121 may further include a hardware chip. The above-mentioned hardware chip may be an application-specific integrated circuit (English: application-specific integrated circuit, abbreviated: ASIC), a programmable logic device (English: programmable logic device, abbreviated: PLD) or a combination thereof. The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof. Optionally, the memory 124 is also used to store program instructions. The processor 121 may call the program instructions to implement the root cause location method for the microservice system with missing data as in this embodiment.
[0157] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the enlightenment of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the purpose of the present invention and the claims, which all fall within the protection of the present invention.
Claims
1. A method for locating the root cause of missing data in a microservice system, characterized in that: The following steps are involved: S1: Acquire microservice monitoring data, preprocess the microservice monitoring data, and obtain original sequence data and target sequence; S2: extracting time features from the original sequence data to obtain a time feature vector of microservice monitoring data and a space feature vector of microservice monitoring data, and merging the time feature vector of microservice monitoring data and the space feature vector of microservice monitoring data to obtain a concatenated vector; step S2 specifically includes the following steps: S21: Extract time features from the original sequence data to obtain a time feature vector of microservice monitoring data, such as the formula: , Among them, X ′ time (b,h,t,n) is the time feature vector of microservice monitoring data, with the shape of [ B,H t ,T,N ], B is the data batch size, H t Represents the number of features output by the convolutional layer in the time dimension, T is the number of time steps, N is the number of microservice system nodes, X time () is the reshaped input data, the shape is [B, F, T, N], F is the number of indicators monitored by each node; b is the batch index, indicating which batch of samples is currently being processed; f is the feature channel index, indicating which feature is currently being processed; h is the output channel index, corresponding to a specific "depth" or "channel" in the output feature map of the convolutional layer; t is the time step index, indicating the position in the time dimension after the convolution operation; n is the node index, indicating which node is currently being processed; ReLU() is the activation function; k t is the convolution kernel size in the time dimension; m is the local index of the convolution kernel; W t () is the weight parameter of the convolution kernel in the time dimension; b t () is the bias term of the convolution operation in the time dimension; S22: Extract spatial features from the original sequence data to obtain a spatial feature vector of microservice monitoring data, such as the formula: , Among them, X′ node ( b,h,f,t ) is the spatial feature vector of microservice monitoring data, with the shape of [B,H n ,T,N], B is the data batch size, H n Represents the number of features output by the convolutional layer in the spatial dimension, T is the number of time steps, and N is the number of nodes in the microservice system; b is the batch index, h is the output channel index, f is the feature channel index, t is the time step index; ReLU() is the activation function; k n is the convolution kernel size in the spatial dimension; X node () is the reshaped input data, the shape is [B, N, F, T]; m is the local index of the convolution kernel; W n () is the weight parameter of the convolution kernel in the spatial dimension; b n () is the bias term of the convolution operation in the spatial dimension; S23: Merge the microservice monitoring data time feature vector and the microservice monitoring data space feature vector to obtain a concatenated vector, as shown in the formula: , Among them, X combined is the concatenated vector, concat(., dim=1) means concatenating two vectors in the second dimension, X′ time is the time feature vector of microservice monitoring data, X′ node Monitor data space feature vectors for microservices; S3: According to the splicing vector, using 1D convolution, GRU temporal network and encoder hidden layer multi-layer sensor, obtain hidden state and encoder output; S4: Obtain energy scores, attention weights, and context vectors based on the encoder output and hidden state; S5: Obtain reconstructed data features using a GRU decoder according to the context vector; S6: According to the reconstructed data features, predict the failure probability of the node to obtain the root cause of the system failure.
2. The method for locating the root cause of missing data in a microservice system according to claim 1, characterized in that: Step S1 includes the following steps: S11: Obtain microservice monitoring data, where the microservice monitoring data includes CPU utilization, memory usage, and disk IO; S12: removing outliers, standardizing, and interpolating the microservice monitoring data to obtain original sequence data and target sequence.
3. The method for locating the root cause of missing data in a microservice system according to claim 1, characterized in that: Step S3 includes the following steps: S31: Use 1D convolution to reshape the concatenated vector to obtain a reshaped sequence vector, as shown in the formula: , Among them, X seq [ b,h′,t′ ] is the reshaped sequence vector, b is the batch index, h′ Output channel index of 1D convolution; t′ is the time step index of 1D convolution, ReLU() is the activation function; H t is the number of features output by the convolutional layer in the time dimension, H n is the number of features output by the convolutional layer in the spatial dimension, k is the convolution kernel size of 1D convolution, s is the step length, h is the output channel index, m is the local index of the convolution kernel, W[ h′,h,m ] is the weight of the 1D convolutional layer, b [ h′ ] is the bias term of the 1D convolution operation; S32: Based on the reshaped sequence vector, the hidden state is obtained using the GRU timing network, as shown in the formula: , , , , in, h t is the hidden state, z t To update the gate, h t-1 represents the hidden state at the previous time step, represents element-wise multiplication; is a candidate hidden state, σ Represents the sigmoid function, ensuring that the value of the gate control signal is between 0 and 1; W z ,W r ,W h is the weight matrix, X seq,t Indicates that at time step t The input feature vector of b z ,b r ,b h is the bias term; r t To reset the gate, tanh Provides nonlinear activation for computing candidate hidden states; S33: According to the hidden state, using the encoder hidden layer multi-layer sensor to obtain the encoder output.
4. The method for locating the root cause of missing data in a microservice system according to claim 1, characterized in that: Step S4 includes the following steps: S41: According to the encoder output and hidden state, an energy score is obtained, such as the formula: , Where E is the energy score, tanh is a nonlinear activation, W attn is the weight matrix, h t-1 ′ is the hidden state of the decoder at the previous moment, O enc is the encoder output, b attn is the bias term; S42: Obtain attention weight according to the energy score, such as formula: , Among them, A is the attention weight, softmax() is the normalized exponential function, v is a learnable parameter, E is the energy score, and softmax(.,dim=1) means operating on the two parameters in the second dimension; S43: Obtain a context vector according to the attention weight and the encoder output, such as formula: Among them, C t is the context vector, T is the number of time steps, A ti is the first in the attention weight i elements, representing the t The decoding step is i The degree of attention of each encoder output; O enc,i is the first i The output of time steps.
5. The method for locating the root cause of missing data in a microservice system according to claim 1, characterized in that: Step S5 specifically includes: According to the context vector in step S4, the reconstructed data features are obtained using the GRU decoder, as shown in the formula: , Among them, H M is the decoder output, which represents the sequence features obtained after reconstructing the missing data; h t is the current decoder hidden state; RNN() represents a recurrent neural network; Concat() is a connection function, input t is the input of the current time step, C t is the context vector, h t-1 ′ is the decoder hidden state at the previous time step, and is obtained by comparing the target sequence and the reconstructed sequence H M The loss is calculated by the difference between the predicted and actual values, and the mean square error (MSE) is used as the loss function for the reconstruction task. The gradient of the model parameters is calculated through the back propagation algorithm based on the result of the loss function, and the Adam optimizer is used to update the weights of the model to reduce the difference between the predicted and actual values.
6. The method for locating the root cause of missing data in a microservice system according to claim 1, characterized in that: Step S6 specifically includes: According to the reconstructed data features, the failure probability of the node is predicted to obtain the failure probability of each node. According to the failure probability of each node, the root cause of the system failure is obtained, such as the formula: , Among them, Faults is the fault probability of the node, argsort() means to sort the elements from small to large and extract the index number corresponding to the element; exp is a natural exponential function, N is the number of nodes in the microservice system, i is the first of the fully connected output vectors i values, W is the weight matrix of the fully connected layer, H G H M The one-dimensional vector after PCA dimensionality reduction, b f is the bias vector.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the root cause location method for a microservice system with missing data as described in any one of claims 1 to 6 are implemented.
8. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the root cause location method for a microservice system with missing data as described in any one of claims 1-6 are implemented.
