Detection method and device for abnormal dependency, and storage medium
By obtaining and analyzing component dependency topology information of component library, we automatically detect abnormal dependencies between microservice components, solving the problem of low application quality caused by abnormal dependencies in component library, and achieving rapid and economical dependency detection and troubleshooting.
Patent Information
- Application Number
- PCT/CN2024/109274
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-08-02
- Filing Date
- 2024-08-01
- Publication Date
- 2025-02-06
AI Technical Summary
In assembled applications, the abnormal dependence between microservice components in the component library leads to low overall application quality, low manual inspection efficiency and high cost, and cannot meet the needs of rapid iteration and high-quality version delivery.
By obtaining component dependency topology information of the component library, including component description information, dependencies and architecture levels, automated detection methods are used to identify abnormal dependencies such as reverse dependencies, circular dependencies and duplicate dependencies.
It realizes rapid and automated detection of abnormal dependence between microservice components in the component library, reduces the cost and time of manual inspection, and improves the overall quality and iterative efficiency of the application.
Smart Images

Figure CN2024109274_06022025_PF_FP_ABST
Abstract
Description
Abnormal dependency detection method, device and storage medium
[0001] Related applications
[0002] This application claims priority to Chinese patent application No. 202310968914.6 filed on August 2, 2023, the entire contents of which are incorporated by reference into this application. Technical Field
[0003] The present application relates to the field of computer application technology, and in particular to an abnormal dependency detection method, device, and storage medium. Background Art
[0004] Faced with an ever-changing business environment and rapidly iterating business demands, "assembled applications" have become a key strategic technology trend due to their flexibility and reusability. In complex and ever-changing situations, assembled applications can significantly enhance an enterprise's adaptability and innovation capabilities. By introducing the concept of "modularity," assembled applications enable technical and business teams to reuse code more agilely and effectively. At its core is a software-defined, minimized business function known as "Packaged Business Capability (PBC)."
[0005] At the same time, with the lowering of the barrier to entry for microservices technology and the advancement of cloud computing capabilities, cloud-native technologies are also experiencing explosive growth. Cloud-native technologies are oriented towards microservices architectures, supporting assembly-based delivery and enabling modular assembly at the microservice level. Microservice-level applications, also known as microservice components, offer greater flexibility and reusability during assembly, enabling enterprises to rapidly iterate and deliver high-quality versions.
[0006] However, the component library (also known as the component market, component pool, etc.) is the source of microservice components during assembly and is also the core module in the assembly process. If there are abnormal dependencies between the microservice components in the component library, the overall quality of the assembled application will be poor. Manual troubleshooting of abnormal dependencies is inefficient and costly. As the number of microservice components in the component library increases, it can no longer meet actual usage needs. How to quickly check whether there are abnormal dependencies between the microservice components in the component library is a technical problem that urgently needs to be solved.
[0007] Summary of the Invention
[0008] The main purpose of this application is to provide an abnormal dependency detection method, device and storage medium.
[0009] To achieve the above objectives, the present application provides a method for detecting abnormal dependencies, which includes the following steps:
[0010] Obtain component dependency topology information corresponding to the component library, including component description information, component dependency relationships, and component architecture levels corresponding to each microservice component in the component library. The component dependency relationships are used to indicate other microservice components that a microservice component depends on for operation, and the component architecture level is used to indicate the architecture level to which the microservice component belongs in the service architecture.
[0011] Based on the component dependency topology information, it is detected whether the microservice components in the component library have abnormal dependencies.
[0012] In addition, to achieve the above-mentioned purpose, an embodiment of the present application also provides an abnormal dependency detection device, which includes: a processor, a memory, and an abnormal dependency detection program stored on the memory and capable of running on the processor. When the abnormal dependency detection program is executed by the processor, the steps of the abnormal dependency detection method described above are implemented.
[0013] In addition, to achieve the above-mentioned purpose, an embodiment of the present application further provides a computer-readable storage medium, on which an abnormal dependency detection program is stored, and when the abnormal dependency detection program is executed, the steps of the abnormal dependency detection method described above are implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] FIG1 is a schematic diagram of the structure of an electronic device in a hardware operating environment according to an embodiment of the present application;
[0015] FIG2 is a flow chart of a first embodiment of the abnormal dependency detection method of the present application;
[0016] FIG3 is a schematic diagram of reverse dependency according to an embodiment of the present application;
[0017] FIG4 is a schematic diagram of a circular dependency according to an embodiment of the present application;
[0018] FIG5 is a schematic diagram of repeated dependencies according to an embodiment of the present application;
[0019] FIG6 is a flow chart of a second embodiment of the abnormal dependency detection method of the present application;
[0020] FIG7 is a schematic diagram of a component relationship diagram according to an embodiment of the present application;
[0021] FIG8 is a schematic diagram of component dependency relationships according to an embodiment of the present application;
[0022] FIG9 is a flow chart of a third embodiment of the abnormal dependency detection method of the present application;
[0023] FIG10 is a schematic diagram of a component dependency topology diagram according to an embodiment of the present application;
[0024] FIG11 is a structural block diagram of the first embodiment of the abnormal dependency detection device of the present application.
[0025] The realization of the objectives, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0026] It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application.
[0027] Refer to Figure 1, which is a schematic diagram of the structure of an abnormal dependency detection device for a hardware operating environment involved in an embodiment of the present application.
[0028] As shown in Figure 1, the electronic 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. 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 user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may include a standard wired interface and a wireless interface (such as a wireless fidelity (WI-FI) interface). The memory 1005 may be a high-speed random access memory (RAM) or a stable non-volatile memory (NVM), such as a disk storage. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0029] Those skilled in the art will appreciate that the structure shown in FIG1 does not limit the electronic device and may include more or fewer components than shown, or combine certain components, or arrange the components differently.
[0030] As shown in FIG. 1 , the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and an abnormal dependency detection program.
[0031] In the electronic device shown in Figure 1, 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 electronic device of the present application can be set in an abnormal dependency detection device, and the electronic device calls the abnormal dependency detection program stored in the memory 1005 through the processor 1001, and executes the abnormal dependency detection method provided by the embodiment of the present application.
[0032] An embodiment of the present application provides an abnormal dependency detection method. Referring to FIG. 2 , FIG. 2 is a flow chart of a first embodiment of an abnormal dependency detection method of the present application.
[0033] In this embodiment, the abnormal dependency detection method includes the following steps:
[0034] Step S10: Obtain component dependency topology information corresponding to the component library.
[0035] The execution subject of this embodiment can be the abnormal dependency detection device, and the abnormal dependency detection device can be an electronic device such as a personal computer, a server, or other devices that can achieve the same or similar functions. This embodiment does not limit this. In this embodiment and the following embodiments, the abnormal dependency detection method of this application is explained by taking the abnormal dependency detection device as an example.
[0036] Component dependency topology information can include component descriptions, component dependencies, and component architecture hierarchies for each microservice component in the component library. The component library can be a database used to store microservice components. The component library can store microservice components that have been developed and are ready for use.
[0037] Among them, the component description information may include information such as the microservice name (name), microservice version (version), and microservice description (description). Of course, more information may be included according to actual needs, and this embodiment does not limit this. The component dependency relationship is used to represent other microservice components that the microservice component depends on for operation. For example, assuming that microservice component A depends on the interface and entity class provided by microservice component B during operation, the component dependency relationship of microservice component A is "A depends on B"; the component architecture level is used to represent the architecture level to which the microservice component belongs in the service architecture. For example, assuming that the architecture level includes application architecture, domain architecture, and data architecture, and microservice component A is applied in the application architecture, the component architecture level of microservice component A is the application architecture.
[0038] The specific number of component architecture levels can be pre-set by the component library manager. Of course, more component architecture levels can be set according to actual needs. For example, the data architecture in the three-tier microservice architecture can be further divided into data architecture and technical architecture. In this case, the three-tier microservice architecture can be extended to four layers.
[0039] In actual use, obtaining the component dependency topology information corresponding to the component library can be done by scanning the microservices corresponding to the microservice components in the component library to construct the component dependency topology information. Of course, it is also possible to pre-scan the microservice components in the component library and store the component dependency topology information constructed after the scan locally in the abnormal dependency detection device. In this case, obtaining the component dependency topology information corresponding to the component library can be done by reading the pre-stored component dependency topology information locally from the abnormal dependency detection device. In order to ensure that the component dependency topology information is up to date, the component dependency topology information can be rebuilt when the component library is updated (such as adding, modifying, or deleting microservice components in the component library).
[0040] Step S20: Detect whether there are abnormal dependencies among the microservice components in the component library based on the component dependency topology information.
[0041] Abnormal dependencies may include at least one of reverse dependencies, circular dependencies, and repeated dependencies.
[0042] In actual use, detecting whether there are abnormal dependencies among microservice components in the component library based on component dependency topology information can be to detect whether the component dependency topology information meets at least one of the judgment conditions of reverse dependency, circular dependency, and repeated dependency, thereby determining whether there are abnormal dependencies among microservice components in the component library.
[0043] In a specific implementation, the detection process is different for different abnormal dependencies. If the abnormal dependency to be detected is a reverse dependency, then step S20 described in this embodiment may include: obtaining the component architecture level corresponding to each microservice component in the component dependency topology information; determining whether a lower-level architecture component depends on an upper-level architecture component based on the component dependency relationship recorded in the component dependency topology information and the component architecture level; if so, determining that the microservice component in the component library has a reverse dependency.
[0044] The reverse dependency is that the microservice with the architecture type of the lower layer depends on the microservice with the architecture type of the upper layer. Therefore, the component architecture level corresponding to each microservice component can be read from the component dependency topology information. Then, according to the dependent components and dependent components recorded in the assembly dependency relationship, the architecture type of the component architecture level corresponding to the dependent component and the architecture type of the component architecture level corresponding to the dependent component are compared to determine whether there is a lower-level architecture component that depends on an upper-level architecture component. If so, it is determined that the microservices in the component library have a reverse dependency.
[0045] For example: assuming the component dependency is "A depends on B", the architecture hierarchy includes application architecture, domain architecture, and data architecture, and their corresponding architecture types are upper, middle, and lower, respectively. At this time, A is the dependent component and B is the dependent component. At this time, if B's architecture type is higher than A's (such as B's corresponding architecture type is upper, A's corresponding architecture type is middle or lower, or B's corresponding architecture type is middle, A's corresponding architecture type is lower), then it can be determined that a lower-level architecture component depends on an upper-level architecture component, and at this time it can be determined that a reverse dependency exists.
[0046] In a specific implementation, if the abnormal dependency to be detected is a circular dependency, then step S20 described in this embodiment may include: extracting a component dependency chain from the component dependency topology information; selecting a node in the component dependency chain as a starting node; traversing the component dependency chain according to the component dependency order in the component dependency chain based on the starting node; when traversing to a node consistent with the starting node, determining that there is a circular dependency between the microservice components in the component library.
[0047] Extracting a component dependency chain from the component dependency topology information may include extracting component description information and component dependency relationships from the component dependency topology information, using the component description information of each microservice as a node, and connecting each node in a chain according to the component dependency relationship to obtain a component dependency chain. The component dependency order in the component dependency chain may be the order in which the nodes in the component dependency chain are connected.
[0048] In actual use, selecting a node in a component dependency chain as a starting node can be done by selecting any node in the component dependency chain as the starting node, and then traversing the nodes in the component dependency chain according to the component dependency order in the component dependency chain. When detecting circular dependencies, the starting node can be selected multiple times, for example, all nodes in the component dependency chain can be selected as starting nodes once.
[0049] Circular dependency means that multiple microservice components depend on each other, forming a dependency loop. If you traverse to a node that is consistent with the starting node, it means that by traversing the index downward according to the node connection order of the component dependency chain, you can return to the original starting node, which means that a dependency loop has been formed at this time. Therefore, it can be determined that there are circular dependencies among the microservice components in the component library. For example: For example: Suppose there are three microservice components A, B, and C, among which the component dependency relationship is: "A depends on B, B depends on C, C depends on A", and a dependency loop (ABCA) is constructed. The component dependency chain formed at this time takes A as the starting node to traverse the component dependency chain and can traverse to the A node. At this time,
[0050] In a specific implementation, if the abnormal dependency to be detected is a duplicate dependency, then step S20 described in this embodiment may include: selecting a microservice component as the target component in the component dependency topology information; performing dependency tracing on the target component based on the component dependency relationship recorded in the component dependency topology information, and constructing a dependency component set based on the component information obtained from the dependency tracing; detecting whether there is duplicate component information in the dependency component set; if so, determining that there is duplicate dependency in the microservice component in the component library.
[0051] Selecting a microservice component as a target component in the component dependency topology information may be randomly selecting one of multiple microservice components included in the component dependency topology information as the target component. When detecting repeated dependencies, in order to ensure comprehensive detection, the target may be selected multiple times, for example, multiple microservice components included in the component dependency topology information may be selected as target components once.
[0052] In actual use, dependency tracing is performed on the target component based on the component dependency relationship recorded in the component dependency topology information, and a dependent component set is constructed based on the component information obtained by dependency tracing. This can be done by performing dependency tracing on the target component based on the component dependency relationship recorded in the component dependency topology information, and adding the component information obtained by dependency tracing to a collection to obtain a dependent component set.
[0053] Duplicate dependencies occur when a microservice component repeatedly depends on other microservice components. If duplicate component information exists in the dependent component set obtained by tracing the dependency of the target component, it means that the target component depends on the same component multiple times. Therefore, it can be determined that duplicate dependencies exist.
[0054] For example, assuming the target component is A and the component dependency is: "A depends on B and C, and B depends on C", then the dependent component set obtained by tracing the dependency of A is {B, C, C}. At this time, there is duplicate component information C in the dependent component set, so it can be determined that there is a duplicate dependency.
[0055] 3, 4 and 5 are used for illustration, but are not intended to limit this solution. FIG3 is a schematic diagram of reverse dependency in this embodiment, FIG4 is a schematic diagram of circular dependency in this embodiment, and FIG5 is a schematic diagram of repeated dependency in this embodiment.
[0056] As shown in Figure 3, data microservice 2 depends on domain microservice 1, and data microservice 3 depends on domain microservice 2. Both of them are the underlying data architecture that depends on the upper-level domain architecture. The architecture is obviously abnormal, and it can be determined that there is a reverse dependency anomaly; as shown in Figure 4, data microservices 2 and 3 are dependent on each other, forming a dependency closed loop, and it can be determined that there is a circular dependency anomaly; as shown in Figure 5, domain microservice 2 depends on data microservices 1, 2, and 3 at the same time, and data microservice 2 depends on data microservices 1 and 3, that is, the domain microservice repeatedly depends on data microservices 1 and 3, and it can be determined that there is a duplicate dependency.
[0057] This embodiment obtains component dependency topology information corresponding to the component library. The component dependency topology information includes component description information, component dependency relationships, and component architecture levels corresponding to each microservice component in the component library. The component dependency relationships are used to represent other microservice components that the microservice component depends on for operation, and the component architecture level is used to represent the architecture level to which the microservice component belongs in the service architecture. Based on the component dependency topology information, it is detected whether the microservice components in the component library have abnormal dependencies. Since the component dependency topology information corresponding to the component library is obtained and different types of abnormal dependencies are detected in different ways based on the information contained in the component dependency topology information, the abnormal dependency detection of the microservice components in the component library is achieved quickly by using automated detection.
[0058] Refer to FIG6 , which is a flow chart of a second embodiment of an abnormal dependency detection method of the present application.
[0059] Based on the first embodiment described above, step S10 of the abnormal dependency detection method of this embodiment includes:
[0060] Step S101: Obtain the microservice description file corresponding to each microservice component in the component library.
[0061] The microservice description file may be a file used to describe the characteristics of a microservice (for example, a PBC (packaged-business capabilities) file), and may be generated by a tool by scanning the microservices corresponding to each microservice component in the component library.
[0062] The microservice description file may include: description information of the microservice itself (such as the microservice name, microservice version, microservice description, etc.), basic information of the microservice exposure and dependency application programming interface (API, also known as the service interface) (such as the API name, version number, Swagger link, etc.), basic information of the microservice publishing and subscription events (such as the event message topic), and other information.
[0063] Step S102: Parse the microservice description file to obtain component description information and component dependency relationships corresponding to each microservice component in the component library.
[0064] In actual use, parsing the microservice description file to obtain the component description information and component dependency relationships corresponding to each microservice component in the component library can be done by parsing the microservice description file based on a preset file format, extracting the description information of the microservice in the microservice description file, obtaining the component description information, and constructing the component dependency relationships based on the basic information of the microservice exposure and dependency APIs and the basic information of the microservice publishing and subscription events. The preset file format can be pre-set by the administrator of the abnormal dependency detection device based on the microservice description file actually used.
[0065] In order to accurately obtain component dependencies, step S102 of this embodiment may include: parsing the microservice description file to obtain component description information of each microservice component in the component library and component interaction information between each microservice component; constructing a directed graph based on the component description information and the component interaction information to obtain a component relationship graph; and determining the component description information and component dependencies corresponding to each microservice component in the component library based on the component relationship graph.
[0066] Component interaction information may include the exposure and / or dependency relationship between microservices and service interfaces, and may also include the publish / subscribe relationship between microservices and events; the component relationship diagram includes the component description information of each microservice component and the dependency pointing relationship between the microservices contained in each microservice component and the service interface.
[0067] In actual use, a directed graph is constructed based on component description information and component interaction information. Obtaining a component relationship graph can be to construct multiple directed graph vertices based on the component description information, and then construct the edges of the directed graph based on the component interaction information, thereby obtaining a component relationship graph. At this time, the vertices in the component relationship graph include at least two types of microservice vertices and API vertices. The microservice vertex contains information such as the microservice name (name), microservice version (version), microservice description (description), and microservice architecture type attributes (architecture). The API vertex contains the API name (name), API version (version), request path (path), request method (method), and the Swagger path (specification) of the API. The event vertex contains the message topic (topic). Each edge in the directed graph represents an association relationship, which is used to represent the dependency pointing relationship between the microservice and the service interface (for example: vertex A depends on vertex B, then the dependency pointing relationship is "A→B").
[0068] In specific applications, determining the component description information and component dependency relationships corresponding to each microservice component in the component library based on the component relationship diagram can be based on the exposure / dependency relationship between the microservice components and APIs contained in the component relationship diagram, and then re-establishing the dependency relationships between the microservice components.
[0069] The construction of existing dependency relationships is mostly achieved through manually maintained description files. The microservice dependency directed graph established in this way is not flexible enough, and when the microservice functions change, the relevant description files need to be manually maintained and re-established, which has high maintenance costs. Therefore, by scanning the microservices, component interaction information can be obtained, and the component relationship graph can be automatically constructed based on the component interaction information. This can ensure that accurate component dependencies are obtained without a lot of manual intervention.
[0070] Now we will explain it with reference to Figures 7 and 8, but this solution is not limited to this. The constructed component relationship diagram is shown in Figure 7, which includes three microservice vertices: example-service1, example-service2, and example-service3, and four API vertices: api-example1, api-example2, api-example3, and api-example4. In addition, it also includes three event vertices: eventNotification1, eventNotification2, and eventNotification3. At this time, each edge in the component relationship diagram represents a dependency pointing relationship. According to the different descriptions on the edges, the dependency pointing relationship can be divided into four types: publish, depend, expose, and subscribe. At this time, in the component relationship diagram, example-service2 exposes api-example3, and example-ser Vice1 and example-service3 depend on api-example3, which means that example-service1 and example-service3 depend on example-service2. Similarly, example-service3 exposes api-example4, and microservice example-service1 depends on api-example4, which means that microservice example-service1 depends on microservice example-service3. Based on this logic, the component dependency relationship that can be established can be shown in Figure 8: example-service1 depends on example-service2 and example-service3, example-service2 depends on example-service1, and example-service3 depends on example-service2.
[0071] Step S103: construct multiple topological vertices according to the component description information.
[0072] In actual use, the constructed topology vertex is used to represent the microservice component, and the topology vertex contains the component description information of the microservice component.
[0073] Step S104: setting corresponding connection relationships for the multiple topological vertices according to the component dependency relationships, and obtaining component dependency topology information corresponding to the component library.
[0074] According to the component dependency relationship, corresponding connection relationships are set for multiple topological vertices. The component dependency topology information corresponding to the component library can be obtained from the association relationship between microservice components and microservice components in the component dependency relationship, and the corresponding connection relationship is set for each topological vertex according to the read relationship, thereby forming the component dependency topology information corresponding to the component library.
[0075] This embodiment obtains the microservice description file corresponding to each microservice component in the component library; parses the microservice description file to obtain the component description information and component dependency relationship corresponding to each microservice component in the component library; constructs multiple topology vertices based on the component description information; sets corresponding connection relationships for the multiple topology vertices based on the component dependency relationship to obtain the component dependency topology information corresponding to the component library. Since the microservices corresponding to the microservice components can be scanned to obtain the microservice description files corresponding to each microservice component, and then the microservice description files are parsed to construct a directed graph, determine the association relationship between the microservices and service interfaces involved in each microservice component, and thereby determine the component dependency relationship between each microservice component, it can ensure that the dependency relationship between microservice components can be determined normally without manual intervention, and thereby construct component dependency topology information, providing an implementation basis for abnormal dependency detection.
[0076] Refer to FIG9 , which is a flowchart of a third embodiment of an abnormal dependency detection method of the present application.
[0077] Based on the first embodiment described above, after step S20, the abnormal dependency detection method of this embodiment further includes:
[0078] Step S30: Obtain abnormal dependency detection results, and obtain a component dependency topology graph corresponding to the component library.
[0079] After obtaining the abnormal dependency detection result, in order to facilitate the user to understand the existence of the abnormal dependency, it can be presented in a graphical manner, so that the component dependency topology diagram corresponding to the component library can be obtained. The component dependency topology diagram can be a topology diagram constructed based on the component dependency topology information.
[0080] In a specific implementation, in order to ensure that users clearly understand the dependency relationships between microservice components and the architecture type described by each microservice component, the steps of constructing a component dependency topology map may include: constructing a dependency topology map based on the component dependency topology information; obtaining the component architecture hierarchy corresponding to each microservice component in the component dependency topology information; and layering the topological nodes in the dependency topology map based on the component architecture hierarchy to obtain a component dependency topology map.
[0081] Constructing a dependency topology graph based on component dependency topology information can be done by extracting component description information and component dependency relationships from the component dependency topology information, constructing multiple topology nodes based on the component description information, and setting corresponding topological relationships for each topology node based on the component dependency relationships, thereby obtaining a dependency topology graph.
[0082] In actual use, the topological nodes in the dependency topology diagram are layered based on the component architecture hierarchy. To obtain the component dependency topology diagram, the display position of each topological node in the dependency topology diagram can be adjusted to display them in layers, that is, the topological nodes of the same layer of the corresponding component architecture hierarchy are displayed in the same row, and the adjusted dependency topology diagram is used as the component dependency topology diagram.
[0083] By displaying each topology node in layers, users can quickly identify the component description information, component dependency relationships, and architectural levels of the microservice components corresponding to each topology node by viewing the component dependency topology diagram.
[0084] In the actual implementation process, the component dependency topology map construction step provided in this embodiment can be set to be executed when the component dependency topology information is obtained, that is, the above-mentioned component dependency topology map construction step can also be included after step S10, or it can be executed after the start of abnormal dependency detection. At this time, before the execution of step S30 described in this embodiment, the above-mentioned component dependency topology map construction step will be executed. Of course, the component dependency topology map can also be constructed when the abnormal dependency detection result is obtained. At this time, the acquisition of the component dependency topology map corresponding to the component library described in this embodiment can include the above-mentioned component dependency topology map construction step.
[0085] Step S40: marking the dependency topology graph as abnormal according to the abnormal dependency detection result, and displaying the marked component dependency topology graph.
[0086] Marking the dependency topology graph for abnormalities based on the abnormal dependency detection results can be performed by obtaining abnormal microservice components related to the abnormal dependency detection results, and then marking the abnormal dependency detection results near the abnormal microservice components in the dependency topology graph. The abnormal dependency detection results can be marked by floating windows, prompt boxes, etc.
[0087] This will now be explained in conjunction with Figure 10, but this solution is not limited thereto. Figure 10 is a schematic diagram of the component dependency topology of this embodiment. As shown in Figure 10, the topological nodes included in the component dependency topology are topicService1, dbService1, service1, servic2, service3, app1, app2, and app3, wherein the component architecture level corresponding to topicService1 and dbService1 is the data architecture (DataService), the component architecture level corresponding to service1, servic2, and service3 is the domain architecture (Domain), and the component architecture level corresponding to app1, app2, and app3 is the application architecture (Application), wherein a circular dependency is formed between dbService1, service2, and service3. At this time, the abnormal microservice components are dbService1, service2, and service3. At this time, the abnormal dependency detection result will be marked in the form of a prompt box "Abnormal prompt: There is a circular dependency" near the abnormal microservice component in the component dependency topology.
[0088] When the component dependency topology is displayed, the dependency relationship is centered on the currently selected microservice and displays the dependency relationships between all associated microservices. At the same time, each microservice on the component dependency topology is presented at the corresponding level strictly according to its architectural type attributes. The display interface of the component dependency topology is divided into two sections. The first is the canvas area on the left, which is used to display the structured component dependency topology and provide interface prompts for anomaly detection results. The second is the property panel on the right, which displays basic information about the microservice components. When a node (microservice) is selected on the left, the node is highlighted, and the property panel on the right displays its corresponding properties.
[0089] After displaying the component dependency topology diagram with anomaly detection results, the architectural anomalies of the microservices in the current component pool can be intuitively discovered based on the marks in the component dependency topology diagram, promoting microservice architecture governance. Each microservice provider can perform microservice governance based on the anomaly information and optimize the microservice architecture.
[0090] This embodiment obtains the abnormal dependency detection results and the component dependency topology corresponding to the component library; marks the dependency topology as abnormal based on the abnormal dependency detection results, and displays the marked component dependency topology. Since the component dependency topology corresponding to the component library is also obtained, the dependency topology is marked as abnormal based on the abnormal dependency detection results, and the marked component dependency topology is displayed, users can quickly determine whether abnormal dependencies exist and the microservice components involved in the existing abnormal dependencies based on the marked component dependency topology, so that microservice providers can perform microservice governance based on the abnormal information.
[0091] In addition, an embodiment of the present application further proposes a storage medium on which an abnormal dependency detection program is stored. When the abnormal dependency detection program is executed by a processor, the steps of the abnormal dependency detection method described above are implemented.
[0092] Refer to Figure 11, which is a structural block diagram of the first embodiment of the abnormal dependency detection device of the present application.
[0093] As shown in Figure 11, the abnormal dependency detection device proposed in the embodiment of the present application includes: an acquisition module 10, which is used to obtain component dependency topology information corresponding to the component library, and the component dependency topology information includes component description information, component dependency relationships and component architecture levels corresponding to each microservice component in the component library. The component dependency relationships are used to represent other microservice components that the microservice component depends on for operation, and the component architecture level is used to represent the architecture level to which the microservice component belongs in the service architecture; a detection module 20, which is used to detect whether the microservice components in the component library have abnormal dependencies based on the component dependency topology information.
[0094] This embodiment obtains component dependency topology information corresponding to the component library. The component dependency topology information includes component description information, component dependency relationships, and component architecture levels corresponding to each microservice component in the component library. The component dependency relationships are used to represent other microservice components that the microservice component depends on for operation, and the component architecture level is used to represent the architecture level to which the microservice component belongs in the service architecture. Based on the component dependency topology information, it is detected whether the microservice components in the component library have abnormal dependencies. Since the component dependency topology information corresponding to the component library is obtained and different types of abnormal dependencies are detected in different ways based on the information contained in the component dependency topology information, the abnormal dependency detection of the microservice components in the component library is achieved quickly by using automated detection.
[0095] In a possible implementation of the present application, the acquisition module 10 is also used to obtain a microservice description file corresponding to each microservice component in the component library, where the microservice description file is generated by scanning the microservices corresponding to each microservice component in the component library; parse the microservice description file to obtain component description information and component dependency relationships corresponding to each microservice component in the component library; construct multiple topological vertices based on the component description information; set corresponding connection relationships for the multiple topological vertices based on the component dependency relationships, and obtain component dependency topology information corresponding to the component library.
[0096] In a possible implementation of the present application, the acquisition module 10 is also used to parse the microservice description file to obtain component description information of each microservice component in the component library and component interaction information between each microservice component, wherein the component interaction information includes exposure and / or dependency relationships between microservices and service interfaces; construct a directed graph based on the component description information and the component interaction information to obtain a component relationship graph, wherein the component relationship graph includes component description information of each microservice component and dependency pointing relationships between the microservices contained in each microservice component and the service interfaces; determine the component description information and component dependency relationships corresponding to each microservice component in the component library based on the component relationship graph.
[0097] In a possible implementation of the present application, the abnormal dependency includes a reverse dependency; the detection module 20 is also used to obtain the component architecture hierarchy corresponding to each microservice component in the component dependency topology information; based on the component dependency relationship recorded in the component dependency topology information and the component architecture hierarchy, it is determined whether a lower-level architecture component depends on an upper-level architecture component; if so, it is determined that the microservice component in the component library has a reverse dependency.
[0098] In a possible implementation of the present application, the abnormal dependency includes a circular dependency; the detection module 20 is further used to extract a component dependency chain from the component dependency topology information; select a node in the component dependency chain as a starting node; traverse the component dependency chain based on the starting node according to the component dependency order in the component dependency chain; when traversing to a node consistent with the starting node, it is determined that there is a circular dependency among the microservice components in the component library.
[0099] In a possible implementation of the present application, the abnormal dependency includes a duplicate dependency; the detection module 20 is also used to select a microservice component as a target component in the component dependency topology information; perform dependency tracing on the target component based on the component dependency relationship recorded in the component dependency topology information, and construct a dependency component set based on the component information obtained by dependency tracing; detect whether there is duplicate component information in the dependency component set; if so, determine that there is duplicate dependency on the microservice component in the component library.
[0100] In a possible implementation of the present application, the detection module 20 is also used to obtain abnormal dependency detection results and obtain the component dependency topology graph corresponding to the component library; mark the dependency topology graph as abnormal based on the abnormal dependency detection results, and display the marked component dependency topology graph.
[0101] In a possible implementation of the present application, the detection module 20 is also used to construct a dependency topology graph based on the component dependency topology information; obtain the component architecture hierarchy corresponding to each microservice component in the component dependency topology information; and layer the topology nodes in the dependency topology graph based on the component architecture hierarchy to obtain a component dependency topology graph.
[0102] It should be understood that the above is only an example and does not constitute any limitation to the technical solution of the present application. In specific applications, technicians in this field can make settings as needed, and the present application does not impose any restrictions on this.
[0103] The workflow described above is merely illustrative and does not limit the scope of protection of this application. In actual applications, technicians in this field can select part or all of it according to actual needs to achieve the purpose of the embodiment scheme, and no limitation is made here.
[0104] In addition, for technical details not fully described in this embodiment, please refer to the abnormal dependency detection method provided in any embodiment of the present application, and will not be repeated here.
[0105] Furthermore, as used herein, the terms "comprises," "comprising," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or system that includes a list of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or system. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not preclude the presence of additional identical elements in the process, method, article, or system that includes the element.
[0106] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0107] Through the description of the above embodiments, those skilled in the art can clearly understand that the above embodiment methods can be implemented by means of software plus the necessary general hardware platform, or of course by hardware, but in many cases the former is a better embodiment. Based on this 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 (ROM) / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling 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.
[0108] The above are merely optional embodiments of the present application and do not 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 method for detecting abnormal dependencies, wherein: The abnormal dependency detection method comprises: Obtain component dependency topology information corresponding to the component library, wherein the component dependency topology information includes component description information, component dependency relationships, and component architecture levels corresponding to each microservice component in the component library, wherein the component dependency relationships are used to indicate other microservice components that the microservice component depends on for operation, and the component architecture level is used to indicate the architecture level to which the microservice component belongs in the service architecture; Based on the component dependency topology information, it is detected whether the microservice components in the component library have abnormal dependencies.
2. The abnormal dependency detection method according to claim 1, wherein: The obtaining of component dependency topology information corresponding to the component library includes: Obtain a microservice description file corresponding to each microservice component in the component library, wherein the microservice description file is generated by scanning the microservices corresponding to each microservice component in the component library; Parse the microservice description file to obtain component description information and component dependency relationships corresponding to each microservice component in the component library; Constructing a plurality of topological vertices according to the component description information; Corresponding connection relationships are set for the multiple topological vertices according to the component dependency relationships, and component dependency topological information corresponding to the component library is obtained.
3. The abnormal dependency detection method according to claim 2, wherein: The parsing of the microservice description file to obtain component description information and component dependency relationships corresponding to the microservice components in the component library includes: Parsing the microservice description file to obtain component description information of each microservice component in the component library and component interaction information between each microservice component, wherein the component interaction information includes exposure and / or dependency between a microservice and a service interface; A directed graph is constructed according to the component description information and the component interaction information to obtain a component relationship graph, wherein the component relationship graph includes component description information of each microservice component and dependency pointing relationships between microservices and service interfaces included in each microservice component; The component description information and component dependency relationships corresponding to each microservice component in the component library are determined according to the component relationship diagram.
4. The abnormal dependency detection method according to claim 1, wherein: The abnormal dependency includes reverse dependency; The detecting whether the microservice components in the component library have abnormal dependencies based on the component dependency topology information includes: Obtain the component architecture level corresponding to each microservice component in the component dependency topology information; Determine whether a lower-layer architecture component depends on an upper-layer architecture component based on the component dependency relationship recorded in the component dependency topology information and the component architecture hierarchy; If so, it is determined that the microservice component in the component library has a reverse dependency.
5. The abnormal dependency detection method according to claim 1, wherein: The abnormal dependency includes a circular dependency; The detecting whether the microservice components in the component library have abnormal dependencies based on the component dependency topology information includes: Extracting a component dependency chain from the component dependency topology information; Selecting a node in the component dependency chain as a starting node; Traversing the component dependency chain based on the starting node according to the component dependency order in the component dependency chain; When traversing to a node consistent with the starting node, it is determined that a circular dependency exists among the microservice components in the component library.
6. The abnormal dependency detection method according to claim 1, wherein: The abnormal dependency includes repeated dependency; The detecting whether the microservice components in the component library have abnormal dependencies based on the component dependency topology information includes: Selecting a microservice component as a target component in the component dependency topology information; Perform dependency tracing on the target component based on the component dependency relationship recorded in the component dependency topology information, and construct a dependent component set according to the component information obtained from the dependency tracing; Detecting whether there is duplicate component information in the dependent component set; If so, it is determined that the microservice components in the component library have duplicate dependencies.
7. The abnormal dependency detection method according to any one of claims 1 to 6, wherein: After detecting whether the microservice components in the component library have abnormal dependencies based on the component dependency topology information, the method further includes: Obtaining abnormal dependency detection results and obtaining a component dependency topology graph corresponding to the component library; The dependency topology graph is abnormally marked according to the abnormal dependency detection result, and the marked component dependency topology graph is displayed.
8. The abnormal dependency detection method according to claim 7, wherein: The abnormal dependency detection method further includes: Constructing a dependency topology graph according to the component dependency topology information; Obtain the component architecture level corresponding to each microservice component in the component dependency topology information; The topological nodes in the dependency topological graph are layered based on the component architecture level to obtain a component dependency topological graph.
9. An abnormal dependency detection device, wherein: The abnormal dependency detection device includes: a processor, a memory, and an abnormal dependency detection program stored in the memory and executable on the processor. When the abnormal dependency detection program is executed by the processor, the steps of the abnormal dependency detection method according to any one of claims 1 to 8 are implemented.
10. A computer-readable storage medium, wherein: The computer-readable storage medium stores an abnormal dependency detection program, which, when executed, implements the steps of the abnormal dependency detection method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Method and device for searching abnormal root cause nodes of micro-service system
CN110888755A
Cyclic dependency detection method and system in micro-service system
CN114416564A
Big data service component deployment method and system, terminal and storage medium
CN114443294A
Circulating dependency detection method and device based on micro-service platform
CN115481040A
Micro-service detection method and device, storage medium and electronic equipment
CN115664998A
Cited By
Webpage security processing method and device based on credential and credential adaptation and medium
CN120956512A
Cross-level traceability monitoring method and system
CN122476009A