Micro-service-based static code full-link graphical display method

By extracting and processing the Jar package of microservices, using Neo4j database and Cypher queries to establish dependency mapping, and generating a full-link map, it solves the problem of complex and difficult to manage dependencies in the microservice architecture, and realizes clear visualization and optimization of the system.

CN119668747APending Publication Date: 2025-03-21BEIJING BAIJU YIXING TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411725270.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-28
Publication Date
2025-03-21

AI Technical Summary

Technical Problem

In the microservice architecture, the dependencies between services are complex, difficult to understand and manage, and lack of graphical display, resulting in potential problems and hidden dangers not being discovered early.

Method used

By extracting the Jar package of microservices and performing hash verification, the JQAss i Stant tool is configured for rule scanning, and stored in the Neo4j database, the microservice nodes are identified and processed using Cypher query, the dependency mapping is established that conforms to the actual call situation, different types of service, class and method nodes are created, their attributes and relationships are defined, and the full link map is generated, and interactive functions and dynamic display relationships are supported.

Benefits of technology

It realizes clear visualization of the microservice architecture, helps developers understand the dependencies between services, optimize interactions between services, reduce invalid dependencies, and improve the maintainability and scalability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119668747A_ABST
    Figure CN119668747A_ABST
Patent Text Reader

Abstract

The invention discloses a micro-service-based static code full-link graphical display method, and relates to static code analysis, and the method comprises the following steps: 1, extracting a Jar packet of a micro-service, carrying out Hash verification, configuring a JQAssistance tool to carry out rule scanning, and storing to a Neo4j database; according to the method, the micro-services are optimized, the corresponding Jar packages are extracted, the micro-services are effectively managed and deployed, the integrity of the Jar packages is ensured through file hash verification, safety and reliability are improved, a JQAssistance tool is configured for scanning, code quality is improved, later-stage maintenance complexity is reduced, a graph database such as Neo4j is built, the dependency relationship between the micro-services is visually displayed, and the method has the advantages of being high in practicability and the like. Invalid and isolated dependencies can be identified by executing dependency query, calling identifiers are defined, dependency mapping is generated, a visual model displays interfaces and functions of micro-services, correctness of node relationships is verified through Cypher query, an interactive filtering function and dynamic full-link diagram display are provided, and information readability and system flexibility are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of static code analysis, and in particular to a microservice-based full-link graphical display method for static code. Background Art

[0002] With the rapid development of Internet business, microservice architecture has gradually become an important choice for enterprises to achieve business flexibility, scalability and rapid iteration. However, with the surge in the number of services, the complexity within the microservice architecture is also increasing. Each service has a specific function, which makes the entire system more difficult to manage and maintain.

[0003] The growth in the number of microservices brings management challenges. Once the number of services reaches a certain scale, additional resources are required to monitor, maintain, and coordinate these services, which not only increases operation and maintenance costs, but also affects the work efficiency of the team. Since each service is independent, the dependencies between services, the tracking of call chains, and the compatibility issues between service versions will affect the stability and availability of the microservice architecture.

[0004] The existing technology has the following deficiencies: in the microservice architecture, the dependencies between services are complex, which often makes it difficult to understand and manage. There is a lack of graphical display of the dependencies, and the architecture cannot be cleanly visualized. Since the dependencies are not obvious, potential problems and hidden dangers are not discovered early. In the microservice architecture, any change in the code may affect multiple business links, resulting in untimely tracking of the impact of code changes. Due to the lack of awareness of dependent links, local changes can easily lead to global problems. The microservice architecture is flexible and changeable, and it is difficult to find the traffic entrance affected by the change.

[0005] The above information disclosed in this Background section is only for enhancement of understanding of the background of the present disclosure and therefore it may contain information that does not constitute the prior art that is already known to one of ordinary skill in the art. Summary of the invention

[0006] The purpose of the present invention is to provide a microservice-based static code full-link graphical display method to solve the problems in the above-mentioned background technology.

[0007] In order to achieve the above object, the present invention provides the following technical solution: a static code full-link graphical display method based on microservices, comprising the following steps:

[0008] Step 1: Extract the Jar package of the microservice and perform hash verification, configure the JQAssistant tool to scan the rules, and store them in the Neo4j database;

[0009] Step 2: Use Cypher to query microservice nodes, identify and process microservice nodes, re-point to the main node and clean up unreasonable dependencies, complete missing relationships, establish a dependency mapping that conforms to the actual call situation, and verify the rationality of the dependency through node statistics;

[0010] Step 3: Create different types of service, class, and method nodes in Neo4j, define their properties and relationships, establish a complete mapping of the microservice structure, and write documents to record dependencies and interface information;

[0011] Step 4: Define the association relationship between microservice nodes, and create legends for service nodes, class nodes, and method nodes. Distinguish nodes by color and shape, design and generate a full-link diagram that supports interactive functions and dynamic display relationships.

[0012] Preferably, list the microservices and build a server to extract the corresponding Jar packages and store them in the specified directory of the local disk, verify the integrity and consistency of the Jar packages through file hashing, configure the JQAss i stant tool scanning rules and report output format, use the JQAss i stant tool to scan the Jar packages, define the connections between microservice nodes and dependencies and start the Neo4j database, export the results of the scanned Jar packages, convert them into CSV format and store them in the graph database neo4j.

[0013] Preferably, all microservice nodes are queried through the Cypher query language to check whether there are nodes with duplicate names and identifiers. For the identified duplicate nodes, one is selected as the retained main node, the references and relationships of other nodes are redirected to the main node, and the redundant nodes are deleted. A dependency query is performed, and unreasonable and isolated dependencies are listed. The rationality of the dependencies is judged according to business rules, and unreasonable dependencies are deleted. Microservices with missing dependencies are marked, and it is judged whether there are called but no dependencies are formed. Dependencies are completed according to project documents, call identifiers are defined and call information between microservices is extracted, a mapping of building dependencies is generated, all related microservice nodes are cyclically connected through dependencies, the create command is used to ensure that the direction of the dependencies conforms to the actual calling situation, and the rationality of the dependencies is verified through node statistics.

[0014] Preferably, a service node is created to describe the application that provides external capabilities in the microservice structure. According to the microservice application and the various service components it depends on, the properties and relationships of the nodes are defined in the graph database neo4j. A class node is created to describe the Java class contained in the microservice structure and is associated with the application node. A method node is created to describe the service capabilities provided in the microservice structure and is associated with the class node. A relationship between the application and the various service components it depends on is established. A connection is established between the class node and the corresponding method node. Each method node is classified and a node identifier is added. Cypher queries are used to verify whether the nodes and relationships are correctly established. Maintenance documents are written to record the dependencies and service interface information between the nodes.

[0015] Preferably, the association relationship between microservice nodes is defined, the dependency relationship is defined from service node to service node, the inclusion relationship is defined from service node to class node, the declaration relationship is defined from class node to method node, and the call relationship is defined from method node to method node.

[0016] Preferably, create legends for service nodes, class nodes, and method nodes, set different colors and select different shapes to represent them, configure a pop-up window showing detailed information when clicking a node, provide interactive filtering functions, select specific services and methods, and only display related relationship types, support adjusting the graph view through zooming operations, allow selection of the starting service, and automatically depict the complete call chain.

[0017] Preferably, a full-link graph between microservice nodes is designed and generated, a service node is selected as the starting point of the full-link graph and relationship types are tracked. All direct and indirect relationship types of the current service system are automatically loaded and displayed according to the selected starting service node until other services or API interfaces are terminated. Detailed information of all relationship types is dynamically presented, and relationship types are connected by arrows to indicate the direction of the relationship.

[0018] In the above technical solution, the technical effects and advantages provided by the present invention are:

[0019] By optimizing microservices and extracting the corresponding Jar packages, microservices can be managed and deployed more effectively, improving the maintainability and scalability of the system. The integrity and consistency of the Jar packages can be verified by file hashing to ensure that no failures in the microservice architecture will occur due to file damage or tampering during use, thereby improving security and reliability. Configure JQAss Scanning with the istant tool can detect potential problems and security risks in advance, help improve code quality, and reduce the complexity of later maintenance. Define microservice nodes and dependencies, build a graph database, and intuitively display the dependencies between different services, which helps developers understand the micro-service architecture and optimize the interaction and collaboration between services. By using the Neo4j graph database, microservice dependencies can be efficiently stored and queried. By querying and processing duplicate microservice nodes, data redundancy can be effectively reduced to ensure the uniqueness of each microservice in the graph database. When duplicate nodes are identified and their references and relationships are redirected to the primary node, it helps to ensure that all relevant dependencies in the system are retained and simplifies the dependency management of microservices. By performing dependency queries, identifying unreasonable and isolated dependencies, it helps to optimize the interaction between microservices and reduce invalid dependencies, thereby improving the performance and maintainability of the microservice architecture. By identifying missing dependencies and finding calls that have not formed dependencies, the missing parts in the microservice architecture document can be completed to ensure the consistency of the calling relationship between microservices in technology and documentation. Defining call identifiers and extracting call information between microservices helps to fully understand the microservice architecture. Generating a mapping of building dependencies helps to better plan and implement microservices. The service collaboration mechanism ensures smooth calls between services. Service nodes are created and the microservice structure is described, so that the external capabilities of microservices are clear at a glance. By defining the properties and relationships of nodes, the microservices and their dependent component structures can be fully presented. Class nodes and method nodes are created, and a visual model of the code structure can be established in the graph database. The method node describes the service capabilities provided, thereby clarifying the interface and function of the microservice, and establishing the relationship between microservices and dependent components, so that the dependency relationship between services can be visualized, which helps to reduce coupling and improve the flexibility of the microservice architecture. Classifying each method node and adding node identifiers helps to simplify search and modification when organizing complex systems, improve development efficiency, and use Cypher queries to verify the correctness of nodes and relationships, reducing the difficulty of later maintenance and debugging. By clarifying the type of association relationship, the interaction and structure between microservices are systematically described. When configuring a node to pop up a detailed information window when clicking, an interactive filtering function is provided, so that users can have a deeper understanding of each node and its relationship. It supports zooming operations and automatically depicting the call chain by selecting the starting service, which enhances the flexibility of the graph view. The full-link diagram between microservice nodes is designed and generated. Starting from a specific service node, all its direct and indirect relationships can be traced, which is convenient for a comprehensive understanding of the service call path.Dynamically display detailed information of all relationship types and indicate the relationship direction through arrows, which improves the readability and clarity of information. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.

[0021] Figure 1 This is a method flow chart of a microservice-based static code full-link graphical display method of the present invention.

[0022] Figure 2 This is a relationship diagram between service nodes of a microservice-based static code full-link graphical display method of the present invention.

[0023] Figure 3 This is a relationship diagram between service nodes and class nodes of a microservice-based static code full-link graphical display method of the present invention.

[0024] Figure 4 This is a relationship diagram between class nodes and method nodes of a microservice-based static code full-link graphical display method of the present invention.

[0025] Figure 5 This is a relationship diagram between method nodes of a microservice-based static code full-link graphical display method of the present invention.

[0026] Figure 6 A dependency graph of multiple service nodes of a microservice-based static code full-link graphical display method of the present invention.

[0027] Figure 7 This is a call link display diagram between method nodes of a microservice-based static code full-link graphical display method of the present invention. DETAILED DESCRIPTION

[0028] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these example embodiments are provided so that the description of the present disclosure will be more comprehensive and complete, and the concept of the example embodiments will be fully conveyed to those skilled in the art.

[0029] The present invention provides Figure 1 A microservice-based static code full-link graphical display method is shown, comprising the following steps:

[0030] Step 1: Extract the Jar package of the microservice and perform hash verification, configure the JQAssistant tool to scan the rules, and store them in the Neo4j database;

[0031] List the microservices and build the server to extract the corresponding Jar package and store it in the specified directory of the local disk. Verify the integrity and consistency of the Jar package through file hash. Configure the scanning rules and report output format of the JQAss istant tool. Use the JQAss istant tool to scan the Jar package. Define the connection between the microservice nodes and dependencies and start the Neo4j database. Export the results of the scanned Jar package and convert them into CSV format and store them in the graph database neo4j.

[0032] Step 2: Use Cypher to query microservice nodes, identify and process microservice nodes, re-point to the main node and clean up unreasonable dependencies, complete missing relationships, establish a dependency mapping that conforms to the actual call situation, and verify the rationality of the dependency through node statistics;

[0033] Use the Cypher query language to query all microservice nodes to see if there are nodes with duplicate names and identifiers. For the identified duplicate nodes, select one as the retained primary node, redirect the references and relationships of other nodes to the primary node, delete the redundant nodes, perform dependency queries, and list unreasonable and isolated dependencies. Determine the rationality of dependencies based on business rules and delete unreasonable dependencies. Mark microservices with missing dependencies and determine whether there are any microservices that have been called but have not formed dependencies. Complete the dependencies according to the project documentation, define call identifiers and extract call information between microservices, generate a mapping for building dependencies, loop all related microservice nodes through dependencies, use the create command to ensure that the direction of the dependencies is consistent with the actual call situation, and verify the rationality of the dependencies through node statistics.

[0034] Step 3: Create different types of service, class, and method nodes in Neo4j, define their properties and relationships, establish a complete mapping of the microservice structure, and write documents to record dependencies and interface information;

[0035] Create service nodes to describe applications that provide external capabilities in the microservice structure, define node attributes and relationships in the graph database neo4j, create class nodes to describe Java classes contained in the microservice structure, and associate them with application nodes, create method nodes to describe the service capabilities provided in the microservice structure, and associate them with class nodes, establish relationships between applications and the various service components they depend on, establish connections between class nodes and corresponding method nodes, classify each method node and add node identifiers, verify whether nodes and relationships are established correctly through Cypher queries, and write maintenance documents to record dependencies and service interface information between nodes.

[0036] The service nodes are divided into application nodes, cache nodes, message queue nodes, transaction database nodes, column database nodes and registration center nodes, which describe the microservice application and the various service components it depends on. The class nodes are associated with application nodes and method nodes. The method nodes are the execution units used to provide service capabilities in the application. The method nodes can be divided into the types described in the following table according to the business they execute:

[0037]

[0038] Step 4: Define the association relationship between microservice nodes, and create legends for service nodes, class nodes, and method nodes. Differentiate nodes by color and shape, design and generate a full-link diagram, and support interactive functions and dynamic display relationships.

[0039] Define the association relationship between microservice nodes. The dependency relationship is defined as from service node to service node, the inclusion relationship is defined as from service node to class node, the declaration relationship is defined as from class node to method node, and the call relationship is defined as from method node to method node. The specific association relationships are described in the following table:

[0040] Starting Node Termination Node Relationship Type Logo Server Node Server Node Dependencies DEPENDS_ON Server Node Class Node Containment relationship CONTAINS Class Node Method Node Declare relationships DECLARES Method Node Method Node Call relationship INVOKES

[0041] Create legends for service nodes, class nodes, and method nodes, set different colors and select different shapes to represent them, configure a pop-up window showing detailed information when clicking a node, provide interactive filtering functions, select specific services and methods, and only display related relationship types, support adjusting the graph view through zooming operations, allow selection of the starting service and automatically depict the complete call chain, where the relationship between service nodes is as follows: Figure 2 As shown, the relationship between the service node and the class node is as follows Figure 3 As shown, the relationship between the class node and the method node is as follows Figure 4 As shown, the relationship between method nodes is as follows Figure 5 shown.

[0042] Design and generate a full-link graph between microservice nodes, select a service node as the starting point of the full-link graph and start tracing relationship types. Automatically load and display all direct and indirect relationship types of the current service system according to the selected starting service node until other services or API interfaces are terminated. Dynamically present detailed information on all relationship types, connect relationship types with arrows and indicate relationship directions. The dependency relationships of multiple service nodes are as follows: Figure 6 shown.

[0043] For example, in the call link display between method nodes, method A calls method B and method C, where method A is a method node that provides an HTTP interface, method B is a method node that reads a database, and method C is a method node that provides an RPC interface. Figure 7 shown.

[0044] By optimizing microservices and extracting the corresponding Jar packages, microservices can be managed and deployed more effectively, improving the maintainability and scalability of the system. The integrity and consistency of the Jar packages can be verified by file hashing to ensure that no failures in the microservice architecture will occur due to file damage or tampering during use, thereby improving security and reliability. Configure JQAss Scanning with the istant tool can detect potential problems and security risks in advance, help improve code quality, and reduce the complexity of later maintenance. Define microservice nodes and dependencies, build a graph database, and intuitively display the dependencies between different services, which helps developers understand the micro-service architecture and optimize the interaction and collaboration between services. By using the Neo4j graph database, microservice dependencies can be efficiently stored and queried. By querying and processing duplicate microservice nodes, data redundancy can be effectively reduced to ensure the uniqueness of each microservice in the graph database. When duplicate nodes are identified and their references and relationships are redirected to the primary node, it helps to ensure that all relevant dependencies in the system are retained and simplifies the dependency management of microservices. By performing dependency queries, identifying unreasonable and isolated dependencies, it helps to optimize the interaction between microservices and reduce invalid dependencies, thereby improving the performance and maintainability of the microservice architecture. By identifying missing dependencies and finding calls that have not formed dependencies, the missing parts in the microservice architecture document can be completed to ensure the consistency of the calling relationship between microservices in technology and documentation. Defining call identifiers and extracting call information between microservices helps to fully understand the microservice architecture. Generating a mapping of building dependencies helps to better plan and implement microservices. The service collaboration mechanism ensures smooth calls between services. Service nodes are created and the microservice structure is described, so that the external capabilities of microservices are clear at a glance. By defining the properties and relationships of nodes, the microservices and their dependent component structures can be fully presented. Class nodes and method nodes are created, and a visual model of the code structure can be established in the graph database. The method node describes the service capabilities provided, thereby clarifying the interface and function of the microservice, and establishing the relationship between microservices and dependent components, so that the dependency relationship between services can be visualized, which helps to reduce coupling and improve the flexibility of the microservice architecture. Classifying each method node and adding node identifiers helps to simplify search and modification when organizing complex systems, improve development efficiency, and use Cypher queries to verify the correctness of nodes and relationships, reducing the difficulty of later maintenance and debugging. By clarifying the type of association relationship, the interaction and structure between microservices are systematically described. When configuring a node to pop up a detailed information window when clicking, an interactive filtering function is provided, so that users can have a deeper understanding of each node and its relationship. It supports zooming operations and automatically depicting the call chain by selecting the starting service, which enhances the flexibility of the graph view. The full-link diagram between microservice nodes is designed and generated. Starting from a specific service node, all its direct and indirect relationships can be traced, which is convenient for a comprehensive understanding of the service call path.Dynamically display detailed information of all relationship types and indicate the relationship direction through arrows, which improves the readability and clarity of information.

[0045] The above description is only by way of illustration of certain exemplary embodiments of the present invention. It is undoubted that those skilled in the art can modify the described embodiments in various ways without departing from the spirit and scope of the present invention. Therefore, the above drawings and descriptions are illustrative in nature and should not be construed as limiting the scope of protection of the claims of the present invention.

Claims

1. A static code full-link graphical display method based on microservices, characterized in that: The following steps are involved: Step 1: Extract the Jar package of the microservice and perform hash verification, configure the JQAssistant tool to scan the rules, and store them in the Neo4j database; Step 2: Use Cypher to query microservice nodes, identify and process microservice nodes, re-point to the main node and clean up unreasonable dependencies, complete missing relationships, establish a dependency mapping that conforms to the actual call situation, and verify the rationality of the dependency through node statistics; Step 3: Create different types of service, class, and method nodes in Neo4j, define their properties and relationships, establish a complete mapping of the microservice structure, and write documents to record dependencies and interface information; Step 4: Define the association relationship between microservice nodes, and create legends for service nodes, class nodes, and method nodes. Distinguish nodes by color and shape, design and generate a full-link diagram that supports interactive functions and dynamic display relationships.

2. According to a microservice-based static code full-link graphical display method according to claim 1, it is characterized by: In the step 1, the microservices are listed and the server is built to extract the corresponding Jar packages and store them in the specified directory of the local disk. The integrity and consistency of the Jar packages are verified by file hashing, the scanning rules and report output format of the JQAssistant tool are configured, the Jar packages are scanned by the JQAssistant tool, the connections between the microservice nodes and dependencies are defined and the Neo4j database is started, and the results of the Jar package scanning are exported and converted into CSV format and stored in the graph database neo4j.

3. According to a microservice-based static code full-link graphical display method according to claim 1, it is characterized by: In the step 2, all microservice nodes are queried through the Cypher query language to check whether there are nodes with duplicate names and identifiers. For the identified duplicate nodes, one is selected as the retained main node, the references and relationships of other nodes are redirected to the main node, and the redundant nodes are deleted. The dependency query is performed, and the unreasonable and isolated dependencies are listed. The rationality of the dependencies is judged according to the business rules, and the unreasonable dependencies are deleted. The microservices with missing dependencies are marked, and it is judged whether there are called but no dependencies are formed. The dependencies are completed according to the project documents, the call identifiers are defined and the call information between the microservices is extracted, and a mapping for building dependencies is generated. All related microservice nodes are cyclically connected through dependencies, and the create command is used to ensure that the direction of the dependencies is consistent with the actual calling situation, and the rationality of the dependencies is verified through node statistics.

4. According to a microservice-based static code full-link graphical display method according to claim 1, it is characterized by: In the step three, a service node is created to describe the application that provides external capabilities in the microservice structure. According to the microservice application and the various service components it depends on, the properties and relationships of the nodes are defined in the graph database neo4j. A class node is created to describe the Java class contained in the microservice structure and is associated with the application node. A method node is created to describe the service capabilities provided in the microservice structure and is associated with the class node. A relationship between the application and the various service components it depends on is established. A connection is established between the class node and the corresponding method node. Each method node is classified and a node identifier is added. Cypher queries are used to verify whether the nodes and relationships are correctly established. Maintenance documents are written to record the dependencies and service interface information between the nodes.

5. According to a microservice-based static code full-link graphical display method according to claim 1, it is characterized by: In the step 4, defining the association relationship between microservice nodes includes: the dependency relationship is defined from service node to service node, the inclusion relationship is defined from service node to class node, the declaration relationship is defined from class node to method node, and the call relationship is defined from method node to method node.

6. According to a microservice-based static code full-link graphical display method according to claim 1, it is characterized by: In the step 4, create legends for service nodes, class nodes, and method nodes, and distinguish nodes by color and shape. The specific steps are: create legends for service nodes, class nodes, and method nodes, set different colors and select different shapes to represent them, configure a pop-up window showing detailed information when clicking a node, provide interactive filtering functions, select specific services and methods, and only display related relationship types, support adjusting the graph view by zooming in and out, allow selection of the starting service, and automatically depict the complete call chain.

7. According to a microservice-based static code full-link graphical display method according to claim 1, it is characterized by: In the step 4, the specific steps of designing and generating the full-link graph are: designing and generating the full-link graph between microservice nodes, selecting the service node as the starting point of the full-link graph and starting to track the relationship type, automatically loading and displaying all direct and indirect relationship types of the current service system according to the selected starting service node, until terminating other services or API interfaces, dynamically presenting detailed information of all relationship types, connecting the relationship types with arrows and indicating the relationship direction.