Method and device for determining influence range of code change, equipment, medium and product
By constructing call chain topology and static code analysis, the scope of influence of microservice code changes is determined, and the problem of identification of code changes in the microservice architecture is solved, and accurate identification and monitoring of the scope of influence is achieved.
Patent Information
- Application Number
- CN202411077855.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-07
- Publication Date
- 2024-11-29
AI Technical Summary
In microservice architecture, it is difficult to accurately determine the impact range of code changes. Previous technologies such as traffic call log data analysis and code instrumentation technology have problems with identification missing or coverage recognition.
By building the call chain topology between nodes, the target nodes that have undergone code changes and their influential call links are determined. Static code compilation and scanning, call chain topology construction of microservice-related nodes, Diff analysis and interval search algorithms are used to accurately Position affected functions and microservices.
It realizes accurate monitoring and identification of the impact range of code changes, with fine granularity and complete data dimensions, and does not require modification of development code. The identification coverage includes functions, call links, interfaces and microservice relationships.
Smart Images

Figure CN119045879A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of microservices, and in particular to a method for determining a code modification impact scope, an apparatus for determining a code modification impact scope, a device for determining a code modification impact scope, a storage medium, and a computer program product. Background Art
[0002] With the use of microservice architecture technology and the continuous development of business systems, the number of microservices is increasing, and the relationships between microservices are becoming more and more complex. The traditional method of relying on manpower to identify the scope of impact of each code change becomes increasingly difficult when the scope of impact that may be introduced includes the affected interfaces, function call chains, and upstream and downstream microservices.
[0003] At present, the impact analysis solutions for microservice code changes are mostly based on actual traffic call log data analysis or code instrumentation technology analysis. However, the former has the problem of missing relationship identification for call links that have never occurred in history; the latter requires adding a Java agent before starting the monitoring service, which can only identify the code coverage but lacks the identification of call chain relationships.
[0004] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention
[0005] The main purpose of the present application is to provide a method for determining the scope of impact of a code change, an apparatus for determining the scope of impact of a code change, a device for determining the scope of impact of a code change, a storage medium and a computer program product, aiming to solve the technical problem that it is difficult to accurately determine the scope of impact of a code change.
[0006] To achieve the above purpose, the present application proposes a method for determining the impact scope of a code modification, the method comprising:
[0007] Build a call chain topology based on nodes and the call relationships between nodes;
[0008] A target node where code modification occurs is determined, and a call link affected by the code modification of the target node is determined in the call chain topology.
[0009] In one embodiment, when the node is a function node, the step of constructing a call chain topology according to the node and the call relationship between the nodes includes:
[0010] Compile and scan the static code to obtain parsed data;
[0011] A first call chain topology of the function nodes is constructed according to the function nodes in the parsed data and the call relationships between the function nodes.
[0012] In one embodiment, when the node is a microservice-related node, the step of constructing a call chain topology according to the node and the call relationship between the nodes includes:
[0013] According to the microservice-related nodes and the calling relationships between the microservice-related nodes, a second calling chain topology of the microservice-related nodes is constructed.
[0014] In one embodiment, the step of determining the target node where the code modification occurs includes:
[0015] Determine the target function nodes where code changes have occurred through code change analysis;
[0016] Determine the target microservice related node where the target function node is located;
[0017] The target function node and the target microservice related nodes are used as target nodes where code changes occur.
[0018] In one embodiment, the step of determining the call links affected by the code modification of the target node in the call chain topology includes:
[0019] In the first call chain topology of a function node in a single microservice, the first call link affected by the code change of the target function node is determined through call chain analysis.
[0020] In one embodiment, the step of determining the call links affected by the code modification of the target node in the call chain topology includes:
[0021] In the second call chain topology of microservice-related nodes in multiple microservices, the second call link affected by the code change of the target microservice-related node is determined through call chain analysis.
[0022] In addition, to achieve the above purpose, the present application also proposes a device for determining the impact range of a code change, the device comprising:
[0023] The construction module is used to build the call chain topology based on the nodes and the call relationships between the nodes;
[0024] The determination module is used to determine the target node where the code change occurs, and determine the call link affected by the code change of the target node in the call chain topology.
[0025] In addition, to achieve the above-mentioned purpose, the present application also proposes a device for determining the scope of impact of a code modification, the device comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor, the computer program being configured to implement the steps of the method for determining the scope of impact of a code modification as described above.
[0026] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the method for determining the scope of impact of code changes as described above are implemented.
[0027] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the method for determining the scope of impact of code modification as described above are implemented.
[0028] One or more technical solutions proposed in this application have at least the following technical effects:
[0029] In this application, a method for analyzing the impact of microservice changes is proposed. A call chain topology is constructed based on the call relationship between nodes and nodes, and then the target node where the code change occurs is determined, and the call link affected by the code change of the target node is determined in the call chain topology. Compared with conventional means, the link where the code change occurs can be monitored in real time, and the call link can also be identified. In this way, the call link where the affected function is located is located through the call chain topology, so as to more accurately determine the impact range of the code change. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0031] 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 or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0032] Figure 1 A flowchart diagram of an embodiment of a method for determining the scope of impact of code changes in this application;
[0033] Figure 2 A schematic diagram of static code compilation scanning provided for an embodiment of a method for determining the scope of impact of code modification in this application;
[0034] Figure 3 A schematic diagram of a static code function call chain topology construction provided for an embodiment of a method for determining the scope of impact of a code change in this application;
[0035] Figure 4 A schematic diagram of microservice topology construction provided for an embodiment of a method for determining the scope of impact of code changes in this application;
[0036] Figure 5 A schematic diagram of function change identification provided for an embodiment of a method for determining the scope of impact of code changes in this application;
[0037] Figure 6 A schematic diagram of a single microservice code call chain analysis provided for an embodiment of a method for determining the scope of impact of code changes in this application;
[0038] Figure 7 A schematic diagram of a microservice change impact result query page provided for an embodiment of a method for determining the impact scope of a code change in this application;
[0039] Figure 8 A schematic diagram of detailed data of interfaces affected by querying provided in an embodiment of a method for determining the scope of impact of code changes in this application;
[0040] Fig. 9 A schematic diagram of the architecture of the application scenario for determining the scope of impact of code changes in this application;
[0041] Fig.10 A schematic diagram of the module structure of a device for determining the impact range of code modification in an embodiment of the present application;
[0042] Fig.11 A schematic diagram of the device structure of the hardware operating environment involved in the method for determining the scope of impact of code modification in an embodiment of the present application.
[0043] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0044] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0045] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0046] The present application embodiment provides a method for determining the impact range of code modification, referring to Figure 1 , Figure 1 This is a flowchart of the first embodiment of the method for determining the impact scope of code modification in this application.
[0047] In this embodiment, the method for determining the impact range of the code modification includes steps S10 to S20:
[0048] Step S10, constructing a call chain topology according to the nodes and the call relationships between the nodes;
[0049] Step S20, determining the target node where the code change occurs, and determining the call links affected by the code change of the target node in the call chain topology.
[0050] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device that can realize the above functions.
[0051] In addition, it should be noted that nodes include function nodes and microservice-related nodes. Function nodes refer to nodes that are determined to be added based on the functions in the code as the basic units, and one function node can call one or more other function nodes. Microservice-related nodes refer to nodes related to microservices, such as systems, microservices, databases and / or middleware, that are determined to be added as basic units. There is also a calling relationship between the microservice-related nodes.
[0052] In one embodiment, a node that calls other nodes is taken as a start node, and a node that is called by other nodes is taken as a target node. According to the calling relationship between the start node and the end node, a directed edge is added between the start node and the target node, thereby constructing a call chain topology.
[0053] In one embodiment, before step S10, the process further includes: collecting relevant R&D asset data and call relationships offline at regular intervals, the data including system, microservice, database and middleware data, as well as code data and call relationship data, etc. Collecting R&D asset data offline does not affect ongoing business transactions.
[0054] In a feasible implementation, when the node is a function node, the step of constructing a call chain topology according to the node and the call relationship between the nodes includes:
[0055] Compile and scan the static code to obtain parsed data;
[0056] A first call chain topology of the function nodes is constructed according to the function nodes in the parsed data and the call relationships between the function nodes.
[0057] In one embodiment, when the static code is compiled and scanned to obtain parsed data, reference is made to Figure 2, a Java code scanning and analysis solution compatible with most scenarios is proposed. The code is downloaded, compiled and packaged, and the class information, function and function call relationship data, and annotation information are obtained by parsing. The first step is to use the jgit tool to download the corresponding code library from the code cloud. If the code library exists in the submodule file, the corresponding submoudle pull operation will be performed at the same time. The second step is to package the downloaded code, use maven or gradle to perform the corresponding packaging operation, and generate the corresponding Jar package. The third step is to parse the .class file first according to the Java bytecode specification, and pre-extract the class, interface and its inheritance relationship. The fourth step is to use the Apache Bcel byte toolkit to parse the class file to obtain class information, class annotation information, method information and method annotation information. The fifth step is to use the visitor pattern to traverse all function call relationships of each function body. The sixth step is to write the extracted information to temporary files in batches to reduce memory usage. The seventh step is to complete the final cleanup work.
[0058] In one embodiment, when constructing the first call chain topology of the function node, refer to Figure 3 , based on the parsed data such as classes, functions, annotations, and function call relationships, a single application function call chain graph relationship is built in memory.
[0059] It should be noted that in the process of constructing the first call chain topology of the function node, some methods need to be excluded, such as the methods provided by JDK.
[0060] In one embodiment, according to the calling relationship between functions, corresponding nodes and edge relationships are added in sequence in the memory to obtain a first calling chain topology of the function nodes.
[0061] In a feasible implementation, when the node is a microservice-related node, the step of constructing a call chain topology according to the node and the call relationship between the nodes includes:
[0062] According to the microservice-related nodes and the calling relationships between the microservice-related nodes, a second calling chain topology of the microservice-related nodes is constructed.
[0063] In one embodiment, when constructing the second call chain topology of the microservice related nodes, refer to Figure 4 , add each collected microservice-related node such as system, microservice, database, middleware, etc. as a node of the graph, find the corresponding start node and target node in the graph for each collected call relationship data, and then add a directed edge to construct the second call chain topology of microservice-related nodes.
[0064] In one embodiment, based on the collected R&D asset data such as microservice-related nodes and the call relationships between the microservice-related nodes, a second call chain topology of the microservice-related nodes is constructed by relying on the graph relational database neo4j.
[0065] In a feasible implementation manner, the step of determining the target node where the code modification occurs includes:
[0066] Determine the target function nodes where code changes have occurred through code change analysis;
[0067] Determine the target microservice related node where the target function node is located;
[0068] The target function node and the target microservice related nodes are used as target nodes where code changes occur.
[0069] In one embodiment, when determining the target node where the code change occurs, the function node where the code change occurs is first determined, and then because it can be determined that the target function node where the code change occurs belongs to a certain microservice-related node, the target microservice-related node where the code change occurs, that is, the target microservice-related node where the target function node is located, can be further determined based on the microservice-related node where the function node is located. In other words, the function belongs to a certain microservice, and through the affected function, the affected microservice can be determined by determining the microservice to which the affected function belongs.
[0070] In one embodiment, when determining the target node where the code modification occurs, refer to Figure 5 , we can use Diff analysis and interval search algorithm to get the changed function affected by the change, that is, the target function node. First, by comparing the git tree of the previous and next Tag or CommitId versions, we can get the fully qualified name of the changed java file, the start and end lines of the change, and the changed code. Then, using diff analysis, we can get the start and end line number information of the changed code block, combined with the function information set of all classes obtained from code scanning, and use the interval search algorithm to perform the corresponding search to determine the affected target function node.
[0071] It should be noted that the present application designs a call chain search solution based on a combination of memory and graph database to search for affected links based on the affected functions or microservices.
[0072] In a feasible implementation manner, the step of determining the call links affected by the code modification of the target node in the call chain topology includes:
[0073] In the first call chain topology of a function node in a single microservice, the first call link affected by the code change of the target function node is determined through call chain analysis.
[0074] In one embodiment, referring to Figure 6 For the single service internal call link search scenario, a local function call topology graph is constructed in memory, and an algorithm is used to search the corresponding function call chain. Exemplarily, the specific search steps include: using a depth-first algorithm, starting from the change function, performing a depth-first search, and the recursive end condition is that the in-degree of a function is 0, and obtaining the affected function call link, that is, the first call link.
[0075] In a feasible implementation manner, the step of determining the call links affected by the code modification of the target node in the call chain topology includes:
[0076] In the second call chain topology of microservice-related nodes in multiple microservices, the second call link affected by the code change of the target microservice-related node is determined through call chain analysis.
[0077] In one embodiment, for the call chain search scenario between multiple microservices, such as microservices and microservices, or microservices and middleware, where the relationship is simple, the data volume is not large, and the query volume is small, the graph database neo4j is used to store the corresponding data, that is, the second call chain topology of the microservice-related nodes, and the corresponding Cypher statements are written for analysis. The second call link affected by the code changes of the target microservice-related nodes is determined through the call chain analysis.
[0078] It should be noted that the search in the microservice topology is not displayed. Figure 6 Similar, no further elaboration is required here.
[0079] In a feasible implementation, the microservice change impact analysis is displayed in the project dimension, and the displayed information includes the project number, pipeline stage, and detailed information. Each item of the detailed information represents a microservice code change, the affected API, job bar, and upstream and downstream release unit information, and is highlighted in different colors or highlights, such as Figure 7 By clicking the API button, you can see the detailed impact content, such as Figure 8 As shown. In this way, the impact of each code change is displayed according to the project dimension, and the impact content is highlighted in different colors; by clicking the corresponding button, the detailed content of the impact is displayed, and a report download option is provided for user convenience.
[0080] As mentioned above, this application is based on code branch comparison, code scanning and other technologies to accurately locate the affected function call links, affected interfaces, affected upstream and downstream microservices, etc., to assist relevant personnel such as R&D personnel, testers and business personnel to more accurately and comprehensively judge the scope of the current change impact. Compared with the traditional microservice change impact analysis method, this application has the characteristics of fine recognition granularity, complete data dimensions and non-intrusion. The fine recognition granularity is reflected in the change analysis at the code function level. The data dimensions are complete, that is, the recognition scope includes changed functions, function call links, affected interfaces, and affected microservice call relationships, etc. Non-intrusive, no modification to the development code is required for identification.
[0081] In the application scenario of a method for determining the impact range of a code modification in the present application, refer to Fig. 9 Module 1 collects relevant R&D asset data and call relationships at regular intervals; Module 2 builds call topology based on the collected R&D asset data and relies on the graph relational database neo4j; Module 3 is the static code compilation scanning module; Module 4 builds a single application function call chain graph in memory based on the classes, functions, annotations, and function call relationships obtained by module 3; Module 5 obtains the changed functions affected by the changes through Diff analysis and interval search algorithm; Module 6 designs a memory-based ( Figure 3 , the function call chain topology corresponding to module 4) and the graph database ( Figure 4 , the call chain search solution combined with the microservice topology corresponding to module 2) is used to perform call chain analysis, and the affected links are searched according to the affected functions or microservices; module 7 displays the analysis results on the page.
[0082] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the method for determining the scope of impact of code changes in the present application. More forms of simple transformations based on this technical concept are all within the scope of protection of the present application.
[0083] This application also provides a device for determining the scope of impact of code changes, please refer to Fig.10 , the device comprises:
[0084] A construction module 10 is used to construct a call chain topology according to the nodes and the call relationships between the nodes;
[0085] The determination module 20 is used to determine the target node where the code change occurs, and determine the call link affected by the code change of the target node in the call chain topology.
[0086] In one embodiment, when the node is a function node, the construction module is further used to:
[0087] Compile and scan the static code to obtain parsed data;
[0088] A first call chain topology of the function nodes is constructed according to the function nodes in the parsed data and the call relationships between the function nodes.
[0089] In one embodiment, when the node is a microservice-related node, the construction module is further used to:
[0090] According to the microservice-related nodes and the calling relationships between the microservice-related nodes, a second calling chain topology of the microservice-related nodes is constructed.
[0091] In one embodiment, the determining module is further configured to:
[0092] Determine the target function nodes where code changes have occurred through code change analysis;
[0093] Determine the target microservice related node where the target function node is located;
[0094] The target function node and the target microservice related nodes are used as target nodes where code changes occur.
[0095] In one embodiment, the determining module is further configured to:
[0096] In the first call chain topology of a function node in a single microservice, the first call link affected by the code change of the target function node is determined through call chain analysis.
[0097] In one embodiment, the determining module is further configured to:
[0098] In the second call chain topology of microservice-related nodes in multiple microservices, the second call link affected by the code change of the target microservice-related node is determined through call chain analysis.
[0099] The device for determining the scope of influence of a code change provided by the present application adopts the method for determining the scope of influence of a code change in the above-mentioned embodiment, and can solve the technical problem that it is difficult to accurately determine the scope of influence of a code change. Compared with the prior art, the beneficial effects of the device for determining the scope of influence of a code change provided by the present application are the same as the beneficial effects of the method for determining the scope of influence of a code change provided by the above-mentioned embodiment, and other technical features in the device for determining the scope of influence of a code change are the same as the features disclosed in the above-mentioned embodiment method, and are not described in detail here.
[0100] The present application provides a device for determining the scope of impact of a code change, the device for determining the scope of impact of a code change includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method for determining the scope of impact of a code change in the above-mentioned embodiment 1.
[0101] Reference below Fig.11 , which shows a schematic diagram of the structure of a device for determining the scope of influence of code changes suitable for implementing the embodiment of the present application. The device for determining the scope of influence of code changes in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig.11 The device for determining the scope of impact of code changes shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0102] like Fig.11As shown, the device for determining the scope of impact of code changes may include a processing device 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. Various programs and data required for the operation of the device for determining the scope of impact of code changes are also stored in RAM1004. The processing device 1001, ROM1002, and RAM1004 are connected to each other via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 1003 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 1009. The communication device 1009 can allow the device for determining the scope of impact of a code change to communicate wirelessly or wired with other devices to exchange data. Although the figure shows a device for determining the scope of impact of a code change with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems may be implemented or have instead.
[0103] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0104] The device for determining the scope of influence of a code change provided by the present application adopts the method for determining the scope of influence of a code change in the above embodiment, which can solve the technical problem of difficulty in accurately determining the scope of influence of a code change. Compared with the prior art, the beneficial effects of the device for determining the scope of influence of a code change provided by the present application are the same as the beneficial effects of the method for determining the scope of influence of a code change provided by the above embodiment, and other technical features in the device for determining the scope of influence of a code change are the same as the features disclosed in the method of the previous embodiment, which will not be described in detail here.
[0105] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0106] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0107] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, the computer-readable program instructions being used to execute the method for determining the impact scope of code modification in the above-mentioned embodiment.
[0108] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0109] The computer-readable storage medium may be included in the device for determining the scope of influence of a code modification; or may exist independently without being assembled into the device for determining the scope of influence of a code modification.
[0110] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by a device for determining the scope of influence of a code change, the device for determining the scope of influence of the code change: constructs a call chain topology based on nodes and calling relationships between nodes; determines a target node where a code change occurs, and determines in the call chain topology the call link affected by the code change of the target node.
[0111] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0112] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0113] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0114] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned method for determining the scope of influence of code changes, and can solve the technical problem of difficulty in accurately determining the scope of influence of code changes. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the method for determining the scope of influence of code changes provided by the above-mentioned embodiments, and will not be elaborated here.
[0115] The present application also provides a computer program product, including a computer program, which implements the steps of the method for determining the impact scope of code modification as described above when the computer program is executed by a processor.
[0116] The computer program product provided by the present application can solve the technical problem of determining the scope of influence of code modification. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as the beneficial effects of the method for determining the scope of influence of code modification provided by the above embodiment, which will not be elaborated here.
[0117] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A method for determining the impact scope of a code change, characterized in that: The method includes: Build a call chain topology based on nodes and the call relationships between nodes; A target node where code modification occurs is determined, and a call link affected by the code modification of the target node is determined in the call chain topology.
2. The method according to claim 1, characterized in that When the node is a function node, the step of constructing a call chain topology according to the node and the call relationship between the nodes includes: Compile and scan the static code to obtain parsed data; A first call chain topology of the function nodes is constructed according to the function nodes in the parsed data and the call relationships between the function nodes.
3. The method according to claim 1, characterized in that When the node is a microservice-related node, the step of constructing a call chain topology according to the node and the call relationship between the nodes includes: According to the microservice-related nodes and the calling relationships between the microservice-related nodes, a second calling chain topology of the microservice-related nodes is constructed.
4. The method according to claim 1, characterized in that The step of determining the target node where the code change occurs includes: Determine the target function nodes where code changes have occurred through code change analysis; Determine the target microservice related node where the target function node is located; The target function node and the target microservice related nodes are used as target nodes where code changes occur.
5. The method according to claim 1, characterized in that The step of determining the call links affected by the code modification of the target node in the call chain topology includes: In the first call chain topology of a function node in a single microservice, the first call link affected by the code change of the target function node is determined through call chain analysis.
6. The method according to claim 1, characterized in that The step of determining the call links affected by the code modification of the target node in the call chain topology includes: In the second call chain topology of microservice-related nodes in multiple microservices, the second call link affected by the code change of the target microservice-related node is determined through call chain analysis.
7. A device for determining the impact range of a code modification, characterized in that: The device comprises: The construction module is used to build the call chain topology based on the nodes and the call relationships between the nodes; The determination module is used to determine the target node where the code change occurs, and determine the call link affected by the code change of the target node in the call chain topology.
8. A device for determining the impact range of a code change, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the method for determining the code modification impact scope according to any one of claims 1 to 6.
9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the method for determining the scope of impact of a code modification according to any one of claims 1 to 6 are implemented.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the method for determining the code modification impact scope according to any one of claims 1 to 6 are implemented.
