Abnormal dependency detection method and device and storage medium

By obtaining component dependency topology information of component library, it automatically detects abnormal dependence of microservice components in component library, solving problems that cannot be quickly detected in the existing technology, improving detection efficiency and reducing costs.

CN119441001APending Publication Date: 2025-02-14ZTE CORP
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202310968914.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-02
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

The existing technology cannot quickly check whether there are abnormal dependencies between various microservice components in the component library, resulting in the overall quality of assembled applications, low efficiency and high cost of manual inspection.

Method used

By obtaining the component dependency topology information corresponding to the component library, including component description information, component dependencies and component architecture levels, we can detect whether there are abnormal dependencies in the microservice components in the component library based on this information.

Benefits of technology

It realizes rapid automated detection of abnormal dependence of microservice components in component library, improves troubleshooting efficiency and reduces costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119441001A_ABST
    Figure CN119441001A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of computer application, and discloses an abnormal dependency detection method and device and a storage medium. According to the method, the component dependency topology information corresponding to the component library is obtained, the component dependency topology information comprises the component description information, the component dependency relationship and the component architecture hierarchy corresponding to each micro-service component in the component library, and the component dependency relationship is used for representing other micro-service components which the micro-service components need to depend on during operation; the component architecture hierarchy is used for representing an architecture hierarchy to which the micro-service component belongs in the service architecture; and detecting whether the micro-service component in the component library has abnormal dependency based on the component dependency topology information. As the component dependency topology information corresponding to the component library can be obtained, and various types of abnormal dependencies are detected by adopting different modes according to the information contained in the component dependency topology information, the abnormal dependency detection of the micro-service component in the component library is quickly realized by utilizing automatic detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer application technology, and in particular to an abnormal dependency detection method, device and storage medium. Background Art

[0002] Faced with the ever-changing business environment and rapidly iterating business needs, "assembled applications" have become an important strategic technology trend with their advantages such as flexibility and reusability. In complex and changing situations, assembled applications can greatly enhance the adaptability and innovation capabilities of enterprises. By introducing the concept of "modularity", assembled applications enable technical and business teams to reuse code more agilely and effectively. Its core is a software-defined minimized business function called "Packaged Business Capability (PBC)".

[0003] At the same time, with the lowering of the threshold of microservice technology and the improvement of cloud computing capabilities, cloud native technology is also developing rapidly. Cloud native technology is oriented to microservice architecture, supports assembly-based delivery, and enables the assembled modules to reach the microservice level. Microservice-level applications, also known as microservice components, are more flexible and reusable when assembled, which can better support enterprises to quickly iterate and achieve high-quality version delivery.

[0004] 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 low. 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 needs to be solved urgently. Summary of the invention

[0005] The main purpose of the present invention is to provide an abnormal dependency detection method, device and storage medium, aiming to solve the technical problem that the prior art cannot quickly check whether there are abnormal dependencies among the microservice components in the component library.

[0006] To achieve the above object, the present invention provides a method for detecting abnormal dependencies, the method comprising the following steps:

[0007] 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;

[0008] Based on the component dependency topology information, it is detected whether the microservice components in the component library have abnormal dependencies.

[0009] In addition, to achieve the above-mentioned purpose, an embodiment of the present application also provides an exception dependency detection device, which includes: a processor, a memory, and an exception dependency detection program stored in the memory and executable on the processor, and when the exception dependency detection program is executed by the processor, the steps of the exception dependency detection method as described above are implemented.

[0010] 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 as described above are implemented.

[0011] The present invention obtains component dependency topology information corresponding to a 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 needs to depend 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, the present invention detects whether there are abnormal dependencies in the microservice components in the component library. Since the component dependency topology information corresponding to the component library is obtained, and various types of abnormal dependencies are detected in different ways according to the information contained in the component dependency topology information, the abnormal dependency detection of the microservice components in the component library is realized quickly by using automated detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] Figure 1 It is a schematic diagram of the structure of an electronic device in a hardware operating environment involved in an embodiment of the present invention;

[0013] Figure 2 It is a flowchart of the first embodiment of the abnormal dependency detection method of the present invention;

[0014] Figure 3 A schematic diagram of reverse dependency according to an embodiment of the present invention;

[0015] Figure 4 A schematic diagram of a circular dependency according to an embodiment of the present invention;

[0016] Figure 5 A schematic diagram of repeated dependencies according to an embodiment of the present invention;

[0017] Figure 6 It is a flowchart of the second embodiment of the abnormal dependency detection method of the present invention;

[0018] Figure 7 A schematic diagram of a component relationship diagram of an embodiment of the present invention;

[0019] Figure 8 A schematic diagram of component dependency relationships in one embodiment of the present invention;

[0020] Fig. 9 It is a flowchart of a third embodiment of the abnormal dependency detection method of the present invention;

[0021] Fig.10 A schematic diagram of a component dependency topology diagram according to an embodiment of the present invention;

[0022] Fig.11 It is a structural block diagram of the first embodiment of the abnormal dependency detection device of the present invention.

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

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

[0025] Reference Figure 1 , Figure 1 The figure 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 invention.

[0026] like Figure 1 As shown, 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. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (Wireless-Fidelity, WI-FI) interface). The memory 1005 may be a high-speed random access memory (Random Access Memory, RAM), or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk storage. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0027] Those skilled in the art will understand that Figure 1The structure shown in the figure does not constitute a limitation on the electronic device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0028] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and an abnormal dependency detection program.

[0029] exist Figure 1 In the electronic device shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the electronic device of the present invention 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 invention.

[0030] The embodiment of the present invention provides a method for detecting abnormal dependency. Figure 2 , Figure 2 The figure is a flow chart of a first embodiment of an abnormal dependency detection method of the present invention.

[0031] In this embodiment, the abnormal dependency detection method includes the following steps:

[0032] Step S10: Obtain component dependency topology information corresponding to the component library.

[0033] It should be noted that the executor 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 or 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 the present invention is explained by taking the abnormal dependency detection device as an example.

[0034] It should be noted that the component dependency topology information may include component description information, component dependency relationships, and component architecture levels corresponding to each microservice component in the component library. The component library may be a database for storing microservice components, and the component library may store microservice components that have been developed and can be put into use.

[0035] Among them, the component description information may include information such as the microservice name (name), microservice version (version), microservice description (description), etc. Of course, according to actual needs, it can also include more information, which is not limited in this embodiment; the component dependency relationship is used to indicate other microservice components that the microservice component needs to depend on for operation, for example: assuming that microservice component A depends on the interface and entity class provided by microservice component B during operation, then the component dependency relationship of microservice component A is "A depends on B"; the component architecture level is used to indicate 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, at this time, microservice component A is applied in the application architecture, then the component architecture level of microservice component A is the application architecture.

[0036] 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.

[0037] In actual use, obtaining component dependency topology information corresponding to a component library may involve scanning microservices corresponding to microservice components in the component library to construct component dependency topology information;

[0038] Of course, it is also possible to scan the microservice components in the component library in advance, 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 to read 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, when the component library is updated (such as adding, modifying, or deleting microservice components in the component library), the component dependency topology information can be rebuilt.

[0039] Step S20: Detect whether there are abnormal dependencies among the microservice components in the component library based on the component dependency topology information.

[0040] It should be noted that the abnormal dependency may include at least one of reverse dependency, circular dependency, and repeated dependency.

[0041] In actual use, detecting whether microservice components in a component library have abnormal dependencies based on component dependency topology information can be to detect whether the component dependency topology information satisfies at least one of the judgment conditions of reverse dependency, circular dependency, and repeated dependency, thereby determining whether microservice components in the component library have abnormal dependencies.

[0042] 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 in this embodiment may include:

[0043] Obtain the component architecture level corresponding to each microservice component in the component dependency topology information;

[0044] 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;

[0045] If so, it is determined that the microservice component in the component library has a reverse dependency.

[0046] It should be noted that 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, and then 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 according to the dependent components and the dependent components recorded in the assembly dependency relationship 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.

[0047] For example: assuming that the component dependency is "A depends on B", the architecture levels include 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 the architecture type of B is higher than that of A (such as the architecture type corresponding to B is upper, and the architecture type corresponding to A is middle or lower, or the architecture type corresponding to B is middle, and the architecture type corresponding to A is lower), it can be determined that there is a lower-level architecture component that depends on the upper-level architecture component, and at this time it can be determined that there is a reverse dependency.

[0048] In a specific implementation, if the abnormal dependency to be detected is a circular dependency, then step S20 in this embodiment may include:

[0049] Extracting a component dependency chain from the component dependency topology information;

[0050] Selecting a node in the component dependency chain as a starting node;

[0051] Traversing the component dependency chain based on the starting node according to the component dependency order in the component dependency chain;

[0052] 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.

[0053] It should be noted that extracting the component dependency chain from the component dependency topology information may be extracting the component description information and the component dependency relationship from the component dependency topology information, taking 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 the component dependency chain. The component dependency order in the Xu Jian dependency chain may be the node connection order in the component dependency chain.

[0054] In actual use, selecting a node in the component dependency chain as the starting node can be to select any node in the component dependency chain as the starting node, and then traverse 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 are selected as starting nodes once.

[0055] It can be understood that a circular dependency means that multiple microservice components depend on each other, forming a dependency loop. If the traversal reaches 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, it is possible to 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 in the microservice components in the component library. For example: For example: Assume that there are three microservice components A, B, and C, among which the component dependency relationship is: "A depends on B, B depends on C, and 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.

[0056] In a specific implementation, if the abnormal dependency to be detected is a repeated dependency, then step S20 in this embodiment may include:

[0057] Selecting a microservice component as a target component from the component dependency topology information;

[0058] 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;

[0059] Detecting whether there is duplicate component information in the dependent component set;

[0060] If so, it is determined that the microservice components in the component library have duplicate dependencies.

[0061] It should be noted that 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 are selected as target components once.

[0062] 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.

[0063] It can be understood that repeated dependency means that a microservice component repeatedly depends on other microservice components. If there is repeated component information in the dependent component set obtained by dependency tracing of the target component, it means that the target component depends on the same component multiple times. Therefore, it can be determined that there is repeated dependency.

[0064] 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 duplicate dependency.

[0065] For ease of understanding, now combined Figure 3 , 4 and 5 are used to illustrate, but not to limit this solution. Figure 3 This is a reverse dependency diagram of this embodiment. Figure 4 This is a schematic diagram of the circular dependency of this embodiment. Figure 5 FIG. 4 is a schematic diagram of repeated dependencies of this embodiment.

[0066] like Figure 3 As shown in the figure, data microservice 2 depends on domain microservice 1, and data microservice 3 depends on domain microservice 2. Both of them have the underlying data architecture dependent on the upper-level domain architecture. The architecture is obviously abnormal, and it can be determined that there is a reverse dependency anomaly; Figure 4 As shown in the figure, data microservices 2 and 3 are interdependent, forming a dependency closed loop, and it can be determined that there is a circular dependency anomaly; Figure 5 As shown, 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. At this time, it can be determined that there is repeated dependency.

[0067] This embodiment obtains the component dependency topology information corresponding to the component library, and the component dependency topology information includes the component description information, component dependency relationship and component architecture level corresponding to each microservice component in the component library. The component dependency relationship is 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 there are abnormal dependencies in the microservice components in the component library. Since the component dependency topology information corresponding to the component library is obtained, and different types of abnormal dependencies are detected in different ways according to the information contained in the component dependency topology information, the abnormal dependency detection of the microservice components in the component library is realized quickly by using automated detection.

[0068] refer to Figure 6 , Figure 6 It is a flowchart of a second embodiment of an abnormal dependency detection method of the present invention.

[0069] Based on the first embodiment, step S10 of the abnormal dependency detection method of this embodiment includes:

[0070] Step S101: Obtain the microservice description file corresponding to each microservice component in the component library.

[0071] It should be noted that the microservice description file can be a file used to describe the characteristics of a microservice (for example, a PBC (packaged-business capabilities) file), and can be generated by scanning the microservices corresponding to each microservice component in the component library through a tool.

[0072] The microservice description file may include: description information of the microservice itself (such as microservice name, microservice version, microservice description, etc.), basic information of the microservice exposure and dependency on the application programming interface (API, also known as the service interface) (such as the API name, version number, Swagger link, etc.), basic information of microservice publishing and subscription events (such as the message topic of the event), and other information.

[0073] 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.

[0074] In actual use, the microservice description file is parsed to obtain the component description information and component dependency relationship corresponding to each microservice component in the component library. The microservice description file can be parsed based on the preset file format, and the description information of the microservice in the microservice description file is extracted to obtain the component description information, and the component dependency relationship is constructed based on the basic information of the microservice exposure and dependency API and the basic information of the microservice publishing and subscription events. Among them, the preset file format can be pre-set by the administrator of the abnormal dependency detection device according to the microservice description file actually used.

[0075] Furthermore, in order to accurately obtain component dependencies, step S102 in this embodiment may include:

[0076] 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;

[0077] Construct a directed graph according to the component description information and the component interaction information to obtain a component relationship graph;

[0078] 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.

[0079] It should be noted that 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 component description information of each microservice component and the dependency pointing relationship between the microservices contained in each microservice component and the service interface.

[0080] In actual use, a directed graph is constructed according to component description information and component interaction information. The component relationship graph can be obtained by constructing multiple directed graph vertices according to the component description information, and then constructing the edges of the directed graph according to 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) API Swagger path (specification), and 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").

[0081] In specific applications, determining the component description information and component dependency relationships corresponding to each microservice component in the component library according to 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.

[0082] It should be noted that the construction of existing dependencies 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 function changes, 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 diagram can be automatically constructed based on the component interaction information, so as to obtain accurate component dependencies without a lot of manual intervention.

[0083] For ease of understanding, now combined Figure 7 and Figure 8 This is for illustration only, but does not limit this solution. The component relationship diagram constructed is as follows Figure 7 As shown in the figure, the included vertices are example-service1, example-service2 and example-service3, the included vertices are api-example1, api-example2, api-example3 and api-example4, and the included vertices are eventNotification1, eventNotification2 and eventNotification3. At this time, each edge in the component relationship graph represents a dependency pointing relationship. According to the different descriptions on the edges, the dependency pointing relationship can be divided into four types: publish, dependent, expose and subscribe.

[0084] In the component relationship diagram, example-service2 exposes api-example3, and example-service1 and example-service3 depend on api-example3, which means 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 microservice example-service1 depends on microservice example-service3. Based on this logic, the component dependency relationship that can be established can be as follows: Figure 8 As shown, example-service1 depends on example-service2 and example-service3, example-service2 depends on example-service1, and example-service3 depends on example-service2.

[0085] Step S103: construct multiple topological vertices according to the component description information.

[0086] 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.

[0087] Step S104: setting corresponding connection relationships for the multiple topological vertices according to the component dependency relationships, and obtaining component dependency topological information corresponding to the component library.

[0088] It should be noted that, according to the component dependency, corresponding connection relationships are set for multiple topological vertices, and the component dependency topological information corresponding to the component library can be obtained by obtaining the association relationship between microservice components and microservice components in the component dependency, and setting the corresponding connection relationship for each topological vertex according to the read relationship, thereby forming the component dependency topological information corresponding to the component library.

[0089] 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 topological vertices according to the component description information; sets corresponding connection relationships for the multiple topological vertices according to the component dependency relationship to obtain the component dependency topological 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 the microservice components can be determined normally without manual intervention, and thereby construct component dependency topological information, providing a basis for abnormal dependency detection.

[0090] refer to Fig. 9 , Fig. 9 It is a flowchart of a third embodiment of an abnormal dependency detection method of the present invention.

[0091] Based on the first embodiment above, after step S20, the abnormal dependency detection method of this embodiment further includes:

[0092] Step S30: Obtain abnormal dependency detection results, and obtain a component dependency topology diagram corresponding to the component library.

[0093] It should be noted that, after obtaining the abnormal dependency detection result, in order to facilitate the user to understand the existence of abnormal dependencies, it can be presented in a graphical manner, so that the component dependency topology map corresponding to the component library can be obtained. Among them, the component dependency topology map can be a topology map constructed according to the component dependency topology information.

[0094] In the specific implementation, in order to ensure that users clearly understand the dependencies between microservice components and the architecture types described by each microservice component, the steps for constructing the component dependency topology diagram may include:

[0095] Constructing a dependency topology graph according to the component dependency topology information;

[0096] Obtain the component architecture level corresponding to each microservice component in the component dependency topology information;

[0097] The topological nodes in the dependency topological graph are layered based on the component architecture level to obtain a component dependency topological graph.

[0098] It should be noted that constructing a dependency topology graph based on component dependency topology information can be to extract component description information and component dependency relationships from the component dependency topology information, construct multiple topology nodes based on the component description information, and set corresponding topological relationships for each topology node based on the component dependency relationships, thereby obtaining a dependency topology graph.

[0099] 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 it 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.

[0100] It is understandable that by displaying each topological node in layers, the user can quickly identify the component description information, component dependency, and architecture level of the microservice component corresponding to each topological node by viewing the component dependency topological diagram.

[0101] In the actual implementation process, the step of constructing the component dependency topology map provided in this embodiment can be set to be executed when the component dependency topology information is obtained, that is, the step of constructing the above-mentioned component dependency topology map can also be included after step S10, or it can be executed after the start of abnormal dependency detection. In this case, before the execution of step S30 described in this embodiment, the step of constructing the above-mentioned component dependency topology map will be executed. Of course, it is also possible to construct the component dependency topology map when the abnormal dependency detection result is obtained. In this case, the step of obtaining the component dependency topology map corresponding to the component library described in this embodiment can include the step of constructing the above-mentioned component dependency topology map.

[0102] Step S40: abnormally marking the dependency topology graph according to the abnormal dependency detection result, and displaying the marked component dependency topology graph.

[0103] It should be noted that marking the dependency topology map with abnormalities based on the abnormal dependency detection results can be to obtain the abnormal microservice components related to the abnormal dependency detection results, and then mark the abnormal dependency detection results near the abnormal microservice components in the dependency topology map, wherein the abnormal dependency detection results can be marked by means of floating windows, prompt boxes, etc.

[0104] For ease of understanding, now combined Fig.10 This is for illustration only, but not for limitation. Fig.10 FIG. 1 is a schematic diagram of the component dependency topology of this embodiment. Fig.10As shown, the topological nodes included in the component dependency topology diagram are topicService1, dbService1, service1, servic2, service3, app1, app2, and app3, among which, 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). 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 diagram.

[0105] When the component dependency topology is presented, the dependency relationship is centered on the currently selected microservice, and the dependency relationship between all microservices associated with it is displayed. At the same time, each microservice on the component dependency topology is presented at the corresponding level in strict accordance with its architecture type attributes. At this time, 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 abnormal detection results. The second is the property panel on the right, which is used to display the basic information of the microservice component. When a node, i.e., a microservice, is selected on the left, the node is highlighted, and the property panel on the right displays its corresponding properties.

[0106] It is understandable that after displaying the component dependency topology diagram with anomaly detection results, based on the marks in the component dependency topology diagram, the architectural anomalies of the microservices in the current component pool can be intuitively discovered, thereby promoting the governance of the microservice architecture. Each microservice provider can perform microservice governance based on the anomaly information and optimize the microservice architecture.

[0107] This embodiment obtains the abnormal dependency detection result and the component dependency topology map corresponding to the component library; marks the dependency topology map as abnormal according to the abnormal dependency detection result, and displays the marked component dependency topology map. Since the component dependency topology map corresponding to the component library is also obtained, the dependency topology map is marked as abnormal according to the abnormal dependency detection result, and the marked component dependency topology map is displayed, the user can quickly determine whether an abnormal dependency exists and the microservice components involved in the existing abnormal dependency according to the marked component dependency topology map, so that the microservice provider can perform microservice governance according to the abnormal information.

[0108] In addition, an embodiment of the present invention further provides 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.

[0109] Reference Fig.11 , Fig.11 It is a structural block diagram of the first embodiment of the abnormal dependency detection device of the present invention.

[0110] like Fig.11 As shown, the abnormal dependency detection device proposed in the embodiment of the present invention includes:

[0111] An acquisition module 10 is used to acquire component dependency topology information corresponding to a 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 a microservice component depends on for operation, and the component architecture level is used to indicate the architecture level to which a microservice component belongs in the service architecture;

[0112] The detection module 20 is used to detect whether there are abnormal dependencies among the microservice components in the component library based on the component dependency topology information.

[0113] This embodiment obtains the component dependency topology information corresponding to the component library, and the component dependency topology information includes the component description information, component dependency relationship and component architecture level corresponding to each microservice component in the component library. The component dependency relationship is 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 there are abnormal dependencies in the microservice components in the component library. Since the component dependency topology information corresponding to the component library is obtained, and different types of abnormal dependencies are detected in different ways according to the information contained in the component dependency topology information, the abnormal dependency detection of the microservice components in the component library is realized quickly by using automated detection.

[0114] 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, wherein the microservice description file is generated by scanning the microservices corresponding to each microservice component in the component library; the microservice description file is parsed to obtain component description information and component dependency relationships corresponding to each microservice component in the component library; multiple topological vertices are constructed 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.

[0115] 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 microservices contained in each microservice component and 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.

[0116] In a possible implementation of the present application, the abnormal dependency includes a reverse dependency;

[0117] The detection module 20 is also used to obtain the component architecture level corresponding to each microservice component in the component dependency topology information; determine whether there is a lower-level architecture component dependent 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, determine that the microservice components in the component library have reverse dependencies.

[0118] In a possible implementation of the present application, the abnormal dependency includes a circular dependency;

[0119] The detection module 20 is also 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, determine whether there is a circular dependency in the microservice components in the component library.

[0120] In a possible implementation of the present application, the abnormal dependency includes a repeated dependency;

[0121] 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 build a dependent component set based on the component information obtained from the dependency tracing; detect whether there is duplicate component information in the dependent component set; if so, determine that there are duplicate dependencies on the microservice components in the component library.

[0122] In a possible implementation of the present application, the detection module 20 is also used to obtain abnormal dependency detection results and obtain a component dependency topology map corresponding to the component library; abnormally mark the dependency topology map according to the abnormal dependency detection results, and display the marked component dependency topology map.

[0123] 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 level corresponding to each microservice component in the component dependency topology information; and stratify the topological nodes in the dependency topology graph based on the component architecture level to obtain a component dependency topology graph.

[0124] It should be understood that the above is only an example and does not constitute any limitation on the technical solution of the present invention. In specific applications, technicians in this field can make settings as needed, and the present invention does not limit this.

[0125] It should be noted that the workflow described above is merely illustrative and does not limit the scope of protection of the present invention. In practical applications, technicians in this field can select part or all of them according to actual needs to achieve the purpose of the present embodiment, and no limitation is made here.

[0126] In addition, for technical details not fully described in this embodiment, reference can be made to the abnormal dependency detection method provided in any embodiment of the present invention, and will not be repeated here.

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

[0128] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0129] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, 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 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 invention.

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

Claims

1. A method for detecting abnormal dependencies, characterized in that: 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, characterized in that: 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, characterized in that: 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, characterized in that: 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, characterized in that: 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, characterized in that: 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, characterized in that: 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, characterized in that: 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, characterized in that: 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, characterized in that: 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

Cited By

  • Visual analysis method for dependency relationship of micro-service architecture

    CN121509255A

  • A micro-service architecture dependency relationship visual analysis method

    CN121509255B