CN117112051A - Component topology map generation method and device, computer equipment and storage medium - Google Patents

Component topology map generation method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN117112051A
CN117112051A CN202310952276.9A CN202310952276A CN117112051A CN 117112051 A CN117112051 A CN 117112051A CN 202310952276 A CN202310952276 A CN 202310952276A CN 117112051 A CN117112051 A CN 117112051A
Authority
CN
China
Prior art keywords
component
components
topological graph
information
task
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310952276.9A
Other languages
Chinese (zh)
Inventor
师兰英
李嫚
乔宏明
杨程伟
蒋艺荃
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Telecom Technology Innovation Center
China Telecom Corp Ltd
Original Assignee
China Telecom Technology Innovation Center
China Telecom Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Telecom Technology Innovation Center, China Telecom Corp Ltd filed Critical China Telecom Technology Innovation Center
Priority to CN202310952276.9A priority Critical patent/CN117112051A/en
Publication of CN117112051A publication Critical patent/CN117112051A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • G06F9/44526Plug-ins; Add-ons
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4488Object-oriented
    • G06F9/449Object-oriented method invocation or resolution
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application relates to a component topological graph generation method, a device, computer equipment and a storage medium. The method comprises the following steps: analyzing the code to be analyzed to obtain each component and executable task contained in the code to be analyzed; for any executable task, generating simulation data for the executable task, and inputting the simulation data into the executable task to obtain calling information among all components in the executable task; acquiring network addresses of all components; and generating a component topological graph based on the network address of each component and the call information among the components. By adopting the method, the generation efficiency of the component topological graph can be improved.

Description

Component topology map generation method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and apparatus for generating a component topology map, a computer device, and a storage medium.
Background
With the advancement of cloud and digital transformation, more and more enterprises perform distributed cloud deployment on large-scale business systems and information systems, which brings pressure to operation monitoring of a system/platform, so that it becomes more and more necessary to draw system component network topology to judge and locate faults.
Currently, system component network topology relies mainly on manual drawing, which results in longer time required for drawing network topology and lower drawing efficiency.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a component topology map generation method, apparatus, computer device, and storage medium.
In a first aspect, the present application provides a component topology map generation method. The method comprises the following steps:
analyzing the code to be analyzed to obtain each component and executable task contained in the code to be analyzed, wherein the executable task comprises at least one component;
generating simulation data for any executable task, and inputting the simulation data into the executable task to obtain calling information among all components in the executable task;
acquiring the network address of each component;
and generating a component topological graph based on the network address of each component and the call information among the components.
In one embodiment, the inputting the simulation data into the executable task and obtaining call information between the components in the executable task includes:
Inputting the simulation data into the executable task, and obtaining output data of each component when the executable task processes the simulation data;
inputting first output data corresponding to a first component into each second component, and obtaining second output data of each second component after each second component processes the first output data, wherein the first component is any component, and the second components are components except the first component;
for any second output data, determining that a calling relationship exists between the first component and the second component when the second output data is matched with the output data corresponding to the second component;
and generating calling information among the components according to the calling relation among the components.
In one embodiment, the generating call information between the components according to the call relation between the components includes:
generating call context information of the executable task according to the call relation among the components;
and taking the calling relation among the components and the calling context information as calling information among the components.
In one embodiment, the method further comprises:
respectively sending an interaction request to the network address of each component;
and aiming at any component, taking the network address corresponding to the component as an invalid address under the condition that response information corresponding to the interaction request is not received or the response information does not meet the preset requirement.
In one embodiment, the generating a component topology map based on the network address of each component and the call information between the components includes:
classifying each component according to the network address of each component to obtain a plurality of component categories;
for any component category, storing the network address and the call information of each component in the component category into a data table corresponding to the component category;
and calling the data table corresponding to each component category to generate a component topological graph.
In one embodiment, the method further comprises:
checking the component topological graph to obtain a checking result;
and regenerating the component topological graph in the condition that the verification result represents that the drawing of the component topological graph is incorrect.
In one embodiment, the verifying the component topology map to obtain a verification result includes:
performing address verification on each component according to the network address of each component in the component topological graph to obtain an address verification result;
generating a verification task according to the calling relation between the components in the component topological graph, and performing task execution verification on the component topological graph based on the verification task to obtain a task execution verification result;
generating verification data according to call context information corresponding to each component in the component topological graph, and carrying out call relation verification on the component topological graph based on the verification data to obtain a call relation verification result;
and determining a verification result based on the address verification result, the task execution verification result and the call relation verification result.
In a second aspect, the application further provides a device for generating the component topological graph. The device comprises:
the analysis module is used for analyzing the code to be analyzed to obtain each component and executable task contained in the code to be analyzed, wherein the executable task comprises at least one component;
The first generation module is used for generating simulation data for any executable task, inputting the simulation data into the executable task and obtaining calling information among all the components in the executable task;
the first acquisition module is used for acquiring the network address of each component;
and the second generation module is used for generating a component topological graph based on the network address of each component and the call information among the components.
In one embodiment, the first generating module is further configured to:
inputting the simulation data into the executable task, and obtaining output data of each component when the executable task processes the simulation data;
inputting first output data corresponding to a first component into each second component, and obtaining second output data of each second component after each second component processes the first output data, wherein the first component is any component, and the second components are components except the first component;
for any second output data, determining that a calling relationship exists between the first component and the second component when the second output data is matched with the output data corresponding to the second component;
And generating calling information among the components according to the calling relation among the components.
In one embodiment, the first generating module is further configured to:
generating call context information of the executable task according to the call relation among the components;
and taking the calling relation among the components and the calling context information as calling information among the components.
In one embodiment, the apparatus further comprises:
the sending module is used for respectively sending interaction requests to the network addresses of the components;
the processing module is used for regarding any component, and taking the network address corresponding to the component as an invalid address when response information corresponding to the interaction request is not received or the response information does not meet a preset requirement.
In one embodiment, the second generating module is further configured to:
classifying each component according to the network address of each component to obtain a plurality of component categories;
for any component category, storing the network address and the call information of each component in the component category into a data table corresponding to the component category;
And calling the data table corresponding to each component category to generate a component topological graph.
In one embodiment, the apparatus further comprises:
the second acquisition module is used for checking the component topological graph and acquiring a checking result;
and the fourth generation module is used for regenerating the component topological graph under the condition that the verification result characterizes that the component topological graph is incorrectly drawn.
In one embodiment, the second obtaining module is further configured to:
performing address verification on each component according to the network address of each component in the component topological graph to obtain an address verification result;
generating a verification task according to the calling relation between the components in the component topological graph, and performing task execution verification on the component topological graph based on the verification task to obtain a task execution verification result;
generating verification data according to call context information corresponding to each component in the component topological graph, and carrying out call relation verification on the component topological graph based on the verification data to obtain a call relation verification result;
and determining a verification result based on the address verification result, the task execution verification result and the call relation verification result.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor implementing any of the methods above when executing the computer program.
In a fourth aspect, the present application also provides a computer-readable storage medium. The computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements any of the methods above.
In a fifth aspect, the present application also provides a computer program product. The computer program product comprising a computer program which, when executed by a processor, implements any of the methods above.
The method, the device, the computer equipment and the storage medium for generating the component topological graph automatically analyze the code to be analyzed of the distributed system, acquire each component and executable task contained in the code to be analyzed, acquire call information among the components based on the executable task, and further generate the component topological graph according to the call information among the components and the network address of the components. The embodiment of the application can automatically generate the latest topological graph after the distributed system is deployed, and can improve the drawing efficiency of the topological graph.
Drawings
FIG. 1 is a flow diagram of a component topology map generation method in one embodiment;
FIG. 2 is a schematic diagram of a component topology in one embodiment;
FIG. 3 is a flow chart of step 104 in one embodiment;
FIG. 4 is a flow chart of step 308 in one embodiment;
FIG. 5 is a flow diagram of a component topology map generation method in one embodiment;
FIG. 6 is a flow chart of step 108 in one embodiment;
FIG. 7 is a flow diagram of a component topology map generation method in one embodiment;
FIG. 8 is a flow chart of step 702 in one embodiment;
FIG. 9 is a schematic diagram of the modules in a server in one embodiment;
FIG. 10 is a schematic diagram of a component topology map generation method in one embodiment;
FIG. 11 is a schematic diagram of verifying a component topology in one embodiment;
FIG. 12 is a block diagram of a component topology apparatus in one embodiment;
fig. 13 is an internal structural view of a computer device in one embodiment.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
In one embodiment, as shown in fig. 1, a component topology map generating method is provided, where the method is applied to a server for illustration, it is understood that the method may also be applied to a terminal, and may also be applied to a system including the terminal and the server, and implemented through interaction between the terminal and the server. In this embodiment, the method includes the steps of:
step 102, resolving the code to be resolved to obtain each component and executable task contained in the code to be resolved, wherein the executable task comprises at least one component.
In the embodiment of the application, after cloud deployment is performed on the distributed system each time, the server can redraw the topological graph of each component in the distributed system. The code to be resolved refers to source code of the distributed system, the component refers to a section of code which can realize specific functions and can be reused in the code to be resolved, and the component can be stored on different servers in the distributed system. Through the code to be resolved, the server can resolve each component in the code to be resolved, for example, the server can obtain each component introduced by the code to be resolved by checking the import statement of the code to be resolved.
The server can also obtain executable tasks in the code to be resolved by resolving the code to be resolved. An executable task refers to a piece of executable complete code logic that is comprised of at least one component. Illustratively, the server may obtain executable tasks in the main flow through a main entry function in the code to be parsed, obtain timed tasks by checking if timed task annotations exist, obtain tasks triggered across processes by analyzing process communication mechanisms, and the like. After the executable task is obtained, information such as the reference relation and the execution sequence of each component can be obtained through the executable task.
Step 104, for any executable task, generating simulation data for the executable task, and inputting the simulation data into the executable task to obtain call information among components in the executable task.
In the embodiment of the application, after the executable task is obtained through analysis, simulation data can be generated for the executable task according to the input data required by the executable task. The server can configure parameters required by execution for each executable task, simulate the executable task and further acquire calling information of each component in the executable task. The call information is used for representing the execution sequence of each component, the flow direction of data among the components and the like. For example, when the component a calls the component B, the component a must execute before the component B, so by monitoring the time when each component is called, the execution sequence of each component can be obtained, and then the relation between the call and the called component is obtained preliminarily. By further detecting whether the output of the first executed component can be correctly processed by the later executed component, accurate calling and called relations among the components can be obtained.
Step 106, obtaining the network address of each component.
In the embodiment of the application, the network address of the component refers to the IP (Internet Protocol ) address of the host where the component is located on the network. The network address of the component may be determined by a person skilled in the art according to a deployment address used when deploying the component to the cloud, or may query a network address of a service where the component is located (may be determined by an existing service network address query method such as a service discovery tool), and since the service is typically deployed on the same host, the network address of the service may be used as the network address of the component.
Step 108, generating a component topological graph based on the network address of each component and the call information among the components.
In the embodiment of the application, the component topological graph can be drawn according to the network address of each component and the call information of each component. For example, all hosts in the distributed system can be drawn in the component topology diagram, and components deployed on the same host are drawn inside the host according to the network address of each component; and the components can be connected through a connection line with or without an arrow according to the calling information of the components so as to embody that calling relations exist among the components.
Referring to FIG. 2, an example of a component topology is shown. In the figure, elements, namely components, in the PAAS layer (Platform as aService, platform, namely service) are connected through connecting wires. Hosts present in the distributed system may be mapped in the IAAS layer (Infrastructure as a Service ), and depending on the network address of each component, each component may be connected to the host to which each component belongs to indicate that the component is deployed on a particular host.
Applications of component composition may also be included in the topology map. The elements in the SAAS layer (Software as aService ) in the figure are applications, which can be made up of multiple components. The application to which the component belongs can be determined by the name of the component. Each component may be connected to the application to which the component belongs to indicate that the component belongs to a particular application.
According to the component topological graph generation method provided by the embodiment of the application, the code to be analyzed of the distributed system is automatically analyzed, each component and executable task contained in the code to be analyzed are obtained, call information among the components is obtained based on the executable task, and further, the component topological graph is generated according to the call information among the components and the network address of the components. The embodiment of the application can automatically generate the latest topological graph after the distributed system is deployed, and can improve the drawing efficiency of the topological graph.
In one embodiment, as shown in fig. 3, in step 104, inputting simulation data into an executable task, and obtaining call information between each of the components in the executable task includes:
step 302, inputting the analog data into the executable task, and obtaining output data of each component when the executable task processes the analog data.
Step 304, inputting the first output data corresponding to the first component into each second component, and obtaining the second output data of each second component after each second component processes the first output data, where the first component is any component, and the second component is a component other than the first component.
Step 306, determining that a call relationship exists between the first component and the second component for any second output data when the second output data matches the output data corresponding to the second component.
Step 308, according to the calling relation among the components, calling information among the components is generated.
In the embodiment of the application, when the executable task is executed, the output data of each component when the analog data is processed can be obtained so as to determine the accurate calling relation among the components. Assuming that a component A and a component B exist in a task to be executed, under the condition that the component A calls the component B, the output obtained by directly executing the task to be executed should be consistent with the output obtained by inputting analog data into the component A and then inputting the output of the component A into the component B, so that whether the two components have a calling relationship can be judged by inputting the output of one component into the other component and checking whether the output is consistent with the output of the other component when the executable task is normally executed.
The above steps may be performed by randomly selecting two components from among the components, or, in the case where the approximate calling and called relationships between the components have been determined in advance from the time at which the components are called, the second component may be determined from only the components that are likely to be called by the first component, that is, the components whose time of being called is located after the time at which the first component is called, after randomly determining the first component, and the above verification may be performed for the first component and the second component.
It should be noted that, one component may be called multiple times in one executable task, for example, in the case where the component is a message middleware Kafka, there may be multiple components simultaneously in one executable task as a producer pushing data to Kafka and multiple components simultaneously as a consumer consuming data from Kafka. In this case, it is possible to determine the component with which the calling relationship exists at each time of the component being called, and display the component with which the calling relationship exists at each time of the component in the topology map, respectively. For example, different components with which the component has a calling relationship each time it is called can be distinguished in the topology by different colors, different formats, or different numbered wires.
The calling relation among the components can be directly used as calling information, or more complex calling information can be further generated and displayed in the topological graph according to the calling relation among the components.
According to the component topological graph generation method provided by the embodiment of the application, the output data of each component is input into the other component, whether the output data of each component is still the same as the output data of each component when the executable task is executed is verified, the accurate calling relation among the components can be determined, the calling information is further generated according to the calling relation among the components, the component topological graph is generated according to the calling information, the calling relation among the components and the called relation among the components can be automatically obtained, and the drawing efficiency of the component topological graph is improved.
In one embodiment, as shown in fig. 4, in step 308, call information between components is generated according to call relationships between components, including:
step 402, generating call context information of executable tasks according to call relations among all components;
and step 404, taking the calling relation and calling context information among the components as calling information among the components.
In the embodiment of the application, the calling relations among the components can be combined to form the flow direction information of the data in the executable task, namely the calling context information of the executable task. By way of example, paths of all components through which the simulation data passes after entering the executable task can be generated according to the moment when each component is called and the accurate calling relation among the components, and the paths are used as calling context information of the executable task.
For example, if the executable task includes the component a, the component B and the component C, and it can be determined that the calling relationship is that the component a calls the component B first, and then the component a calls the component C again, it can be determined that the components passed through after the simulation data enter the executable task are the component a, the component B, the component a and the component C, respectively, and call context information is generated according to the above information. The server can further display call context information and call relations of all the components in the network topology graph as call information, so that a user can see the call relations among the components and know which components the data respectively pass through in the process of executing an executable task.
It should be noted that a component may belong to multiple executable tasks at the same time, that is, multiple call context information may be generated for the component at the same time. Different call context information may be distinguished in the component topology by using different colors, different formats, or different numbered wiring.
According to the component topological graph generation method provided by the embodiment of the application, the call context information is generated through the call relation among the components, and the component topological graph is generated according to the call relation and the call context information of the components, so that the component topological graph can show the flow direction of data in the components, and the information in the component topological graph is enriched.
In one embodiment, as shown in fig. 5, the method further includes:
step 502, sending an interaction request to the network address of each component.
In step 504, for any component, if no response information corresponding to the interaction request is received or the response information does not meet the preset requirement, the network address corresponding to the component is used as an invalid address.
In the embodiment of the application, whether the network address of each component is correct or not can be verified. For example, an interactive request may be sent to a service where the component is located according to the network address of the component (the network address of the service is the same as the network address of the component) to determine whether the service where the component is located can be connected according to the network address of the component; if the response information of the service of the component is received, the service of the component can be connected, and the network address of the component is correct; or if the response information of the service of the component is not received, indicating that the network address of the component is an invalid address. The component may be marked at this point to indicate that the network address of the component is incorrect, and the exact network address of the component may be determined by a technician in other ways and the component topology map updated based on the exact network address of the component.
In the case of receiving the response information, whether the network address of the component is accurate can also be determined according to whether the response information meets the preset requirement. For example, the preset requirement may be that the reply information must be returned within a preset time, or that the status code to which the reply information corresponds must be a specific status code. For example, when the Service to which the component belongs is a Web Service (Web Service), the server may send an HTTP (Hypertext Transfer Protocol ) request to the Web Service to determine whether the Web Service exists at the network address to which the component corresponds. The HTTP request may be generated based on the name of the component, and may be a request to find a binding port or an access path of the component in the web service, so that whether the component exists in the web service may be determined according to response information of the web service. When receiving response information of the web service responding to the HTTP request, the server can acquire a status code in the response information; if the status code is a status code representing error information, it can be determined that the component is not actually present in the web service, and the network address of the component is invalid. For other types of services, whether the network address of the component is valid may also be determined through a similar procedure, and embodiments of the present application are not described herein.
The method for generating the component topological graph provided by the embodiment of the application checks the network address of each component to determine whether the network address of the component is effective, so that the actual invalid network address in the component topological graph can be avoided, and the accuracy of the component topological graph is improved.
In one embodiment, as shown in fig. 6, in step 108, generating a component topology map based on network addresses of components and call information between components includes:
step 602, classifying each component according to the network address of each component to obtain a plurality of component classes.
Step 604, for any component category, storing the network address and call information of each component in the component category in a data table corresponding to the component category.
Step 606, call the data table corresponding to each component category to generate the component topological graph.
In the embodiment of the application, after the network address of the component, the calling information of the component and other information required by generating the topological graph are acquired, the information can be classified and stored in different data tables so as to carry out structural management on the information. For example, the above information may be classified by network addresses of components so that information belonging to the same network address, i.e., components disposed on the same host, may be classified into the same component class. At least one data table may be constructed for each component class such that the information recorded on the same data table is of components deployed on the same host. The information of the components can be further classified in the component category, for example, the information recorded in different formats is split, and the information in different formats can be respectively inserted into different data tables, so that the information is further classified and arranged.
The server can store the information once after obtaining the network address of the component each time or obtaining the calling information of the component each time, and call all the stored data tables to generate the component topological graph after obtaining the network addresses and the calling information of all the components. The server can apply auxiliary algorithms (such as principal component analysis algorithm, linear discriminant analysis algorithm and the like which can reduce dimension and classify the data) to preprocess the data in the data table, and then draw the component topological graph by adopting an existing arbitrary drawing tool (such as TopoBuilder (a topological graph drawing software)).
The method for generating the component topological graph provided by the embodiment of the application can be used for classifying and storing the acquired various data, classifying and sorting the data, and is convenient for subsequent structural management and application.
In one embodiment, as shown in fig. 7, the method further includes:
step 702, checking the component topological graph to obtain a checking result.
Step 704, regenerating the component topology map in the case that the verification result represents that the component topology map is incorrectly drawn.
In the embodiment of the application, after the component topological graph is drawn, the correctness of the component topological graph can be checked in various modes. For example, whether the network address of each component is correct can be determined by sending a request to the network address of each component recorded in the component topology map; or determining whether each component can correctly execute the task when the components are combined according to the call information through the call information of each component in the component topological graph, and the embodiment of the application is not limited in detail.
In the case that the verification result characterizes the component topological graph and the drawing is correct, the current component topological graph can be used as the final component topological graph. Or under the condition that the verification result represents that the drawing of the component topological graph is incorrect, the steps in the embodiment can be carried out again to regenerate the component topological graph; or may regenerate the component topology map in other manners, for example, determining the network address of the component in other manners, or acquiring call information of the component by adopting other methods for monitoring the data flow, etc., which are not limited in particular by the embodiment of the present application.
According to the component topological graph generation method provided by the embodiment of the application, after the drawing of the component topological graph is completed, the component topological graph is checked, whether the component topological graph is drawn correctly can be determined, and the accuracy of the component topological graph is improved.
In one embodiment, as shown in fig. 8, in step 702, verifying a component topology map, obtaining a verification result includes:
step 802, address verification is performed on each component according to the network address of each component in the component topological graph, and an address verification result is obtained.
Step 804, generating verification tasks according to the calling relations among the components in the component topological graph, and performing task execution verification on the component topological graph based on the verification tasks to obtain task execution verification results.
And step 806, generating verification data according to call context information corresponding to each component in the component topological graph, and carrying out call relation verification on the component topological graph based on the verification data to obtain a call relation verification result.
Step 808, determining a verification result based on the address verification result, the task execution verification result, and the call relationship verification result.
In the embodiment of the application, the verification of the component topological graph can be divided into address verification, task execution verification and call relation verification. The address verification is used to verify whether the network address of the component is accurate, for example, the network address of the component may be verified in a manner of sending an interaction request to the network address of each component and determining whether the network address is valid according to the response information in the foregoing embodiments, which are not described herein.
The task execution check is used for checking whether the calling relation is accurate. The server can acquire the calling relation among the components and executable tasks corresponding to the calling relation according to the component topological graph. The server can directly take the executable task generating the calling relation among the components as a verification task, re-execute the verification task once, and monitor the calling and called relation among the components when executing the verification task: for example, the calling and called relationships between the components may be determined by the manner in the foregoing embodiments, which are not particularly limited in the embodiments of the present application. Or when only verifying the calling relation among part of the key components, extracting codes related to the calling among the key components from a plurality of executable tasks for generating the calling relation among the key components, and recombining the codes to form a new verification task so that the calling relation among the key components can be verified by executing the verification task once.
The call relation check is used for checking whether call context information is accurate or not. The server can acquire call context information according to the component topological graph, verify the key components which realize key function points of the distributed system according to the specific requirements, generate verification data related to the call context information of the key components, and detect the call context information based on the verification data. For example, the server may generate verification data based on the executable task when the call context information is obtained according to one call context information that covers the most critical components, input the verification data into the executable task, and determine whether the call context information is accurate by monitoring the execution sequence and the call relationship of each component when the executable task is executed.
Based on the address verification result, the task execution verification result, and the call relationship verification result, a final verification result may be determined. The final verification result can be determined to pass under the condition that the address verification result, the task execution verification result and the calling relation verification result pass, namely, the network address obtained by the verification, the calling information among the components and the calling context information are consistent with the information recorded in the component topological graph. If any one of the check results is not passed, the final check result can be determined to be not passed.
According to the component topological graph generation method provided by the embodiment of the application, after the component topological graph is drawn, the component topological graph is checked based on the network address, the calling relation and the calling context information recorded in the component topological graph, so that whether the component topological graph is drawn correctly can be determined, and the accuracy of the component topological graph is improved.
In order that those skilled in the art may better understand the embodiments of the present application, the embodiments of the present application will be described below by way of specific examples.
Referring to fig. 9, a schematic diagram of each module in the server is shown. The server may be an original system operation monitoring module or cloud monitoring module in the distributed system, where the server may include a data warehouse, an instruction warehouse (the two warehouses may be constructed by using an original memory in the system operation monitoring module or the cloud monitoring module), a code analyzer, a task simulator, a computing module, and a drawing module. The data repository is used for storing data such as network addresses and call information of the components, and the instruction repository is used for storing instructions for interacting with the components, such as instructions for locating service IP addresses of the components (network addressing instructions), instructions for interacting with services of the components (network interaction instructions), instructions for analyzing response information returned by the services, and the like (network checking instructions). The code parser is used for parsing the code to be parsed. The task simulator is used for constructing simulation data, verification tasks, verification data and the like. The calculation module is used for calculating the calling relation among the components according to the executable tasks. The drawing module is used for generating a component topological graph.
Referring to fig. 10, a process of drawing a component topology for each module is called for the server. After the cloud deployment of the distributed system is finished, an operation management module in the distributed system sends information to a server so that the server starts to generate a component topological graph. The server can extract the source code of the distributed system cached by the operation management module, and the application code analyzer performs analysis of the source code to obtain information such as applications, components, SDKs (Software Development Kit, software development kits), executable tasks and the like in the distributed system. The code analyzer can also obtain the deployment task of the component according to the name of the component, and preliminarily determine the network address of the component according to the deployment task.
The drawing module calls an instruction warehouse, applies a network addressing instruction, a network interaction instruction and a network checking instruction, checks the network address information of each component, determines whether the network address is effective, stores the obtained result in the data warehouse, and further sends a calculation task to the calculation module.
The calculation module generates simulation data based on the executable task, and records calling relation, data flow and calling context information of each component when the executable task executes the simulation data. The computing module then splits all recorded information and stores the split information into a data table appointed by the data warehouse.
The drawing module calls the data of all data tables in the data warehouse, and performs component topological graph drawing by applying a digital twin algorithm (a principal component analysis algorithm, a linear discriminant analysis algorithm and the like) and a drawing tool (TopoBuilder and the like). The generated component topology map may be sent to an operation management module for storage.
Referring to fig. 11, a process of verifying a component topology for a server. The drawing module acquires the information of the component topological graph, each component, the executable task and the application and generates a planning task for indicating which verification projects need to be carried out. The drawing module further calls an instruction warehouse, applies a network interaction instruction and a network checking instruction, performs checking according to each component network address in the component topological graph, returns to 1 if the network address connection is normal, and continues to perform checking; if the network address connection abnormality returns 0, alarming and terminating the verification.
The drawing module sends a task execution verification request and a call relation verification request to the computing module according to the planning task, and the computing module generates a verification task based on the executable task and the application and verifies whether the recorded component call information is correct or not; if the result is correct, continuing to check the next step; if the error occurs, the alarm is given and the verification is terminated.
The computing module generates verification data and executes calling relation verification based on the component topological graph; if the obtained call context information is the same as the information of the component topological graph, returning to check correctness; and if the call context information is different from the component topological graph, alarming and terminating the verification. The calculation module further returns a verification result to the drawing module.
The drawing module gathers the verification results, if the verification is successful, the flow is ended and the verification results are returned to the operation management module; if the verification fails, the drawing process of the component topological graph is re-executed.
According to the component topological graph generation method provided by the embodiment of the application, the code to be analyzed of the distributed system is automatically analyzed, each component and executable task contained in the code to be analyzed are obtained, call information among the components is obtained based on the executable task, and further, the component topological graph is generated according to the call information among the components and the network address of the components. The embodiment of the application can automatically generate the latest topological graph after the distributed system is deployed, and can improve the drawing efficiency of the topological graph.
It should be understood that, although the steps in the flowcharts related to the embodiments described above are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a component topology graph generation device for realizing the above related component topology graph generation method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation in the embodiments of the device for generating a component topology map provided below may be referred to the limitation of the method for generating a component topology map hereinabove, and will not be described herein.
In one embodiment, as shown in fig. 12, there is provided a component topology map generating apparatus, including: a parsing module 1202, a first generating module 1204, a first obtaining module 1206, a second generating module 1208, wherein:
the analysis module 1202 is configured to analyze a code to be analyzed to obtain components and executable tasks included in the code to be analyzed, where the executable tasks include at least one component;
the first generating module 1204 is configured to generate, for any one of the executable tasks, simulation data for the executable task, and input the simulation data into the executable task to obtain call information between the components in the executable task;
A first obtaining module 1206, configured to obtain a network address of each of the components;
a second generating module 1208 is configured to generate a component topology map based on the network address of each component and call information between each component.
The device for generating the component topological graph automatically analyzes the code to be analyzed of the distributed system, acquires all components and executable tasks contained in the code to be analyzed, acquires call information among the components based on the executable tasks, and further generates the component topological graph according to the call information among the components and the network address of the components. The embodiment of the application can automatically generate the latest topological graph after the distributed system is deployed, and can improve the drawing efficiency of the topological graph.
In one embodiment, the first generating module 1204 is further configured to:
inputting the simulation data into the executable task, and obtaining output data of each component when the executable task processes the simulation data;
inputting first output data corresponding to a first component into each second component, and obtaining second output data of each second component after each second component processes the first output data, wherein the first component is any component, and the second components are components except the first component;
For any second output data, determining that a calling relationship exists between the first component and the second component when the second output data is matched with the output data corresponding to the second component;
and generating calling information among the components according to the calling relation among the components.
In one embodiment, the first generating module 1204 is further configured to:
generating call context information of the executable task according to the call relation among the components;
and taking the calling relation among the components and the calling context information as calling information among the components.
In one embodiment, the apparatus further comprises:
the sending module is used for respectively sending interaction requests to the network addresses of the components;
the processing module is used for regarding any component, and taking the network address corresponding to the component as an invalid address when response information corresponding to the interaction request is not received or the response information does not meet a preset requirement.
In one embodiment, the second generating module 1208 is further configured to:
Classifying each component according to the network address of each component to obtain a plurality of component categories;
for any component category, storing the network address and the call information of each component in the component category into a data table corresponding to the component category;
and calling the data table corresponding to each component category to generate a component topological graph.
In one embodiment, the apparatus further comprises:
the second acquisition module is used for checking the component topological graph and acquiring a checking result;
and the fourth generation module is used for regenerating the component topological graph under the condition that the verification result characterizes that the component topological graph is incorrectly drawn.
In one embodiment, the second obtaining module is further configured to:
performing address verification on each component according to the network address of each component in the component topological graph to obtain an address verification result;
generating a verification task according to the calling relation between the components in the component topological graph, and performing task execution verification on the component topological graph based on the verification task to obtain a task execution verification result;
Generating verification data according to call context information corresponding to each component in the component topological graph, and carrying out call relation verification on the component topological graph based on the verification data to obtain a call relation verification result;
and determining a verification result based on the address verification result, the task execution verification result and the call relation verification result.
The respective modules in the above-described component topology map generation apparatus may be implemented in whole or in part by software, hardware, or a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a server, and the internal structure of which may be as shown in fig. 13. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a component topology map generation method.
It will be appreciated by those skilled in the art that the structure shown in FIG. 13 is merely a block diagram of some of the structures associated with the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements may be applied, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the steps of the method embodiments described above when the computer program is executed.
In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when executed by a processor, carries out the steps of the method embodiments described above.
In an embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the steps of the method embodiments described above.
The user information (including but not limited to user equipment information, user personal information, etc.) and the data (including but not limited to data for analysis, stored data, presented data, etc.) related to the present application are information and data authorized by the user or sufficiently authorized by each party.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the embodiments provided herein may include at least one of a relational database and a non-relational database. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processor referred to in the embodiments provided in the present application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, or the like, but is not limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples illustrate only a few embodiments of the application and are described in detail herein without thereby limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of the application should be assessed as that of the appended claims.

Claims (11)

1. A method of generating a component topology map, the method comprising:
analyzing the code to be analyzed to obtain each component and executable task contained in the code to be analyzed, wherein the executable task comprises at least one component;
generating simulation data for any executable task, and inputting the simulation data into the executable task to obtain calling information among all components in the executable task;
Acquiring the network address of each component;
and generating a component topological graph based on the network address of each component and the call information among the components.
2. The method of claim 1, wherein the inputting the simulation data into the executable task and obtaining call information between the components in the executable task comprises:
inputting the simulation data into the executable task, and obtaining output data of each component when the executable task processes the simulation data;
inputting first output data corresponding to a first component into each second component, and obtaining second output data of each second component after each second component processes the first output data, wherein the first component is any component, and the second components are components except the first component;
for any second output data, determining that a calling relationship exists between the first component and the second component when the second output data is matched with the output data corresponding to the second component;
and generating calling information among the components according to the calling relation among the components.
3. The method of claim 2, wherein generating call information between the components according to the call relationship between the components comprises:
generating call context information of the executable task according to the call relation among the components;
and taking the calling relation among the components and the calling context information as calling information among the components.
4. The method according to claim 1, wherein the method further comprises:
respectively sending an interaction request to the network address of each component;
and aiming at any component, taking the network address corresponding to the component as an invalid address under the condition that response information corresponding to the interaction request is not received or the response information does not meet the preset requirement.
5. The method of claim 1, wherein generating a component topology map based on network addresses of the components and call information between the components comprises:
classifying each component according to the network address of each component to obtain a plurality of component categories;
For any component category, storing the network address and the call information of each component in the component category into a data table corresponding to the component category;
and calling the data table corresponding to each component category to generate a component topological graph.
6. A method according to claim 3, characterized in that the method further comprises:
checking the component topological graph to obtain a checking result;
and regenerating the component topological graph in the condition that the verification result represents that the drawing of the component topological graph is incorrect.
7. The method of claim 6, wherein verifying the component topology map to obtain a verification result comprises:
performing address verification on each component according to the network address of each component in the component topological graph to obtain an address verification result;
generating a verification task according to the calling relation between the components in the component topological graph, and performing task execution verification on the component topological graph based on the verification task to obtain a task execution verification result;
generating verification data according to call context information corresponding to each component in the component topological graph, and carrying out call relation verification on the component topological graph based on the verification data to obtain a call relation verification result;
And determining a verification result based on the address verification result, the task execution verification result and the call relation verification result.
8. A component topology generation apparatus, the apparatus comprising:
the analysis module is used for analyzing the code to be analyzed to obtain each component and executable task contained in the code to be analyzed, wherein the executable task comprises at least one component;
the first generation module is used for generating simulation data for any executable task, inputting the simulation data into the executable task and obtaining calling information among all the components in the executable task;
the first acquisition module is used for acquiring the network address of each component;
and the second generation module is used for generating a component topological graph based on the network address of each component and the call information among the components.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 7 when the computer program is executed.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 7.
11. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 7.
CN202310952276.9A 2023-07-31 2023-07-31 Component topology map generation method and device, computer equipment and storage medium Pending CN117112051A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310952276.9A CN117112051A (en) 2023-07-31 2023-07-31 Component topology map generation method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310952276.9A CN117112051A (en) 2023-07-31 2023-07-31 Component topology map generation method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117112051A true CN117112051A (en) 2023-11-24

Family

ID=88811893

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310952276.9A Pending CN117112051A (en) 2023-07-31 2023-07-31 Component topology map generation method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117112051A (en)

Similar Documents

Publication Publication Date Title
CN107665171B (en) Automatic regression testing method and device
CN106656536B (en) Method and equipment for processing service calling information
CN110928772A (en) Test method and device
CN109101415A (en) Interface test method, system, equipment and the storage medium compared based on database
CN112181804B (en) Parameter verification method, device and storage medium
WO2019019640A1 (en) Simulated processing method and apparatus for order information, and storage medium and computer device
CN109815119B (en) APP link channel testing method and device
CN114116496A (en) Automatic testing method, device, equipment and medium
CN109408361A (en) Monkey tests restored method, device, electronic equipment and computer readable storage medium
CN108460068A (en) Method, apparatus, storage medium and the terminal that report imports and exports
CN113010208B (en) Version information generation method, device, equipment and storage medium
CN111552648A (en) Automatic verification method and system for application
CN117112051A (en) Component topology map generation method and device, computer equipment and storage medium
CN112631905A (en) Execution process data management method and device, computer equipment and storage medium
CN111752847A (en) Interface comparison method, micro server, computer readable storage medium and electronic device
CN116795723B (en) Chain unit test processing method and device and computer equipment
CN115640236B (en) Script quality detection method and computing device
CN117056238B (en) Method and computing device for verifying correctness of model conversion under deployment framework
CN111324757B (en) Map data problem processing method and device
CN115168673B (en) Data graphical processing method, device, equipment and storage medium
CN116185867A (en) Automatic driving perception regression testing method, computer equipment and storage medium
CN118069718A (en) Data display method, device, computer equipment and storage medium
CN116756032A (en) Data testing method, device, computer equipment and storage medium
CN116107889A (en) Regression testing method and device for application program, computer equipment and storage medium
CN115827478A (en) Code viewing method and device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination