Method and device for acquiring interface calling link, storage medium and electronic equipment

By generating an interface call relationship diagram and obtaining the interface call link, the problem of identifying the impact range of interface adjustment in software development is solved, and the accuracy and development efficiency of output data are improved.

CN119127409APending Publication Date: 2024-12-13BANK OF NINGBO
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411151819.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-21
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

During the software development process, it is difficult for developers to determine the scope of influence after the interface is adjusted, resulting in the accuracy of the output data being affected, and the prior art cannot effectively obtain interface-level call links.

Method used

By using the bytecode file of the software product package to determine the interface call relationship information, generate the interface call relationship diagram, and then obtain the interface call link for developers to adjust during the development stage.

Benefits of technology

It reduces the difficulty of developers' work, improves the accuracy of interface output data, allows developers to accurately identify and adjust interfaces within the scope of influence, and improves software development efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119127409A_ABST
    Figure CN119127409A_ABST
Patent Text Reader

Abstract

The invention provides an interface calling link obtaining method and device, a storage medium and electronic equipment, and is applied to the technical field of computers. The method comprises the steps that all to-be-processed software product packages are determined; obtaining each byte code file of each software product package; for each software product package, determining interface calling relation information of the software product package by applying each byte code file of the software product package; generating an interface calling relation graph based on the interface calling relation information of each software product package; and obtaining each interface calling link based on the interface calling relation graph. According to the method, the interface calling relation information is determined through the byte code file of the software product package, then the interface calling relation graph is constructed by using the interface calling relation information, and finally each interface calling link is obtained, so that a developer can determine the influence range of the adjusted interface in the development stage conveniently, and then the interface in the influence range is adjusted; the working difficulty of developers is reduced, and the working efficiency of the developers is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method and device for acquiring an interface call link, a storage medium and an electronic device. Background Art

[0002] As software scale and complexity increase, the calling relationships between software interfaces become more complex. During software development, when developers adjust software interfaces, they need to make corresponding adjustments to other interfaces that are related to the adjusted interfaces, otherwise the accuracy of the output data of other interfaces will be affected. Currently, during software development, it is impossible to obtain the calling link at the interface level, and developers find it difficult to determine the interfaces that are related to the adjusted interfaces, and are unable to make corresponding adjustments. Summary of the invention

[0003] In view of this, an embodiment of the present invention provides a method and device for obtaining an interface call link, a storage medium and an electronic device. By applying the solution provided by the present invention, the bytecode file of the software product package is used to determine the interface call information, and an interface call relationship diagram is generated based on the interface call information of each software product package, thereby obtaining each interface call link; subsequent developers can use the interface call link to make corresponding interface adjustments during the development stage, thereby reducing the work difficulty of developers and improving work efficiency.

[0004] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:

[0005] A method for obtaining an interface call link, comprising:

[0006] Identify each software artifact package to be processed;

[0007] Obtaining each bytecode file of each software product package;

[0008] For each of the software product packages, applying each bytecode file of the software product package, determining interface call relationship information of the software product package, wherein the interface call relationship information includes a call relationship between each service interface of the software product package and each external interface called by the software product package;

[0009] Based on the interface call relationship information of each of the software product packages, generate an interface call relationship graph;

[0010] Based on the interface call relationship graph, each interface call link is obtained.

[0011] In the above method, optionally, the step of obtaining each bytecode file of each software product package includes:

[0012] For each of the software product packages, obtain each jar package in the software product package;

[0013] Parse each of the jar packages to obtain the bytecode files in each of the jar packages.

[0014] Optionally, the method of applying each bytecode file of the software product package to determine the interface call relationship information of the software product package includes:

[0015] Obtain each service interface and each method in each of the bytecode files;

[0016] Applying each of the service interfaces and each of the methods to generate a method call network, the method call network includes a plurality of call paths, the starting node of the call path is the service interface; there is at least one call path including an external interface in the method call network;

[0017] Determine a call path including an external interface in the method call network as a target call path;

[0018] For each of the target call paths, establishing a call relationship between an external interface in the target call path and a service interface as a starting node in the target call link;

[0019] Based on the calling relationships of the software product package, interface calling relationship information of the software product package is generated.

[0020] In the above method, optionally, the application of each of the service interfaces and each of the methods to generate a method call network includes:

[0021] Apply each of the service interfaces and each method to establish a call pool;

[0022] For each of the service interfaces, taking the service interface as a starting node, and determining whether the service interface has a first call object, the first call object being an external interface or a method in the call pool;

[0023] When the service interface has a first call object, a path relationship between the service interface and the first call object is established; when the first call object is a method in the call pool, the first call object is used as a path node; when the first call object is an external interface, the first call object is used as an end node;

[0024] For each of the path nodes, determining whether a method in the path node has a second call object, where the second call object is an external interface or a method in the call pool;

[0025] When the path node has a second call object, a path relationship between the path node and the second call object is established; when the second call object is a method in the call pool, the second call object is used as a new path node, and the step of determining whether the method in the path node has a second call object is returned to each path node; when the second call object is an external interface, the second call object is determined as an end node;

[0026] When the path node does not have a second calling object, determining the path node as an end node;

[0027] For each of the service interfaces, after obtaining each end node, obtaining each calling path of the service interface;

[0028] Based on each of the calling paths, a method calling network is obtained.

[0029] Optionally, the above method, generating an interface call relationship graph based on the interface call relationship information of each software product package includes:

[0030] Obtaining each calling relationship in each of the interface calling relationship information;

[0031] Based on each of the calling relationships, an interface calling relationship graph is constructed.

[0032] The above method may optionally further include:

[0033] When receiving interface modification information, determining a target interface;

[0034] Determining an interface call link including the target interface;

[0035] Based on the interface call link including the target interface, the impact interface information of the target interface is generated.

[0036] An interface call link acquisition device, comprising:

[0037] A first determining unit, used to determine each software product package to be processed;

[0038] A first acquisition unit, used for acquiring each bytecode file of each software product package;

[0039] A second determining unit is used to determine, for each software product package, interface calling relationship information of the software product package by applying each bytecode file of the software product package, wherein the interface calling relationship information includes a calling relationship between each service interface of the software product package and each external interface called by the software product package;

[0040] A generating unit, configured to generate an interface calling relationship graph based on the interface calling relationship information of each of the software product packages;

[0041] The second acquisition unit is used to acquire each interface call link based on the interface call relationship graph.

[0042] In the above device, optionally, the first acquisition unit executes a process of acquiring each bytecode file of each software product package, including:

[0043] For each of the software product packages, obtain each jar package in the software product package;

[0044] Parse each of the jar packages to obtain the bytecode files in each of the jar packages.

[0045] Optionally, in the above-mentioned device, the second determining unit executes and applies each bytecode file of the software product package to determine the interface call relationship information of the software product package, including:

[0046] Obtain each service interface and each method in each of the bytecode files;

[0047] Applying each of the service interfaces and each of the methods to generate a method call network, the method call network includes a plurality of call paths, the starting node of the call path is the service interface; there is at least one call path including an external interface in the method call network;

[0048] Determine a call path including an external interface in the method call network as a target call path;

[0049] For each of the target call paths, establishing a call relationship between an external interface in the target call path and a service interface as a starting node in the target call link;

[0050] Based on the calling relationships of the software product package, interface calling relationship information of the software product package is generated.

[0051] In the above device, optionally, the second determining unit executes a process of applying each of the service interfaces and each of the methods to generate a method call network, including:

[0052] Apply each of the service interfaces and each method to establish a call pool;

[0053] For each of the service interfaces, taking the service interface as a starting node, and determining whether the service interface has a first call object, the first call object being an external interface or a method in the call pool;

[0054] When the service interface has a first call object, a path relationship between the service interface and the first call object is established; when the first call object is a method in the call pool, the first call object is used as a path node; when the first call object is an external interface, the first call object is used as an end node;

[0055] For each of the path nodes, determining whether a method in the path node has a second call object, where the second call object is an external interface or a method in the call pool;

[0056] When the path node has a second call object, a path relationship between the path node and the second call object is established; when the second call object is a method in the call pool, the second call object is used as a new path node, and the step of determining whether the method in the path node has a second call object is returned to each path node; when the second call object is an external interface, the second call object is determined as an end node;

[0057] When the path node does not have a second calling object, determining the path node as an end node;

[0058] For each of the service interfaces, after obtaining each end node, obtaining each calling path of the service interface;

[0059] Based on each of the calling paths, a method calling network is obtained.

[0060] In the above device, optionally, the generation unit performs a process of generating an interface call relationship graph based on the interface call relationship information of each software product package, including:

[0061] Obtaining each calling relationship in each of the interface calling relationship information;

[0062] Based on each of the calling relationships, an interface calling relationship graph is constructed.

[0063] The above device may optionally further include:

[0064] A third determining unit, configured to determine a target interface when receiving the interface modification information;

[0065] A fourth determining unit, configured to determine an interface call link including the target interface;

[0066] A generating unit is used to generate the impact interface information of the target interface based on the interface call link including the target interface.

[0067] A storage medium includes stored instructions, wherein when the instructions are executed, the device where the storage medium is located is controlled to execute the method for obtaining the interface call link as described above.

[0068] An electronic device includes a memory and one or more instructions, wherein the one or more instructions are stored in the memory and are configured to be executed by one or more processors to implement the method for acquiring an interface call link as described above.

[0069] Compared with the prior art, this application has the following advantages:

[0070] The present application provides a method and device for obtaining an interface call link, a storage medium and an electronic device, including: determining each software product package to be processed; obtaining each bytecode file of each software product package; for each software product package, applying each bytecode file of the software product package to determine the interface call relationship information of the software product package, the interface call relationship information includes the call relationship between each service interface of the software product package and each external interface called by the software product package; based on the interface call relationship information of each software product package, an interface call relationship graph is generated; based on the interface call relationship graph, each interface call link is obtained. The present application determines the interface call relationship information through the bytecode file of the software product package, and then uses the interface call relationship information to construct an interface call relationship graph, and finally obtains each interface call link. The application can obtain the interface-level call call link, which is convenient for developers to determine the impact range of the adjusted interface during the development stage, and then adjust the interface within the impact range, reducing the difficulty of the developer's work and improving the developer's work efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0071] In order to more clearly illustrate the embodiments of the present invention 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, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0072] Figure 1 A flowchart of a method for obtaining an interface call link is provided for an embodiment of the present application;

[0073] Figure 2 A flowchart of a method for determining interface call relationship information of a software product package by applying each bytecode file of the software product package provided in an embodiment of the present application;

[0074] Figure 3 Generate a flowchart of a method calling network for each service interface and each method of the application provided in the embodiment of the present application;

[0075] Figure 4 An example diagram of a method call network of a software product package provided in an embodiment of the present application;

[0076] Figure 5 An example diagram of an interface call relationship diagram provided in an embodiment of the present application;

[0077] Figure 6 A schematic diagram of a method for obtaining an interface call link provided in an embodiment of the present application;

[0078] Figure 7 A schematic diagram of the structure of a device for acquiring an interface call link provided in an embodiment of the present application;

[0079] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0080] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0081] In this application, the terms "comprises", "comprising" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element.

[0082] As software scale and complexity increase, the challenges facing software development management processes are becoming increasingly severe. Abnormal changes to interfaces can cause unexpected failures. For example, if interface A is called by interface B, and interface B is called by other interfaces, there is currently no effective way to accurately penetrate the interface call link and identify the specific affected interface range when modifying interface A.

[0083] Moreover, the current link tracking solutions in the industry mainly focus on calls between microservices. The purpose is to find abnormal nodes by monitoring the microservice call link when the software is running. This is a problem discovery and remediation measure. This solution cannot identify all the impact ranges of a specific interface or parameter changes of a certain interface during the development phase. It will not cause abnormal microservice call links, but will affect the accuracy of output data of other interfaces. The fundamental reason for this deficiency is that this method must rely on microservice operation and cannot detect the complete call link at the interface level.

[0084] Therefore, how to determine the interface call link in the development stage becomes an urgent problem that developers need to solve. The present application provides a solution for obtaining an interface call link, which uses the bytecode file of a software product package to determine the interface call relationship information of the software product package, wherein the interface call relationship information includes the call relationship between each service interface of the software product package and each external interface called by the software product package; based on the interface call relationship information of each software product package, an interface call relationship graph is generated; based on the interface call relationship graph, each interface call link is obtained. After obtaining the interface call link, developers can use the interface call link to determine the interface that has a relationship with the adjusted interface, and then make further adjustments, which reduces the difficulty of the developer's work and improves the accuracy of the output data of the software interface.

[0085] The present application can be used in many general or special computing device environments, configurations or processors, such as personal computers, server computers, handheld or portable devices, tablet devices, multi-processor devices, distributed computing environments including any of the above devices or equipment, etc.

[0086] Reference Figure 1 , which is a flowchart of a method for obtaining an interface call link according to an embodiment of the present application. For specific steps, refer to Figure 1 The specific description of S101 to S105 is as follows.

[0087] S101, determining each software product package to be processed.

[0088] The software product packages in the system group are determined as the software product packages to be processed.

[0089] Software product packages can be understood as DevOps products, which refer to various reusable components, tools, and documents of products in the software development and delivery process. They can be source code, compiled binary files, configuration files, test scripts, deployment scripts, documents, etc. Furthermore, a software product package can be regarded as a software service or a software project.

[0090] S102: Obtain each bytecode file of each software product package.

[0091] For each software product package, the software product package is decompressed to obtain the jar package in the software product package. Preferably, necessary dependent libraries are further decompressed when the software product package is decompressed to be compatible with the method called by the internal SDK of the system group, ensuring that subsequent methods can be read correctly.

[0092] The software product package contains multiple jar packages. Each jar package is parsed to obtain the bytecode files in each jar package. The bytecode file is the target file generated after compilation and can be directly run or called by other software.

[0093] It should be noted that there are different ways to package jar packages, such as single-module packaging or multi-module packaging, where different packaging methods correspond to different project types, for example, single-module packaging corresponds to single-module projects, and multi-module packaging corresponds to multi-module parent-child projects. This application is compatible with single-module projects and multi-module parent-child projects.

[0094] Furthermore, the multi-module parent-child project compiles each module into a separate Jar package and places it in the same directory as the third-party Jar packages that the project itself depends on, because the code implementation for bytecode parsing is based on the Javassist package.

[0095] S103. For each software package, apply each bytecode file of the software package to determine the interface calling relationship information of the software package, wherein the interface calling relationship information includes the calling relationship between each service interface of the software package and each external interface called by the software package.

[0096] Reference Figure 2 , which is a flowchart of a method for determining interface call relationship information of a software product package by applying each bytecode file of the software product package provided in an embodiment of the present application, and the specific contents are as S201-S205, and the relevant instructions are as follows.

[0097] S201. Obtain each service interface and each method in each bytecode file.

[0098] When obtaining each service interface and each method in each bytecode file, a bytecode parsing tool can be used to parse the bytecode file to obtain each service interface and each method in the bytecode file. Preferably, the service interface can be an AIP interface. Further, the bytecode parsing tool is the Javassist class library, which is an open source class library for analyzing, editing and creating Java bytecodes. It is generally used to dynamically create classes, add class attributes and methods, modify classes, etc. It also supports analyzing bytecode files without intruding the original code.

[0099] It should be noted that when obtaining each service interface and each method in each bytecode file, the code features such as interface implementation, abstract class, inheritance, etc. of the service interface or method will be compatible, so that the corresponding method can be found later, thereby improving the accuracy of the subsequent determination of the called method. Preferably, different code languages ​​have different features, such as Java features.

[0100] For example, when obtaining each service interface and each method in the bytecode file, you can also add the bytecode file of a project's jar package to the "class pool" ClassPool, such as a .class file, so that you can use the classes in the jar package as you like and filter out the API interfaces and methods.

[0101] It should be noted that SpringBoot's packaging method will put the sub-projects in the multi-module parent-child project into the BOOT-INF / lib directory in the form of Jar packages, and then combine them with the parent project into an executable Jar package, that is, the form of "Jar package in Jar package", which requires special processing:

[0102] After getting the API class and method, you can use this as a starting point to further find the method called by each method. By overriding the edit method in Javassit's ExprEditor, you can get the called class name and method name:

[0103] It should be noted that this rewrite method still does not support searching and drilling down on interfaces. It is necessary to determine whether the calling method is an interface, and then add a method to find the interface implementation class for special processing.

[0104] S202: Apply each service interface and each method to generate a method call network, wherein the method call network includes multiple call paths, and the starting node of the call path is the service interface; there is at least one call path including an external interface in the method call network.

[0105] Reference Figure 3 , for each service interface and each method of the application provided in the embodiment of the present application, a flowchart of generating a method calling a network is provided, the specific contents of which are as S301-S310, and the specific description is as follows.

[0106] S301. Apply each service interface and each method to establish a call pool.

[0107] By aggregating various service interfaces and methods, a call pool can be obtained.

[0108] S302. For each service interface, take the service interface as the starting node and determine whether the service interface has a first calling object; when the service interface has a first calling object, execute S303; when the service interface does not have a first calling object, end.

[0109] The first calling object is an external interface or a method in a calling pool; it should be noted that the external interface here is an interface that is not in the software product package.

[0110] Reference Figure 4 , which is an example diagram of a method call network of a software product package provided in an embodiment of the present application. API interface 1 to API interface 3 in the diagram are all service interfaces of the software product package, and API interface 1 to API interface 3 are all starting nodes.

[0111] S303, establishing a path relationship between the service interface and the first calling object. When the first calling object is a method in the calling pool, execute S304; when the first calling object is an external interface, execute S308.

[0112] The path relationship between the service interface and the first calling object is equivalent to the calling relationship between the service interface and the first calling object, and has a direction.

[0113] Preferably, the number of first calling objects of the service interface is at least one.

[0114] like Figure 4 As shown, the first calling object of API interface 1 is method 1, and the number of first calling objects at this time is 1; the first calling objects of API interface 2 are method 2 and method 3, and the number of first calling objects at this time is 2.

[0115] Steps S302-S303 are used to determine the content called by each service interface (i.e., the first calling object). For any service interface, if the service interface does not have any calling content, the processing of the service interface is terminated. If the service interface does have any calling content, subsequent processing is continued.

[0116] S304: Use the first calling object as a path node.

[0117] like Figure 4 As shown, for API interface 1, the first calling object of the API interface is method 1, and method 1 is used as a path node.

[0118] S305. For each path node, determine whether there is a second call object for the method in the path node; when the path node has a second call object, execute S306; when the path node does not have a second call object, execute S309.

[0119] The second calling object is an external interface or a method in a calling pool; the external interface here is an interface that is not in the software product package.

[0120] S306, establishing a path relationship between the path node and the second calling object. When the second calling object is a method in the calling pool, execute S307; when the second calling object is an external interface, execute S310.

[0121] It should be noted that when the second call object is an external interface, it means that the second call object of the path node is not in the call pool. When the path node has a second call object, the number of the second call objects of the path node is at least one. Figure 4 As shown, method 6 has two second calling objects, namely method 10 and method 9.

[0122] S307: Use the second calling object as a new path node, and return to execute S305.

[0123] After the second calling object is used as a new path node, the process returns to S305 and iterates continuously until all end nodes of the service interface are obtained.

[0124] S308: Use the first calling object as the end node.

[0125] S309: Determine the path node as the end node.

[0126] S310: Use the second calling object as the end node.

[0127] Steps S302-S310 are the process of determining all end nodes of each service interface. For any service interface, after all end nodes are determined, each call path of the service interface can be obtained, and the call path includes at least a start node and an end node.

[0128] by Figure 4 Take API interface 2 in as an example to illustrate, take API interface 2 as the starting node, method 2 and method 3 are both the first calling objects of API interface 2, and establish a path relationship between API interface 2 and method 2 and method 3, wherein the second calling object of method 2 is method 6, and a path relationship between method 2 and method 6 is established, the second calling objects of method 6 are method 10 and method 9, and a path relationship between method 6 and method 10 and method 9 is established, wherein method 10 has no second calling object, and method 10 is determined as the end node. At this time, the calling path of API interface 2->method 2->method 6->method 10 can be obtained.

[0129] The second calling object of method 9 is external interface 2. At this time, external interface 2 needs to be used as the end node. At this time, the calling path of API interface 2 -> method 2 -> method 6 -> method 9 -> external interface 2 can be obtained.

[0130] The second calling object of method 3 is method 7, which establishes a path relationship between method 3 and method 7. The second calling object of method 7 is method 9, which establishes a path relationship between method 7 and method 9. The second calling object of method 9 is external interface 2. At this time, external interface 2 needs to be used as the end node. At this time, the calling path of API interface 2->method 3->method 7->method 9->external interface 2 can be obtained.

[0131] At this point, three calling paths of API interface 2 can be obtained.

[0132] After obtaining each call path of each API interface of the software package, the method call network of the software package can be obtained. Preferably, each call path can be saved as a graph data structure. The present application can use the JGraphT class library to implement a graph database. JGraphT has richer graph algorithms and more convenient link search. After processing the graph data structure, the method call network can be obtained, and the method call network is a directed graph.

[0133] S203: Determine the calling path including the external interface in the method calling network as the target calling path.

[0134] like Figure 4 As shown, the call paths including external interface 1 and external interface 2 are determined as target call paths, for example, API interface 2 -> method 3 -> method 7 -> method 9 -> external interface 2, and no further examples are given here.

[0135] S204: For each target call path, establish a call relationship between the external interface in the target call path and the service interface serving as the starting node in the target call link.

[0136] by Figure 4 Taking API interface 2->method 3->method 7->method 9->external interface 2 in as an example, a calling relationship of API interface 2 calling external interface 2 is established. The calling relationship includes the starting interface and the ending node of the target calling path.

[0137] Furthermore, a service interface may call multiple external interfaces. Figure 4 Taking API interface 1 in as an example, API interface 1 calls external interface 1 and calls external interface 2.

[0138] S205: Generate interface call relationship information of the software product package based on various call relationships of the software product package.

[0139] The various call relationships of the software product package are aggregated and packaged, thereby obtaining interface call relationship information including various call relationships of the software product package.

[0140] S104: Generate an interface call relationship graph based on the interface call relationship information of each software product package.

[0141] Obtain each call relationship in each interface call relationship information; and construct an interface call relationship graph based on each call relationship. The interface call relationship graph is a directed graph, and the same nodes in each call relationship can be overlapped to connect different nodes. There are call relationships between different nodes, and thus the interface call relationship graph can be obtained.

[0142] Reference Figure 5 , which is an example diagram of the interface call relationship diagram provided in an embodiment of the present application. Interfaces A1-A3 in the diagram can be understood as the various API interfaces in software product package A, interfaces B1-B2 can be understood as the various API interfaces in software product package B, interfaces C1-C2 can be understood as the various API interfaces in software product package C, and interfaces D1-D2 can be understood as the various API interfaces in software product package D.

[0143] S105. Based on the interface call relationship graph, obtain each interface call link.

[0144] You can obtain each interface call link based on the call relationship of each interface in the interface call relationship diagram. Figure 5 As shown, there are 4 interface call links in total, specifically: interface call link (1): interface A1->interface C1->interface A3->interface D1; interface call link (2): interface A2->interface B1->interface A3->interface D1; interface call link (3): interface A2->interface B1->interface C2->interface D2; interface call link (4): interface B2->interface C2->interface D2.

[0145] Preferably, after obtaining each interface call link, when receiving interface modification information, determine the target interface based on the interface modification information; the interface modification information includes information of the interface to be adjusted, such as the interface ID or other identification code, etc.; determine the interface call link including the target interface, preferably, the interface call link including the target interface is the impact range of the target interface; based on the interface call link including the target interface, generate the impact interface information of the target interface. All interfaces in the interface call links including the target interface are included in the impact interface information.

[0146] During the development stage, the impact interface information of the adjusted interface can be obtained through the interface call link. Based on the impact interface information, the developer can accurately determine the interface that has a relationship with the called interface, and then make corresponding interface adjustments, thereby improving the accuracy of the interface output data and reducing the developer's work difficulty and software development difficulty.

[0147] In the method provided in the embodiment of the present application, each software product package to be processed is determined; each bytecode file of each software product package is obtained; for each software product package, each bytecode file of the software product package is applied to determine the interface call relationship information of the software product package, wherein the interface call relationship information includes the call relationship between each service interface of the software product package and each external interface called by the software product package; based on the interface call relationship information of each software product package, an interface call relationship graph is generated; based on the interface call relationship graph, each interface call link is obtained. The present application determines the interface call relationship information through the bytecode file of the software product package, and then uses the interface call relationship information to construct an interface call relationship graph, and finally obtains each interface call link. The application of the present application can obtain the interface-level call call link, which is convenient for developers to determine the impact range of the adjusted interface during the development stage, and then adjust the interface within the impact range, which reduces the difficulty of the developer's work and improves the developer's work efficiency.

[0148] Reference Figure 6 , which is a framework example diagram of a method for obtaining an interface call link provided in an embodiment of the present application. As shown in the figure, a product package (equivalent to the software product package mentioned above) is used as input, and an interface call link is finally output. The steps include:

[0149] (1) Unzip the product package, obtain the jar package, and further unzip the necessary dependent libraries to be compatible with the method called by the internal SDK of the system group;

[0150] (2) Parse the bytecode files in the jar package and perform special processing to make it compatible with single-module projects and multi-module parent-child projects;

[0151] (3) Obtain the API classes and interfaces in the bytecode file to obtain the starting point of the link;

[0152] (4) Find the method for each method call through the bytecode and be compatible with Java features such as interface implementation, abstract class, inheritance, etc.

[0153] (5) Iterate steps 3 and 4 to obtain all method call relationships in a product package;

[0154] (6) storing the method call relationship of the product package in step (5) into a graph data structure to obtain a method call network of the product package;

[0155] (7) The external interface to be called is filtered from the method call network according to the specific annotation (@FeignClient);

[0156] (8) Obtain the calling relationship from the API interface of all product packages to the external interface through the graph algorithm;

[0157] Execute steps (1) to (8) for all product packages in the system group, that is, obtain the calling relationship from the API interface of all product packages to the external interface, and obtain the interface calling relationship graph based on the calling relationship from the API interface of all product packages to the external interface. Then, the calling links of each interface can be obtained according to the interface calling relationship graph.

[0158] This application can obtain the methods and interfaces contained in each class through the bytecode file, and further obtain the method called by each method. In this way, a method call link of a software product package can be constructed (which can be understood as the call path described above), and then the annotations can be used to identify which methods are the Restful interfaces (i.e., service interfaces) of this software product package and which are external interfaces. By searching the links, all interface call relationships can be obtained; such a scan is performed on all services of the system group to obtain the interface call relationship graph, and then the interface call link is obtained based on the interface call relationship graph. This application obtains the interface-level call link through bytecode parsing and method call links, accurately identifies the impact of interface changes, and does not rely on microservice operation. It can be identified in advance in the development and testing environment to avoid abnormal problems caused by changes to a certain interface affecting the downstream.

[0159] Reference Figure 7 , is a schematic diagram of a structure of an interface call link acquisition device provided in an embodiment of the present application, the device is used to support the specific implementation of the interface call link acquisition method described above. The device can be set in a processor or a server, and the specific description is as follows.

[0160] A first determining unit 401 is used to determine each software product package to be processed;

[0161] A first acquisition unit 402 is used to acquire each bytecode file of each software product package;

[0162] The second determining unit 403 is used to determine, for each software product package, interface calling relationship information of the software product package by applying each bytecode file of the software product package, wherein the interface calling relationship information includes calling relationships between each service interface of the software product package and each external interface called by the software product package;

[0163] A generating unit 404, configured to generate an interface calling relationship graph based on the interface calling relationship information of each of the software product packages;

[0164] The second acquisition unit 405 is used to acquire each interface call link based on the interface call relationship graph.

[0165] In the device provided in the embodiment of the present application, each software product package to be processed is determined; each bytecode file of each software product package is obtained; for each software product package, each bytecode file of the software product package is applied to determine the interface call relationship information of the software product package, wherein the interface call relationship information includes the call relationship between each service interface of the software product package and each external interface called by the software product package; based on the interface call relationship information of each software product package, an interface call relationship graph is generated; based on the interface call relationship graph, each interface call link is obtained. The present application determines the interface call relationship information through the bytecode file of the software product package, and then uses the interface call relationship information to construct an interface call relationship graph, and finally obtains each interface call link. The application of the present application can obtain the interface-level call call link, which is convenient for developers to determine the impact range of the adjusted interface during the development stage, and then adjust the interface within the impact range, which reduces the difficulty of the developer's work and improves the developer's work efficiency.

[0166] In the device provided in another embodiment of the present application, the first acquisition unit 402 of the device executes a process of acquiring each bytecode file of each software product package, including:

[0167] For each of the software product packages, obtain each jar package in the software product package;

[0168] Parse each of the jar packages to obtain the bytecode files in each of the jar packages.

[0169] In the device provided in another embodiment of the present application, the second determining unit 403 of the device executes the process of applying each bytecode file of the software product package to determine the interface call relationship information of the software product package, including:

[0170] Obtain each service interface and each method in each of the bytecode files;

[0171] Applying each of the service interfaces and each of the methods to generate a method call network, the method call network includes a plurality of call paths, the starting node of the call path is the service interface; there is at least one call path including an external interface in the method call network;

[0172] Determine a call path including an external interface in the method call network as a target call path;

[0173] For each of the target call paths, establishing a call relationship between an external interface in the target call path and a service interface as a starting node in the target call link;

[0174] Based on the calling relationships of the software product package, interface calling relationship information of the software product package is generated.

[0175] In the device provided in another embodiment of the present application, the second determination unit 403 of the device executes a process of applying each of the service interfaces and each method to generate a method call network, including:

[0176] Apply each of the service interfaces and each method to establish a call pool;

[0177] For each of the service interfaces, taking the service interface as a starting node, and determining whether the service interface has a first call object, the first call object being an external interface or a method in the call pool;

[0178] When the service interface has a first call object, a path relationship between the service interface and the first call object is established; when the first call object is a method in the call pool, the first call object is used as a path node; when the first call object is an external interface, the first call object is used as an end node;

[0179] For each of the path nodes, determining whether a method in the path node has a second call object, where the second call object is an external interface or a method in the call pool;

[0180] When the path node has a second call object, a path relationship between the path node and the second call object is established; when the second call object is a method in the call pool, the second call object is used as a new path node, and the step of determining whether the method in the path node has a second call object is returned to each path node; when the second call object is an external interface, the second call object is determined as an end node;

[0181] When the path node does not have a second calling object, determining the path node as an end node;

[0182] For each of the service interfaces, after obtaining each end node, obtaining each calling path of the service interface;

[0183] Based on each of the calling paths, a method calling network is obtained.

[0184] In the device provided in another embodiment of the present application, the generating unit 404 of the device performs a process of generating an interface calling relationship graph based on the interface calling relationship information of each software product package, including:

[0185] Obtaining each calling relationship in each of the interface calling relationship information;

[0186] Based on each of the calling relationships, an interface calling relationship graph is constructed.

[0187] In a device provided in another embodiment of the present application, the device further includes:

[0188] A third determining unit, configured to determine a target interface when receiving the interface modification information;

[0189] A fourth determining unit, configured to determine an interface call link including the target interface;

[0190] A generating unit is used to generate the impact interface information of the target interface based on the interface call link including the target interface.

[0191] An embodiment of the present invention further provides a storage medium, which includes stored instructions, wherein when the instructions are executed, the device where the storage medium is located is controlled to execute the above-mentioned method for obtaining the interface call link.

[0192] The embodiment of the present invention further provides an electronic device, the structural diagram of which is shown in FIG. Figure 8 As shown, it specifically includes a memory 601 and one or more instructions 602, wherein the one or more instructions 602 are stored in the memory 601 and are configured to be executed by one or more processors 603 to execute the one or more instructions 602 to execute the above-mentioned interface call link acquisition method.

[0193] It should be noted that the information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.

[0194] The specific implementation processes and derivative methods of the above-mentioned embodiments are all within the protection scope of the present invention.

[0195] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can refer to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without creative work.

[0196] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0197] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for obtaining an interface call link, characterized in that: include: Identify the software artifact packages to be processed; Obtaining each bytecode file of each software product package; For each software product package, applying each bytecode file of the software product package to determine interface call relationship information of the software product package, wherein the interface call relationship information includes a call relationship between each service interface of the software product package and each external interface called by the software product package; generating an interface call relationship graph based on the interface call relationship information of each of the software product packages; Based on the interface call relationship graph, each interface call link is obtained.

2. The method according to claim 1, characterized in that The obtaining of each bytecode file of each software product package includes: For each software product package, obtain each jar package in the software product package; Parse each of the jar packages to obtain the bytecode files in each of the jar packages.

3. The method according to claim 1, characterized in that The applying each bytecode file of the software product package to determine the interface call relationship information of the software product package includes: Obtain each service interface and each method in each bytecode file; Applying each of the service interfaces and each method to generate a method call network, the method call network including multiple call paths, the starting nodes of the call paths being the service interfaces; and at least one call path including an external interface in the method call network; Determining a call path including an external interface in the method call network as a target call path; For each target call path, establishing a call relationship between the external interface in the target call path and the service interface serving as the starting node in the target call link; Based on the calling relationships of the software product package, interface calling relationship information of the software product package is generated.

4. The method according to claim 3, characterized in that The application of each of the service interfaces and methods to generate a method call network includes: Apply each of the service interfaces and methods to establish a call pool; For each of the service interfaces, the service interface is used as a starting node, and it is determined whether the service interface has a first call object, where the first call object is an external interface or a method in the call pool; When the service interface has a first call object, a path relationship is established between the service interface and the first call object. When the first call object is a method in the call pool, the first call object is used as a path node; when the first call object is an external interface, the first call object is used as an end node. For each of the path nodes, determining whether a method in the path node has a second call object, where the second call object is an external interface or a method in the call pool; When a second call object exists at the path node, a path relationship is established between the path node and the second call object; when the second call object is a method in the call pool, the second call object is used as a new path node, and the process returns to the step of determining, for each path node, whether the method in the path node has a second call object; when the second call object is an external interface, the second call object is determined as an end node; When the path node does not have a second calling object, determining the path node as an end node; For each of the service interfaces, after obtaining each end node, obtaining each call path of the service interface; Based on each of the calling paths, a method calling network is obtained.

5. The method according to claim 3, characterized in that The generating of an interface call relationship graph based on the interface call relationship information of each software product package includes: Obtaining each calling relationship in each of the interface calling relationship information; Based on each of the calling relationships, an interface calling relationship graph is constructed.

6. The method according to claim 1, wherein Also includes: When receiving interface modification information, determining the target interface; Determining an interface call link including the target interface; Based on the interface call link including the target interface, the impact interface information of the target interface is generated.

7. A device for obtaining an interface call link, characterized in that: include: A first determining unit, configured to determine each software product package to be processed; A first acquiring unit, configured to acquire each bytecode file of each software product package; a second determining unit configured to determine, for each software product package, interface call relationship information of the software product package by applying each bytecode file of the software product package, wherein the interface call relationship information includes a call relationship between each service interface of the software product package and each external interface called by the software product package; A generating unit, configured to generate an interface call relationship graph based on the interface call relationship information of each of the software product packages; The second acquisition unit is used to acquire each interface call link based on the interface call relationship graph.

8. The device according to claim 7, characterized in that The first acquiring unit executes a process of acquiring each bytecode file of each software product package, including: For each software product package, obtain each jar package in the software product package; Parse each of the jar packages to obtain the bytecode files in each of the jar packages.

9. A storage medium, characterized in that: The storage medium includes stored instructions, wherein when the instructions are executed, the device where the storage medium is located is controlled to execute the method for obtaining the interface call link according to any one of claims 1 to 6.

10. An electronic device, characterized in that: It includes a memory and one or more instructions, wherein the one or more instructions are stored in the memory and are configured to be executed by one or more processors to execute the method for obtaining the interface call link as described in any one of claims 1-6.