Micro-service interface management method and device, electronic equipment and storage medium
By registering a front-end gateway on the interface management platform, identifying and crawling microservice interfaces, and performing reusability evaluation and unified management, the problem of inefficient microservice interface management is solved, and more efficient interface management and maintenance is achieved.
Patent Information
- Application Number
- CN202411753863.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-03-25
AI Technical Summary
The existing technology cannot effectively manage microservice interfaces, resulting in inefficient management.
By registering the front-end gateway on the interface management platform, obtaining configuration information, identifying the programming language of the microservice unit, grabbing the microservice interface, and performing reusability evaluation and unified management.
It improves the management efficiency of microservice interfaces, enhances the flexibility and adaptability of the system, and simplifies the maintenance process.
Smart Images

Figure CN119690547A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, is applicable to the financial field, and in particular, to a management method, device, electronic device and storage medium for a microservice interface. Background Art
[0002] With the rapid development of computer technology, building a microservice system based on business needs can support functions such as shopping, social networking, interactive games, and resource transfer. For example, in a financial scenario, an interface call is made to a financial microservice system, and the corresponding query interface is called through the front-end gateway to analyze the user's query request to complete the asset data viewing function, and the interface cannot be managed accordingly. The financial microservice system can also have functions such as applying for loans, credit cards, or purchasing insurance and financial products. At present, the management method of microservice interfaces usually uses a front-end gateway for simple routing, and the front-end gateway can only manage external call interfaces, and cannot uniformly manage microservice interfaces, resulting in low management efficiency. Therefore, how to improve the management efficiency of microservice interfaces has become a technical problem that needs to be solved urgently. Summary of the invention
[0003] The main purpose of the embodiments of the present application is to propose a microservice interface management method, device, electronic device and storage medium, aiming to improve the management efficiency of the microservice interface.
[0004] To achieve the above purpose, an embodiment of the present application proposes a method for managing a microservice interface, which is applied to an interface management platform, and the interface management platform is deployed in a microservice system, and the microservice system also includes a front-end gateway and a microservice unit. The method includes:
[0005] Register the front-end gateway to obtain configuration information;
[0006] Perform programming language recognition processing on the microservice unit according to the configuration information to obtain a programming language recognition result;
[0007] Performing interface capture processing on the microservice unit according to the programming language recognition result to obtain a microservice interface;
[0008] A reusability evaluation process is performed on the microservice interface, and the microservice interface is uniformly managed according to the reusability evaluation result.
[0009] In some embodiments, the registering the front-end gateway to obtain configuration information includes:
[0010] In response to a gateway registration request initiated by the front-end gateway, a network connection channel is established with the front-end gateway, and configuration registration processing is performed on the front-end gateway through the network connection channel to obtain a configuration registration result;
[0011] The configuration registration result is parsed to obtain the configuration information.
[0012] In some embodiments, performing programming language recognition processing on the microservice unit according to the configuration information to obtain a programming language recognition result includes:
[0013] Performing service discovery processing on the microservice unit according to the configuration information to obtain a service discovery result;
[0014] According to the service discovery result, information is pulled from the microservice unit to obtain microservice information;
[0015] Perform programming language recognition processing on the microservice information to obtain the programming language recognition result.
[0016] In some embodiments, performing programming language recognition processing on the microservice information to obtain the programming language recognition result includes:
[0017] Inputting the microservice information into a programming language recognition model;
[0018] The programming language recognition model is used to extract local features and context information from the microservice information, and the extraction results are classified and predicted to obtain the programming language recognition result.
[0019] In some embodiments, performing interface capture processing on the microservice unit according to the programming language recognition result to obtain a microservice interface includes:
[0020] Selecting a corresponding code parsing tool according to the programming language recognition result;
[0021] Perform code conversion processing on the microservice unit according to the code parsing tool to obtain an abstract syntax tree;
[0022] Interface identification and extraction processing are performed on the abstract syntax tree to obtain the microservice interface.
[0023] In some embodiments, performing reusability evaluation on the microservice interface and uniformly managing the microservice interface according to the reusability evaluation result includes:
[0024] Performing programming evaluation on the design and implementation of the microservice interface to obtain a first evaluation result;
[0025] Generate a corresponding interface document according to the microservice interface, and perform document evaluation processing on the interface document to obtain a second evaluation result;
[0026] Performing simulation test processing on the microservice interface to obtain a third evaluation result;
[0027] Performing weighted statistical processing on the first evaluation result, the second evaluation result, and the third evaluation result to obtain the reusability evaluation result;
[0028] The microservice interface is optimized and adjusted according to the reusability evaluation result.
[0029] In some embodiments, the method further comprises:
[0030] In response to the microservice update request of the front-end gateway, positioning the microservice interface to obtain a target interface;
[0031] The target interface is modified, and the modified target interface is re-registered to the front-end gateway.
[0032] To achieve the above purpose, another aspect of the embodiment of the present application proposes a data analysis device, which is applied to the management method of the microservice interface as described above, and the device is applied to an interface management platform, and the interface management platform is deployed in a microservice system, and the microservice system also includes a front-end gateway and a microservice unit, and the device includes:
[0033] The first module is used to register the front-end gateway and obtain configuration information;
[0034] The second module is used to perform programming language recognition processing on the microservice unit according to the configuration information to obtain a programming language recognition result;
[0035] The third module is used to perform interface capture processing on the microservice unit according to the programming language recognition result to obtain a microservice interface;
[0036] The fourth module is used to perform reusability evaluation on the microservice interface and to uniformly manage the microservice interface according to the evaluation result.
[0037] In some embodiments, the first module is used to register the front-end gateway to obtain configuration information, including the following units:
[0038] The first unit is used to establish a network connection channel with the front-end gateway in response to a gateway registration request initiated by the front-end gateway, and perform configuration registration processing on the front-end gateway through the network connection channel to obtain a configuration registration result;
[0039] The second unit is used to parse the configuration registration result to obtain the configuration information.
[0040] In some embodiments, the second module is used to perform programming language recognition processing on the microservice unit according to the configuration information to obtain a programming language recognition result, including the following units:
[0041] A third unit is used to perform service discovery processing on the microservice unit according to the configuration information to obtain a service discovery result;
[0042] A fourth unit is used to perform information pulling processing on the microservice unit according to the service discovery result to obtain microservice information;
[0043] The fifth unit is used to perform programming language recognition processing on the microservice information to obtain the programming language recognition result.
[0044] In some embodiments, the sixth unit, used to perform programming language recognition processing on the microservice information to obtain the programming language recognition result, includes the following subunits:
[0045] A first subunit, configured to input the microservice information into a programming language recognition model;
[0046] The second subunit is used to extract local features and context information from the microservice information through the programming language recognition model, and perform classification prediction on the extraction results to obtain the programming language recognition result.
[0047] In some embodiments, the third module is used to perform interface capture processing on the microservice unit according to the programming language recognition result to obtain a microservice interface, and includes the following units:
[0048] A sixth unit is used to select a corresponding code parsing tool according to the programming language recognition result;
[0049] A seventh unit is used to perform code conversion processing on the microservice unit according to the code parsing tool to obtain an abstract syntax tree;
[0050] The eighth unit is used to perform interface identification and extraction processing on the abstract syntax tree to obtain the microservice interface.
[0051] In some embodiments, the fourth module is used to perform reusability evaluation processing on the microservice interface and uniformly manage the microservice interface according to the reusability evaluation result, and includes the following units:
[0052] A ninth unit is used to perform programming evaluation processing on the design mode and implementation mode of the microservice interface to obtain a first evaluation result;
[0053] A tenth unit is used to generate a corresponding interface document according to the microservice interface, perform document evaluation processing on the interface document, and obtain a second evaluation result;
[0054] An eleventh unit is used to perform a simulation test process on the microservice interface to obtain a third evaluation result;
[0055] A twelfth unit is used to perform weighted statistical processing on the first evaluation result, the second evaluation result and the third evaluation result to obtain the reusability evaluation result;
[0056] The thirteenth unit is used to optimize and adjust the microservice interface according to the reusability evaluation result.
[0057] In some embodiments, the apparatus further comprises:
[0058] The fifth module is used to respond to the microservice update request of the front-end gateway, locate the microservice interface, and obtain the target interface;
[0059] The sixth module is used to modify the target interface and re-register the modified target interface to the front-end gateway.
[0060] On the other hand, to achieve the above-mentioned purpose, an embodiment of the present application proposes an electronic device, which includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, it implements the management method of the microservice interface as described above.
[0061] On the other hand, to achieve the above-mentioned purpose, an embodiment of the present application proposes a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the management method of the microservice interface as described above.
[0062] The present application proposes a microservice interface management method, device, electronic device and storage medium, which obtains configuration information by registering the front-end gateway, performs programming language recognition processing on the microservice unit according to the configuration information, obtains the programming language recognition result, performs interface capture processing on the microservice unit according to the programming language recognition result, obtains the microservice interface, performs reusability evaluation processing on the microservice interface, and uniformly manages the microservice interface according to the reusability evaluation result. This solution can recognize multiple programming languages by uniformly managing the microservice interface, enhances the flexibility and adaptability of the system, and simplifies the maintenance process and improves management efficiency by centrally managing the microservice interface. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] Figure 1It is a schematic diagram of the system architecture of microservice interface management in related technologies;
[0064] Figure 2 This is a schematic diagram of a system architecture for microservice interface management provided by an embodiment of the present application;
[0065] Figure 3 It is a flow chart of a microservice interface management method provided in an embodiment of the present application;
[0066] Figure 4 yes Figure 3 Flow chart of step S301 in FIG.
[0067] Figure 5 yes Figure 3 Flow chart of step S302 in FIG.
[0068] Figure 6 yes Figure 3 Flow chart of step S303 in FIG.
[0069] Figure 7 yes Figure 3 Flow chart of step S304 in FIG.
[0070] Figure 8 It is a structural diagram of a microservice interface management device provided in an embodiment of the present application;
[0071] Fig. 9 It is a schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0072] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0073] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0074] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0075] First, some nouns involved in this application are analyzed:
[0076] Artificial intelligence (AI) is a new technical science that studies and develops theories, methods, technologies and application systems for simulating, extending and expanding human intelligence. AI is a branch of computer science that attempts to understand the essence of intelligence and produce a new type of intelligent machine that can respond in a similar way to human intelligence. Research in this field includes robotics, speech recognition, image recognition, natural language processing and expert systems. AI can simulate the information process of human consciousness and thinking. AI is also a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0077] Natural language processing (NLP): usually used by computers to process, understand and use human languages (such as Chinese, English, etc.). NLP is a branch of artificial intelligence, an interdisciplinary subject between computer science and linguistics, and is often referred to as computational linguistics. Natural language processing includes grammatical analysis, semantic analysis, and text understanding. Natural language processing is often used in technical fields such as machine translation, handwritten and printed character recognition, speech recognition and text-to-speech conversion, information intent recognition, information extraction and filtering, text classification and clustering, public opinion analysis and opinion mining. It involves data mining related to language processing, machine learning, knowledge acquisition, knowledge engineering, artificial intelligence research, and linguistic research related to language computing.
[0078] Microservices is a software architecture design pattern that decomposes an application into small, autonomous service units that can be independently deployed, expanded, and maintained. Each service unit is also a microservice.
[0079] Application Programming Interface (API) is a set of predefined functions that aims to provide applications and developers with the ability to access a set of routines based on certain software or hardware without having to access the source code or understand the details of the internal working mechanism. It is abstract in itself and only defines an interface without involving the specific operations of the application in the actual implementation process.
[0080] As described in the background technology section, in related technologies, the management method for microservice interfaces usually uses a front-end gateway for simple routing. However, the front-end gateway can only manage external call interfaces and cannot manage microservice interfaces in a unified manner, resulting in low management efficiency. Figure 1One method is to manage services A, B, C, and D separately by using the corresponding technology stack (e.g. Figure 1 As shown by the blue arrow in the figure, the goal of these technology stacks is to solve the API documentation issues of a single microservice, but they can only work on a single microservice and cannot achieve the ability to manage all APIs uniformly at the company level. Another method is to implement it at the company's traffic entry layer, generally on services such as entry gateways and enterprise gateways (such as Figure 1 The problem with this system is that it can only manage external call interfaces, but cannot achieve microservice-level API management.
[0081] Based on this, the embodiments of the present application provide a microservice interface management method, device, electronic device and storage medium, aiming to improve the efficiency of abnormal analysis of asset data.
[0082] The present application provides a microservice interface management method, device, electronic device and storage medium, which are specifically described by the following embodiments. First, the microservice interface management method in the present application embodiment is described. Figure 2 The management method of the microservice interface of the embodiment of the present application is applied to an interface management platform, and the interface management platform is deployed in a microservice system. The microservice system also includes a front-end gateway and a microservice unit. The front-end gateway is registered to obtain configuration information, and the microservice unit is identified in a programming language according to the configuration information to obtain a programming language identification result. The microservice unit is interface captured according to the programming language identification result to obtain a microservice interface, and the microservice interface is evaluated for reusability, and the microservice interface is uniformly managed according to the reusability evaluation result.
[0083] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0084] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0085] A management method for a microservice interface provided in an embodiment of the present application relates to the field of computer technology. A management method for a microservice interface provided in an embodiment of the present application can be applied to an interface management platform, which can be deployed in a microservice system, or can be software running in a microservice system, and the microservice system can be deployed on a terminal or server. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.; the server side can be configured as an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application that implements a management method for a microservice interface, etc., but is not limited to the above forms.
[0086] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0087] See also Figure 3 , Figure 3 is an optional flowchart of a microservice interface management method provided in an embodiment of the present application. Figure 3 The method may include but is not limited to steps S301 to S304.
[0088] Step S301, registering the front-end gateway to obtain configuration information;
[0089] Step S302, performing programming language recognition processing on the microservice unit according to the configuration information to obtain a programming language recognition result;
[0090] Step S303, performing interface capture processing on the microservice unit according to the programming language recognition result to obtain a microservice interface;
[0091] Step S304: perform reusability evaluation on the microservice interface, and uniformly manage the microservice interface according to the reusability evaluation result.
[0092] As shown in the steps S301 to S304 of the embodiment of the present application, the method is applied to the interface management platform, and the interface management and control platform is applied to the microservice system. The microservice system also includes a front-end gateway and a microservice unit, wherein the front-end gateway is used to receive external microservice call requests and route to the corresponding microservice unit through the microservice interface, and the microservice unit is used to provide application function services. The embodiment of the present application obtains configuration information by registering the front-end gateway, registers the front-end gateway to the interface management platform, and obtains the corresponding configuration information obtained according to the registration result, and the configuration information includes a gateway address, a routing table, etc. Then, according to the configuration information, the microservice unit is subjected to programming language recognition processing to obtain a programming language recognition result, the corresponding microservice unit information is obtained through the configuration information, the microservice unit information is subjected to programming language recognition, and the corresponding tool is called according to the recognition result to perform interface capture processing on the microservice unit to obtain a microservice interface. Finally, the microservice interface is subjected to reusability evaluation processing, and the microservice interface is uniformly managed according to the reusability evaluation result, which can ensure the consistency of the interface management style and process and improve the management efficiency of the microservice interface.
[0093] See also Figure 4 In step S301 of some embodiments, the registering process of the front-end gateway to obtain configuration information includes:
[0094] Step S401, responding to a gateway registration request initiated by the front-end gateway;
[0095] Step S402, establishing a network connection channel with the front-end gateway according to the gateway registration request, and performing configuration registration processing on the front-end gateway through the network connection channel to obtain a configuration registration result;
[0096] Step S403: parse the configuration registration result to obtain the configuration information.
[0097] In an embodiment of the present application, by registering the front-end gateway to the interface management platform, the front-end gateway information and microservice unit information can be obtained through the interface management platform. By analyzing the microservice unit information to obtain the microservice interface, the microservice interface can be better managed in a unified manner.
[0098] In step S401 of some embodiments, a gateway registration request is responded to by the front-end gateway.
[0099] In an embodiment of the present application, the front-end gateway initiates a gateway registration request to the interface management platform, and the gateway can provide an HTTP registration interface to the outside world to realize the registration and persistence of gateway groups, gateway computing power and microservices. The front-end gateway initiates a gateway registration request through the HTTP registration interface, thereby registering the gateway information to the interface management platform according to the gateway registration request, so that the interface management platform can obtain the interface information of the microservice unit according to the configuration information provided by the front-end gateway and uniformly manage the microservice interface.
[0100] In step S402 of some embodiments, a network connection channel is established with the front-end gateway according to the gateway registration request, and configuration registration processing is performed on the front-end gateway through the network connection channel to obtain a configuration registration result.
[0101] In an embodiment of the present application, the front-end gateway registers the front-end gateway to the interface management platform through a gateway registration request. After receiving the gateway registration request, the front-end gateway parses the request and establishes a network connection channel according to the parsing result. Among them, the gateway registration request includes a unique identifier of the gateway, which can be an IP address, a MAC address, or a custom gateway ID, so that other devices or services in the network can identify and locate the gateway. According to the specific network environment and requirements, the registration request may also include some additional configuration information, such as routing rules, load balancing strategies, security strategies, etc. Then, a network connection channel between the front-end gateway and the interface management platform is established according to the corresponding identifier, and the gateway registration result is returned through the network connection channel. The gateway registration result may include a response status code, service response data, and a service request message, etc. Specifically, the gateway registration business group ID, gateway computing power ID, gateway name, gateway IP address, and other information are obtained from the analysis of the gateway registration result. The information service class is called with the gateway ID and IP address as the index to obtain the detailed information of the gateway. If the gateway configuration information does not exist, the gateway registration information is directly persisted to complete the gateway registration. The front-end gateway will register the corresponding configuration information to the interface management platform according to the gateway registration result. The interface management platform receives the configuration registration result, which includes the configuration information.
[0102] In step S403 of some embodiments, the configuration registration result is parsed to obtain the configuration information.
[0103] In the embodiment of the present application, the configuration registration result is parsed to obtain configuration information, which includes gateway IP address information, routing table, microservice information table, microservice interface configuration table, microservice application details and service call parameter details table, etc. It can be imagined that the microservice is registered to the front-end gateway, and the corresponding routing table and microservice information are established in the front-end gateway. In the embodiment of the present application, the microservice can also be registered to the interface management platform according to the configuration information, and the corresponding microservice registration processing can be performed according to the actual situation.
[0104] One of the above technical solutions has the following advantages or beneficial effects: the embodiment of the present application obtains configuration information by registering the front-end gateway, and can obtain the corresponding microservice interface information based on the configuration information, thereby uniformly managing the microservice interface according to the information, thereby improving the management efficiency of the microservice interface.
[0105] See also Figure 5 In step S302 of some embodiments, the step of performing programming language recognition processing on the microservice unit according to the configuration information to obtain a programming language recognition result includes:
[0106] Step S501, performing service discovery processing on the microservice unit according to the configuration information to obtain a service discovery result;
[0107] Step S502, performing information pulling processing on the microservice unit according to the service discovery result to obtain microservice information;
[0108] Step S503: Perform programming language recognition processing on the microservice information to obtain the programming language recognition result.
[0109] In an embodiment of the present application, a programming language recognition result is obtained by performing programming language recognition processing on the microservice unit according to configuration information through an interface management platform. The microservice unit information can be obtained through the configuration information. The microservice unit information may include programming language information of the microservice unit. The programming language used by the microservice unit can be identified by querying the programming language information. The programming language recognition result can also be obtained by performing code recognition processing on the microservice unit and obtaining the programming language type of the microservice unit through artificial intelligence technology.
[0110] In step S501 of some embodiments, service discovery is performed on the microservice unit according to the configuration information, wherein the configuration information is the information obtained when the service is registered, and may include basic information of the service, such as the service name, network address, etc. In the embodiment of the present application, service discovery can be performed on the microservice unit through a service discovery tool, such as Nacos, Eureka, Consul and other service discovery tools. Therefore, the configuration information may also introduce the dependency of the service discovery tool so that the microservice can communicate with the service discovery tool, and may also include configuration requirements for the selected tool, such as setting the address, port and other basic information of the service discovery tool. It is conceivable that the configuration information may also include parameters related to configuration service registration and discovery, such as a heartbeat mechanism, registration and deregistration policies of service instances, etc. In a feasible embodiment, the consumer of the service, i.e., the interface management platform, subscribes to the required service from the service discovery tool. This is usually achieved by sending a subscription request, which includes information such as the name and version of the required service. The service discovery tool returns a list of available service instances based on the information in the subscription request, and this list includes the network addresses and other relevant information of all service instances that meet the subscription conditions. Therefore, the interface management platform can obtain the network addresses and other related information of multiple available service instances, which is the result of service discovery. The service instance addresses can also be used to call the required services.
[0111] In step S502 of some embodiments, information is pulled from the microservice unit according to the service discovery result to obtain microservice information. The interface management platform can perform data analysis on the service discovery result, and pull information from the service discovery result to obtain the network address and other related information of the service instance. Information pulling refers to purposeful information query, that is, querying the information about the microservice unit in the service discovery result through the interface management platform, and information can be pulled from the service discovery result through keyword search to obtain microservice information. The microservice information may include the network address of the microservice, the code file of the microservice, etc.
[0112] In step S503 of some embodiments, the microservice information is processed for programming language recognition to obtain a programming language recognition result. Among them, the microservice information may include the code file of the microservice and other contents, and the programming language recognition result can be obtained by performing programming language recognition on the code file through a neural network model, for example, it is recognized that the code file of the microservice is written in C language. The embodiment of the present application can also store the programming language information of the microservice in the microservice information in advance, and the programming language used to write the microservice can be obtained by keyword recognition and matching. It is conceivable that the microservice deployed in a distributed system can be written in different programming languages. Therefore, when managing the microservice interface, it is necessary to identify the programming language used by the microservice, so as to perform code recognition and capture of the microservice according to the programming language to obtain the corresponding microservice interface.
[0113] One of the above technical solutions has the following advantages or beneficial effects: the embodiment of the present application obtains a programming language recognition result by performing programming language recognition processing on the microservice unit according to the configuration information, and can analyze the configuration information to obtain the programming language used by the microservice unit, so that the microservice interface can be captured and the code analyzed according to the programming language, and the microservice interface can be uniformly managed according to the analysis result, thereby improving the management efficiency of the microservice interface.
[0114] In step S503 of some embodiments, performing programming language recognition processing on the microservice information to obtain the programming language recognition result includes:
[0115] Inputting the microservice information into a programming language recognition model;
[0116] The programming language recognition model is used to extract local features and context information from the microservice information, and the extraction results are classified and predicted to obtain the programming language recognition result.
[0117] In an embodiment of the present application, a programming language recognition model can be pre-trained, and the programming language recognition processing of microservice information is performed through the trained programming language recognition model to obtain a programming language recognition result. Among them, the programming language recognition model can be constructed using deep learning models such as convolutional neural networks and recurrent neural networks, and by learning the grammatical rules, keywords and common coding patterns of the programming language, accurate recognition of different programming languages can be achieved. The microservice information is processed by extracting local features and context information through the programming language recognition model, and the programming language is analyzed and identified at different levels, wherein the local features can be extracted for keywords, identifier naming rules, code block delimiters and statement terminators in the code file, and the extracted features can be classified and predicted by a naive Bayes classifier to obtain a programming language recognition result.
[0118] One of the above technical solutions has the following advantages or beneficial effects: the embodiment of the present application analyzes the microservice information through a neural network model to obtain the programming language used by the microservice unit, so that the microservice interface can be captured and the code analyzed according to the programming language, and the microservice interface can be uniformly managed according to the analysis results, thereby improving the management efficiency of the microservice interface.
[0119] See also Figure 6 In step S303 of some embodiments, the language recognition result is used to perform interface capture processing on the microservice unit to obtain a microservice interface, including:
[0120] Step S601, selecting a corresponding code parsing tool according to the programming language recognition result;
[0121] Step S602, performing code conversion processing on the microservice unit according to the code parsing tool to obtain an abstract syntax tree;
[0122] Step S603: performing interface identification and extraction processing on the abstract syntax tree to obtain the microservice interface.
[0123] In step S601 of some embodiments, a corresponding code parsing tool is selected according to the programming language recognition result. The programming language recognition result may include programming languages such as Python, Java, and Javascript. The corresponding code parsing tool is selected according to the recognized programming language to automatically analyze and parse the code.
[0124] In step S602 of some embodiments, the code conversion process of the microservice unit is performed according to the code parsing tool to obtain an abstract syntax tree. The embodiment of the present application performs grammatical analysis on the code file of the microservice unit through the code parsing tool, and converts the character stream of the source code into a series of tags or lexical units, and the lexical units include keywords, variable names, literals (such as numbers, strings), operators and separators, etc. Specifically, the embodiment of the present application can read the character stream of the source code, combine the characters into tags according to predefined lexical rules, and ignore the blank characters and comments in the source code, and output a tag sequence, each of which contains its type and value. Then read the tag sequence through a grammatical analyzer, combine the tags into grammatical structures according to the grammatical rules of the programming language, and finally construct a tree structure to represent these grammatical structures, wherein each node corresponds to a grammatical element, such as a variable, an operator, a function, etc., and the connection relationship between the nodes reflects the hierarchy and nested relationship between the grammatical elements.
[0125] In step S603 of some embodiments, the abstract syntax tree is subjected to interface identification and extraction processing to obtain a microservice interface. The embodiment of the present application can identify different syntax elements in the source code, such as classes, methods, variables, etc., by traversing the nodes of the abstract syntax tree. Then, during the traversal process, nodes related to the interface are screened out, and the controller and interface in the microservice can be identified by identifying the annotated classes and methods. Finally, for the identified interface-related nodes, key information is extracted, such as interface name, path, request method, parameter type, return value type, etc., to obtain the microservice interface.
[0126] One of the above technical solutions has the following advantages or beneficial effects: the embodiment of the present application captures the interface of the microservice unit according to the programming language recognition result to obtain the microservice interface, so that the microservice interface can be identified, which facilitates the unified management of the microservice interface and improves the management efficiency of the microservice interface.
[0127] See also Figure 7 In step S304 of some embodiments, the performing reusability evaluation on the microservice interface and uniformly managing the microservice interface according to the reusability evaluation result includes:
[0128] Step S701, performing programming evaluation processing on the design mode and implementation mode of the microservice interface to obtain a first evaluation result;
[0129] Step S702, generating a corresponding interface document according to the microservice interface, performing document evaluation processing on the interface document, and obtaining a second evaluation result;
[0130] Step S703, performing simulation test processing on the microservice interface to obtain a third evaluation result;
[0131] Step S704, performing weighted statistical processing on the first evaluation result, the second evaluation result and the third evaluation result to obtain the reusability evaluation result;
[0132] Step S705: Optimize and adjust the microservice interface according to the reusability evaluation result.
[0133] In step S701 of some embodiments, the design and implementation of the microservice interface are programmed and evaluated to obtain a first evaluation result, and the specifications and standards of the microservice interface are specifically evaluated, such as evaluating whether the interface complies with standardized interface specifications, such as the Dubbo interface specification, and checking whether the interface naming, URL structure, request parameters, response format, etc. comply with the specifications. It is also possible to evaluate whether the interface follows the single responsibility principle, that is, each interface is only responsible for a specific business function, and check whether the interface provides the necessary business functions while avoiding unnecessary complexity. The embodiment of the present application can determine an evaluation score based on each inspection content, thereby summing each evaluation score to obtain a first evaluation result.
[0134] In step S702 of some embodiments, the corresponding interface document can be generated according to the microservice interface through Swagger and other automated tools, and the automated tool will automatically generate an online interface document in a standard format according to the annotations in the interface. Then the interface document is evaluated, and the integrity, parameter description, return value description, etc. in the interface document are evaluated to check whether the interface document covers all necessary interfaces, and verify whether the parameter description in the interface document is specific and accurate enough. The embodiment of the present application can check the interface document item by item according to the evaluation content, and record the problems and omissions found. It can also write test cases according to the description of the interface document for actual testing to verify the accuracy of the document, thereby obtaining a second evaluation result.
[0135] In step S703 of some embodiments, a simulation test is performed on the microservice interface to obtain a third evaluation result. A test environment similar to the production environment can be built in advance, and corresponding test data can be prepared according to the test target, and the test target is the tested microservice interface and its function. Then, a simulation framework is used to simulate the microservice interface to verify the method call sequence and provide the return value required by the test application. By writing a corresponding test script and executing it in the test environment, observing the response of the interface, and analyzing the performance and stability of the interface according to the test results, the third evaluation result is obtained.
[0136] In step S704 of some embodiments, the first evaluation result is the evaluation score obtained by evaluating the design and implementation of the microservice interface, the second evaluation result is the evaluation score obtained by evaluating the interface document, and the third evaluation result is the evaluation score obtained by simulating the microservice interface. Then, a weight factor is assigned to each evaluation result according to the actual situation, and the sum of each assigned weight factor is 1. Finally, the evaluation scores of the evaluation results are weighted and statistically analyzed according to the weight factor to obtain the final reusability evaluation result.
[0137] In step S705 of some embodiments, the degree of reuse of each microservice interface is determined based on the reusability evaluation results, and the reasons for low reusability or non-reuse of interfaces are analyzed, such as unreasonable interface design, redundant functions, complex calls, etc., and then the interfaces are reconstructed according to the reasons, and the interface calling process is simplified and the interfaces with similar functions are merged. Optimization and adjustment processing such as implementing a caching mechanism for frequently called interfaces can also be implemented, so as to uniformly manage the microservice interfaces.
[0138] One of the above technical solutions has the following advantages or beneficial effects: The embodiment of the present application uniformly manages the microservice interface according to the reusability evaluation results, and can improve the overall performance and stability of the system by reconstructing the microservice interface, simplifying the calling process and other optimization adjustments.
[0139] In some embodiments, the method further comprises:
[0140] In response to the microservice update request of the front-end gateway, positioning the microservice interface to obtain a target interface;
[0141] The target interface is modified, and the modified target interface is re-registered to the front-end gateway.
[0142] In the embodiment of the present application, the front-end gateway registers and calls the microservice interface. When the microservice needs to be updated, the microservice update request is sent to the interface management platform through the front-end gateway. The interface management platform performs request parsing on the microservice update request, thereby obtaining the network address of the microservice that needs to be updated and locating the target interface. Then, the target interface is modified, the code of the target interface can be modified, and the modified interface is re-registered with the front-end gateway.
[0143] One of the above technical solutions has the following advantages or beneficial effects: the embodiment of the present application modifies the interface according to the interface management platform and re-registers it to the front-end gateway, and can uniformly manage the microservice interface through the interface management platform to improve the maintainability of the system.
[0144] The following is a detailed description of the embodiments of the present invention with reference to specific application examples:
[0145] The embodiment of the present application can be applied to the field of computer technology, suitable for the financial field, and specifically applied to the scene of interface management of microservice system. For example, a financial microservice system includes multiple microservice units, each of which is used to apply for loans, credit cards or purchase insurance, financial products and other functions, and can be called through the microservice interface. The microservice system can also be an insurance system, a banking system, a trading system, and an order system. The embodiment of the present application manages the microservice interface uniformly through the interface management platform, obtains the corresponding configuration information by registering the front-end gateway to the interface management platform, and the configuration information includes the registration information of the microservice unit to the front-end gateway, and then performs programming language identification processing on the microservice unit according to the configuration information, identifies the programming language used by each microservice unit, and performs code parsing on the microservice unit according to the identified programming language to capture the corresponding microservice interface. Finally, the captured microservice interface is evaluated for reusability, and the microservice interface is uniformly managed according to the reusability evaluation result, and the microservice interface can be adjusted and managed by interface reconstruction, interface caching, asynchronous communication, etc.
[0146] See also Figure 8 The embodiment of the present application also provides a management device for a microservice interface, which can implement the above-mentioned management method for a microservice interface. The device is applied to an interface management platform, and the interface management platform is deployed in a microservice system. The microservice system also includes a front-end gateway and a microservice unit. The device includes:
[0147] The first module 801 is used to register the front-end gateway and obtain configuration information;
[0148] The second module 802 is used to perform programming language recognition processing on the microservice unit according to the configuration information to obtain a programming language recognition result;
[0149] The third module 803 is used to perform interface capture processing on the microservice unit according to the programming language recognition result to obtain a microservice interface;
[0150] The fourth module 804 is used to perform reusability evaluation on the microservice interface and to uniformly manage the microservice interface according to the evaluation result.
[0151] It can be understood that the contents of the above method embodiments are all applicable to the present device embodiments, the functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0152] The embodiment of the present application also provides an electronic device, the electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the above-mentioned microservice interface management method when executing the computer program. The electronic device can be any smart terminal including a tablet computer, a car computer, etc.
[0153] See also Fig. 9 , Fig. 9 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:
[0154] The processor 901 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;
[0155] The memory 902 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 902 can store an operating system and other applications. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 902, and the processor 901 calls and executes a microservice interface management method of the embodiment of the present application;
[0156] Input / output interface 903, used to implement information input and output;
[0157] Communication interface 904, used to realize communication interaction between the device and other devices, which can be realized by wired mode (such as USB, network cable, etc.) or wireless mode (such as mobile network, WIFI, Bluetooth, etc.);
[0158] A bus 905 that transmits information between various components of the device (e.g., the processor 901, the memory 902, the input / output interface 903, and the communication interface 904);
[0159] The processor 901 , the memory 902 , the input / output interface 903 and the communication interface 904 are connected to each other in communication within the device via a bus 905 .
[0160] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the above-mentioned microservice interface management method.
[0161] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0162] The embodiment of the present application provides a management method, device, electronic device and storage medium for a microservice interface, which obtains configuration information by registering the front-end gateway, performs programming language recognition processing on the microservice unit according to the configuration information, obtains the programming language recognition result, performs interface capture processing on the microservice unit according to the programming language recognition result, obtains the microservice interface, performs reusability evaluation processing on the microservice interface, and uniformly manages the microservice interface according to the reusability evaluation result. This solution can identify multiple programming languages by uniformly managing the microservice interface, enhance the flexibility and adaptability of the system, and simplifies the maintenance process and improves management efficiency by centrally managing the microservice interface. The embodiment of the present application can also realize the unified management of the front-end and back-end systems through the interface management platform, ensure the consistency of the management style and process of the microservice interface, and improve management efficiency. It also supports multiple mainstream development languages, enhances the flexibility and adaptability of the system, and can cover multiple systems of the company. It can also provide detailed viewing of the microservice interface and repeated function reminders through the interface management platform, promote the reuse of microservice interfaces at the company level, reduce repeated development, and improve resource utilization. The embodiment of the present application uses a unified interface management platform to promote collaboration between teams, reduce communication costs, and speed up development progress. It also simplifies the maintenance process by centrally managing microservice interfaces, facilitates rapid location and resolution of problems, and improves the maintainability of the system.
[0163] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0164] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0165] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0166] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0167] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0168] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0169] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0170] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0171] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0172] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.
[0173] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.
Claims
1. A method for managing a microservice interface, characterized in that: The method is applied to an interface management platform, the interface management platform is deployed in a microservice system, the microservice system further includes a front-end gateway and a microservice unit, and the method includes: Register the front-end gateway to obtain configuration information; Perform programming language recognition processing on the microservice unit according to the configuration information to obtain a programming language recognition result; Performing interface capture processing on the microservice unit according to the programming language recognition result to obtain a microservice interface; A reusability evaluation process is performed on the microservice interface, and the microservice interface is uniformly managed according to the reusability evaluation result.
2. The method according to claim 1, characterized in that: The registering process of the front-end gateway to obtain configuration information includes: In response to a gateway registration request initiated by the front-end gateway, a network connection channel is established with the front-end gateway, and configuration registration processing is performed on the front-end gateway through the network connection channel to obtain a configuration registration result; The configuration registration result is parsed to obtain the configuration information.
3. The method according to claim 1, characterized in that The performing programming language recognition processing on the microservice unit according to the configuration information to obtain a programming language recognition result includes: Performing service discovery processing on the microservice unit according to the configuration information to obtain a service discovery result; According to the service discovery result, information is pulled from the microservice unit to obtain microservice information; Perform programming language recognition processing on the microservice information to obtain the programming language recognition result.
4. The method according to claim 3, characterized in that The performing programming language recognition processing on the microservice information to obtain the programming language recognition result includes: Inputting the microservice information into a programming language recognition model; The programming language recognition model is used to extract local features and context information from the microservice information, and the extraction results are classified and predicted to obtain the programming language recognition result.
5. The method according to claim 1, characterized in that The performing interface capture processing on the microservice unit according to the programming language recognition result to obtain a microservice interface includes: Selecting a corresponding code parsing tool according to the programming language recognition result; Perform code conversion processing on the microservice unit according to the code parsing tool to obtain an abstract syntax tree; Interface identification and extraction processing are performed on the abstract syntax tree to obtain the microservice interface.
6. The method according to claim 1, characterized in that The performing reusability evaluation on the microservice interface and uniformly managing the microservice interface according to the reusability evaluation result includes: Performing programming evaluation on the design and implementation of the microservice interface to obtain a first evaluation result; Generate a corresponding interface document according to the microservice interface, and perform document evaluation processing on the interface document to obtain a second evaluation result; Performing simulation test processing on the microservice interface to obtain a third evaluation result; Performing weighted statistical processing on the first evaluation result, the second evaluation result, and the third evaluation result to obtain the reusability evaluation result; The microservice interface is optimized and adjusted according to the reusability evaluation result.
7. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: In response to the microservice update request of the front-end gateway, positioning the microservice interface to obtain a target interface; The target interface is modified, and the modified target interface is re-registered to the front-end gateway.
8. A management device for a microservice interface, characterized in that: The device is applied to an interface management platform, the interface management platform is deployed in a microservice system, the microservice system further includes a front-end gateway and a microservice unit, and the device includes: The first module is used to register the front-end gateway and obtain configuration information; The second module is used to perform programming language recognition processing on the microservice unit according to the configuration information to obtain a programming language recognition result; The third module is used to perform interface capture processing on the microservice unit according to the programming language recognition result to obtain a microservice interface; The fourth module is used to perform reusability evaluation on the microservice interface and to uniformly manage the microservice interface according to the evaluation result.
9. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the microservice interface management method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for managing the microservice interface according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Interface registration method and device, electronic equipment and storage medium
CN121619362A