Micro-service gateway API inspection method and device, computer equipment, readable storage medium and program product
By automating the acquisition and analysis of basic resources and operational information of microservice gateway APIs, the problem of low efficiency in manual inspections has been solved, enabling efficient and accurate API status monitoring and problem identification, thereby improving the stability and reliability of the system.
Patent Information
- Application Number
- CN202410923076.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-10
- Publication Date
- 2024-11-29
AI Technical Summary
In existing technologies, the inspection of microservice gateway APIs relies on manual operation, resulting in low inspection efficiency.
By acquiring basic resource data from the microservice gateway API, defining inspection task information, periodically acquiring operational information, and determining inspection results based on inspection tasks and operational information, automated inspection is achieved.
This improved the efficiency and accuracy of microservice gateway API inspections, reduced the frequency and errors of manual operations, and ensured the stability and reliability of the system.
Smart Images

Figure CN119052133A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of microservice technology, and in particular to a method, device, computer equipment, readable storage medium and program product for inspecting a microservice gateway API. Background Art
[0002] In the microservice architecture, the microservice gateway acts as the middle layer between the client and the microservice, providing a unified service address and routing external access traffic to the correct service node in the internal cluster according to appropriate rules. The existence of the microservice gateway unifies the entrance and exit of traffic, and the client does not need to know the access information of all services, thereby maintaining the meaning and function of the microservice architecture. Therefore, the existence of the microservice gateway in the microservice system architecture is necessary, and the API is the core component of the microservice gateway, and its performance and stability directly affect the entire system.
[0003] At present, the inspection of microservice gateway APIs mostly relies on manual operations. When faced with a large number of microservice gateway APIs, the inspection efficiency is low. Summary of the invention
[0004] Based on this, it is necessary to provide a microservice gateway API inspection method, device, computer equipment, computer-readable storage medium and computer program product that can improve the microservice gateway API inspection efficiency in response to the above technical problems.
[0005] In a first aspect, the present application provides a method for inspecting a microservice gateway API, comprising:
[0006] Get the basic resource data of the microservice gateway API to be inspected;
[0007] Determine inspection task information for the microservice gateway API to be inspected according to the basic resource data;
[0008] According to the inspection task information, regularly obtain the operation information of the microservice gateway API to be inspected;
[0009] According to the inspection task information and the operation information, the inspection result of the microservice gateway API to be inspected is determined.
[0010] In one embodiment, before obtaining the basic resource data of the microservice gateway API to be inspected, it also includes:
[0011] Get business information of all microservice gateway APIs;
[0012] According to the business information, the microservice gateway API to be inspected is determined from all the microservice gateway APIs.
[0013] In one embodiment, determining the inspection result of the microservice gateway API to be inspected according to the inspection task information and the operation information includes:
[0014] Obtaining inspection standard information in the inspection task information;
[0015] Comparing the inspection standard information with the operation information to obtain a comparison result;
[0016] According to the comparison result, the inspection result of the microservice gateway API to be inspected is determined.
[0017] In one of the embodiments, after determining the inspection result of the microservice gateway API to be inspected, it also includes:
[0018] Determining adaptability evaluation information of the inspection task information according to the inspection result;
[0019] According to the adaptability evaluation information, the inspection task information is dynamically adjusted to obtain new inspection task information.
[0020] In one of the embodiments, after determining the inspection result of the microservice gateway API to be inspected, it also includes:
[0021] Extracting performance indicator information of the microservice gateway API to be inspected from the inspection results;
[0022] According to the performance indicator information, the load balancing strategy of the microservice gateway API to be inspected is adjusted to obtain a new load balancing strategy of the microservice gateway API to be inspected.
[0023] In one embodiment, adjusting the load balancing strategy of the microservice gateway API to be inspected according to the performance indicator information includes:
[0024] According to the performance indicator information, determining the change trend information of the performance indicator of the microservice gateway API to be inspected;
[0025] According to the change trend information, adjust the load balancing strategy of the microservice gateway API to be inspected.
[0026] In a second aspect, the present application also provides a microservice gateway API inspection device, including:
[0027] The data acquisition module is used to obtain the basic resource data of the microservice gateway API to be inspected;
[0028] An information determination module, used to determine the inspection task information for the microservice gateway API to be inspected according to the basic resource data;
[0029] A regular inspection module is used to regularly obtain the operation information of the microservice gateway API to be inspected according to the inspection task information;
[0030] The result determination module is used to determine the inspection result of the microservice gateway API to be inspected according to the inspection task information and the operation information.
[0031] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0032] Get the basic resource data of the microservice gateway API to be inspected;
[0033] Determine inspection task information for the microservice gateway API to be inspected according to the basic resource data;
[0034] According to the inspection task information, regularly obtain the operation information of the microservice gateway API to be inspected;
[0035] According to the inspection task information and the operation information, the inspection result of the microservice gateway API to be inspected is determined.
[0036] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:
[0037] Get the basic resource data of the microservice gateway API to be inspected;
[0038] Determine inspection task information for the microservice gateway API to be inspected according to the basic resource data;
[0039] According to the inspection task information, regularly obtain the operation information of the microservice gateway API to be inspected;
[0040] According to the inspection task information and the operation information, the inspection result of the microservice gateway API to be inspected is determined.
[0041] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:
[0042] Get the basic resource data of the microservice gateway API to be inspected;
[0043] Determine inspection task information for the microservice gateway API to be inspected according to the basic resource data;
[0044] According to the inspection task information, regularly obtain the operation information of the microservice gateway API to be inspected;
[0045] According to the inspection task information and the operation information, the inspection result of the microservice gateway API to be inspected is determined.
[0046] The above-mentioned inspection method, device, computer equipment, computer-readable storage medium and computer program product of the microservice gateway API first obtain the basic resource data of the microservice gateway API to be inspected. By obtaining the basic resource data of the microservice gateway API to be inspected, the configuration and resource usage of each API can be fully understood, and the necessary basic information is provided for the subsequent formulation of inspection task information, ensuring that the inspection task can be carried out in a targeted manner, thereby improving the accuracy and effectiveness of the inspection; then, based on the basic resource data, the inspection task information for the microservice gateway API to be inspected is determined, and the inspection task information is formulated based on the basic resource data, which can be targeted at the characteristics of different APIs. The system can perform personalized configuration according to the needs to ensure that each API can be properly inspected, avoid resource waste and insufficient inspection, and improve the pertinence and accuracy of the inspection task; then, according to the inspection task information, the operation information of the microservice gateway API to be inspected is obtained regularly. Regularly obtaining the operation information can monitor the operation status of the API in a timely manner. Through automated regular inspections, the frequency and error rate of manual operations are reduced, and the inspection efficiency and reliability are improved; finally, according to the inspection task information and operation information, the inspection results of the microservice gateway API to be inspected are determined. By comparing the inspection task information and the operation information, accurate inspection results can be generated to identify problems and anomalies in the API operation. In the above method, the management and maintenance efficiency of the microservice gateway API is significantly improved through the automated inspection method. Compared with the traditional manual inspection method, it can obtain and analyze the operation status of the API more efficiently and accurately, discover and solve problems in a timely manner, and reduce the errors and costs of manual operations. Through the combination of basic resource data and inspection task information, the inspection task is ensured to be targeted and effective, and the stability and reliability of the microservice gateway system are further guaranteed. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0048] Figure 1 It is a flowchart of a method for inspecting a microservice gateway API in one embodiment;
[0049] Figure 2 A schematic diagram of a flow chart of a load balancing adjustment step in an embodiment;
[0050] Figure 3 A schematic diagram of a process of inspecting a microservice gateway API in another embodiment;
[0051] Figure 4 A schematic diagram of an inspection system for a microservice gateway API in one embodiment;
[0052] Figure 5 It is a structural block diagram of a patrol device of a microservice gateway API in one embodiment;
[0053] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0054] 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.
[0055] In one embodiment, Figure 1 As shown, a microservice gateway API inspection method is provided. This embodiment uses the method applied to a terminal as an example. It can be understood that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0056] Step S101, obtaining basic resource data of the microservice gateway API to be inspected.
[0057] Among them, the basic resource data includes at least: API name and version information, which are used to uniquely identify and distinguish different APIs and their versions; service address and port, the access address and communication port of the microservice gateway API, which are used for routing and calling; API configuration parameters, including timeout settings, retry strategies, current limiting rules, etc., which affect the running behavior and performance of the API; dependency and call chain information, which describes the dependency of the API with other services and its position in the call chain, so as to facilitate the identification of potential performance bottlenecks and failure points; resource allocation and usage, such as the allocation and current usage of resources such as CPU, memory, and storage, to help evaluate the resource consumption and load status of the API; health check and monitoring indicators, including the URL of the health check and the monitoring indicators (such as response time, error rate, throughput, etc.), which are used to monitor the running status of the API in real time; security policies and access control, which involve security configurations such as identity authentication, permission control, and encryption algorithms to ensure the security and data protection of the API; API usage data, which records the number of API calls, request frequency, user access patterns, etc., to evaluate the usage and load level of the API.
[0058] Exemplarily, the terminal obtains the basic resource data of the microservice gateway API to be inspected by calling the management interface of the microservice management platform or accessing the relevant database. Basic resource data includes but is not limited to API name and version information, service address and port, API configuration parameters, dependency and call chain information, resource allocation and usage, health check and monitoring indicators, security policies and access control, and API usage data. By obtaining these basic resource data, the terminal can fully understand the configuration and operating environment of the API to be inspected, provide the necessary basic information for the execution of subsequent inspection tasks, and ensure the accuracy and effectiveness of the inspection tasks.
[0059] Step S102: Determine inspection task information for the microservice gateway API to be inspected based on the basic resource data.
[0060] Exemplarily, the terminal extracts key performance indicators from the basic resource data according to the characteristics and operating environment of the API, including response time, error rate, throughput, resource utilization, etc., as the main monitoring objects of the inspection task. According to the usage of the API and business needs, the terminal sets the execution frequency of the inspection task and determines whether the inspection task is performed at time intervals such as minutes, hours, days, and weeks. The terminal sets early warning and alarm thresholds for each inspection indicator based on historical data and business requirements to ensure that abnormal situations are discovered and handled in a timely manner. According to actual needs, the terminal selects the execution method of the inspection task, including active inspection and passive inspection, to ensure the flexibility and timeliness of the inspection task. The terminal formulates the specific execution steps of the inspection task, including data collection, indicator calculation, anomaly detection, report generation, etc., to ensure the orderly progress of the inspection task. According to the characteristics of the inspection task, the terminal formulates a handling strategy for problems found during the inspection process, including automatic expansion of resources, restarting services, adjusting load balancing strategies, etc., to ensure that problems can be solved in a timely manner.
[0061] Step S103: regularly obtain the operation information of the microservice gateway API to be inspected according to the inspection task information.
[0062] Exemplarily, the terminal regularly sends requests to the microservice gateway API according to the inspection frequency set in the inspection task information to obtain the current operating status and performance data. These data may include response time, error rate, throughput, resource utilization, etc. Then, the terminal monitors and analyzes the collected operating data, focusing on the key performance indicators defined in the inspection task information to ensure that these indicators are within the normal range. The terminal will compare the obtained operating data with the warning and alarm thresholds set in the inspection task information. If some indicators are found to exceed the set thresholds, the terminal will record the abnormal situation and generate corresponding alarm information. The terminal can also record the operation information and test results obtained each time in a log file. These log records can be used for subsequent performance analysis, troubleshooting and audit tracking. The terminal can further display the collected operating data through visualization tools, generate charts and reports, and help operation and maintenance personnel intuitively understand the operating status and performance changes of the API.
[0063] Step S104: Determine the inspection result of the microservice gateway API to be inspected according to the inspection task information and the operation information.
[0064] For example, the terminal compares each operating indicator with the threshold set in the inspection task information, evaluates whether there are any abnormal conditions, and records the specific abnormal data and time points. The terminal can also conduct a comprehensive analysis of the collected operating data, calculate the average, maximum, minimum and other statistical information of each key performance indicator, evaluate the overall operation status of the API, and generate a detailed inspection report based on the results of data analysis and abnormal evaluation. The report content includes statistical information of each performance indicator, abnormal detection results, problem description and recommended treatment measures.
[0065] In the above inspection method of microservice gateway API, first, the basic resource data of the microservice gateway API to be inspected is obtained. By obtaining the basic resource data of the microservice gateway API to be inspected, the configuration and resource usage of each API can be fully understood, and the necessary basic information is provided for the subsequent formulation of inspection task information, ensuring that the inspection task can be carried out in a targeted manner, thereby improving the accuracy and effectiveness of the inspection; then, according to the basic resource data, the inspection task information for the microservice gateway API to be inspected is determined, and the inspection task information is formulated based on the basic resource data, which can be personalized according to the characteristics and requirements of different APIs to ensure Each API can be properly inspected to avoid resource waste and insufficient inspection, and improve the pertinence and accuracy of the inspection task; then, according to the inspection task information, the operation information of the microservice gateway API to be inspected is obtained regularly. Regularly obtaining the operation information can monitor the operation status of the API in a timely manner. Through automated regular inspections, the frequency and error rate of manual operations are reduced, and the inspection efficiency and reliability are improved; finally, according to the inspection task information and operation information, the inspection results of the microservice gateway API to be inspected are determined. By comparing the inspection task information and the operation information, accurate inspection results can be generated to identify problems and anomalies in the API operation. In the above method, the management and maintenance efficiency of the microservice gateway API is significantly improved through the automated inspection method. Compared with the traditional manual inspection method, it can obtain and analyze the operation status of the API more efficiently and accurately, discover and solve problems in a timely manner, and reduce the errors and costs of manual operations. Through the combination of basic resource data and inspection task information, the inspection task is ensured to be targeted and effective, and the stability and reliability of the microservice gateway system are further guaranteed.
[0066] In an exemplary embodiment, before the above step S101 obtains the basic resource data of the microservice gateway API to be inspected, it also includes: obtaining business information of all microservice gateway APIs; and determining the microservice gateway API to be inspected from all microservice gateway APIs according to the business information.
[0067] Exemplarily, the terminal obtains detailed business information of all microservice gateway APIs from the microservice management system or related database. The information includes API name, function description, service type, associated microservices, call frequency, historical performance data, fault records, etc. Then, the terminal analyzes the acquired business information and evaluates the operation status and importance of each API. For example, the terminal analyzes the call frequency of each API and prioritizes the APIs with high frequency calls as the inspection targets; the terminal prioritizes the APIs that have had faults as the inspection targets based on the historical fault records of the APIs; the terminal evaluates whether each API is associated with key business and prioritizes the APIs that have a greater impact on the overall system as the inspection targets; the terminal analyzes the historical performance data and finds that there are APIs with performance bottlenecks, and prioritizes them as inspection targets; based on the above analysis results, the terminal generates a list of microservice gateway APIs to be inspected and clarifies the priority of each API. The inspection list ensures that the inspection work is targeted, focuses on the APIs that are most likely to have problems, and optimizes the configuration of inspection resources. In addition, the terminal can also respond to user needs and add microservice gateway APIs that need to be inspected.
[0068] In this embodiment, by analyzing business information, the inspection targets are determined in a targeted manner, indiscriminate inspections are avoided, time and resources are saved, and the efficiency of inspection work is improved. APIs with higher priorities are determined as inspection targets to ensure that key APIs receive special attention and optimize the configuration of inspection resources. By focusing on inspections of high-frequency calls, historical failures, key business-related, and performance bottleneck APIs, potential problems can be discovered and resolved in a timely manner, improving the stability and reliability of the system.
[0069] In an exemplary embodiment, the above step S104 determines the inspection result of the microservice gateway API to be inspected based on the inspection task information and the operation information, and also includes: obtaining the inspection standard information in the inspection task information; comparing the inspection standard information and the operation information to obtain a comparison result; and determining the inspection result of the microservice gateway API to be inspected based on the comparison result.
[0070] Exemplarily, the terminal extracts the preset inspection standard information from the inspection task information. This information includes performance indicators (such as response time, throughput, error rate, etc.), resource usage indicators (such as CPU usage, memory usage, etc.) and other key indicators (such as success rate, availability, etc.). Then, the terminal compares the operation information obtained from the microservice gateway API with the preset inspection standard information: compare the performance indicators such as the API's response time, throughput and error rate to determine whether it meets the preset standard; compare the API's CPU usage, memory usage and other resource usage indicators to determine whether it is within the preset range; compare the API's success rate, availability and other key indicators to determine whether it meets the preset requirements. Through the above comparison, the terminal generates a comparison result and records whether each indicator meets the preset inspection standard. The comparison result may include detailed information such as the specific value of each indicator, the judgment of whether it meets the standard, and the degree of deviation from the standard. Based on the comparison results, the terminal determines the inspection results of the microservice gateway API to be inspected: the terminal conducts a comprehensive evaluation of the comparison results of various indicators to determine the overall operation status of the API; for different comparison results, the terminal classifies and processes them, marking abnormal situations and potential risks; based on the comprehensive evaluation results, the terminal generates a detailed inspection report to record the operation status of the API, existing problems and improvement suggestions.
[0071] In this embodiment, by comparing the preset inspection standard information with the actual operation information, the performance indicators of the API can be accurately evaluated to ensure the accuracy of the inspection results. Through detailed comparison results and comprehensive evaluation, abnormal conditions and potential risks in API operation can be discovered in a timely manner, providing early warnings. Through regular and accurate inspections and timely exception handling, the stability and reliability of the microservice gateway API can be effectively improved to ensure the normal operation of the system.
[0072] In an exemplary embodiment, after determining the inspection result of the microservice gateway API to be inspected in step S104, it also includes: determining the adaptability evaluation information of the inspection task information according to the inspection result; and dynamically adjusting the inspection task information according to the adaptability evaluation information to obtain new inspection task information.
[0073] Exemplarily, the terminal evaluates whether the current inspection frequency is appropriate based on the frequency and severity of the problems recorded in the inspection results; for example, if problems occur frequently (i.e., the abnormal frequency reaches the threshold), the inspection frequency may need to be increased; if problems rarely occur, the inspection frequency may need to be reduced. Based on the specific problems recorded in the inspection report, evaluate whether the current inspection indicators are comprehensive; for example, if problems not covered in the current inspection indicators appear in the API log information, new inspection indicators may need to be added. Based on the actual data in the inspection results, compare whether the current threshold setting is reasonable; for example, if the actual data is close to or exceeds the threshold in most cases, it may be necessary to feedback to the user to adjust the threshold to better reflect the normal operation status of the system. Then, the terminal adjusts the inspection frequency based on the evaluation results; the new inspection frequency will be more in line with the actual operation requirements of the system and ensure timely detection of problems. Based on the evaluation results, update the inspection indicators; the new inspection indicators will cover more possible problems and improve the comprehensiveness of the inspection. Based on the evaluation results, modify the inspection threshold; the new threshold will more accurately reflect the health status of the system and reduce false positives and false negatives. In addition, the terminal will update the new inspection task information to the information configuration file or database to ensure that subsequent inspection tasks can be executed based on the new inspection task information. The terminal will publish the new inspection task information to the relevant operation and maintenance personnel and send notifications through the message service, including platform messages, emails, and text messages. The terminal verifies and monitors the new inspection task information to ensure that it can be effectively executed and continuously optimize the inspection process.
[0074] In this embodiment, through adaptive evaluation and dynamic adjustment, the inspection task information can be adjusted in real time according to the actual operating environment and inspection results to make it more suitable for the current system status. By adding or deleting inspection indicators, adjusting inspection frequency and thresholds, the operating status of the API can be covered more comprehensively and accurately, and the accuracy and timeliness of the inspection report can be improved. In addition, by dynamically adjusting the inspection task information, the inspection process can be continuously optimized, manual operations can be reduced, and the inspection efficiency and accuracy can be improved.
[0075] In an exemplary embodiment, Figure 2 As shown, after the inspection result of the microservice gateway API to be inspected is determined in the above step S104, the following steps are also included:
[0076] Step S201, extracting performance indicator information of the microservice gateway API to be inspected from the inspection results;
[0077] Step S202: adjust the load balancing strategy of the microservice gateway API to be inspected according to the performance indicator information to obtain a new load balancing strategy of the microservice gateway API to be inspected.
[0078] Exemplarily, the terminal obtains inspection result data from a database or log file, which records the operating status of the microservice gateway API to be inspected within a certain period of time. Then, the terminal analyzes the inspection result data and extracts performance indicator information related to the microservice gateway API to be inspected. The performance indicators may include but are not limited to response time, throughput, error rate, CPU usage, memory usage, etc. The terminal analyzes the extracted performance indicator information and evaluates the effectiveness of the current load balancing strategy. For example, the terminal may find that the response time of some API nodes is too long, or the load of some nodes is too high. Then, based on the performance indicator information, the terminal formulates a plan to adjust the load balancing strategy, such as reallocating traffic, increasing or decreasing the number of nodes, adjusting the load balancing algorithm, etc. The terminal applies the new load balancing strategy to the microservice gateway to achieve more balanced traffic distribution and higher system performance.
[0079] In this embodiment, based on the actual performance indicator information, the traffic distribution can be adjusted more accurately to avoid overloading of certain nodes, thereby improving the overall performance of the system. By timely adjusting the load balancing strategy, the API response time can be reduced and the user experience can be improved. Dynamically adjusting the load balancing strategy helps to quickly respond to changes in system status, prevent potential problems, and enhance the stability and reliability of the system.
[0080] In an exemplary embodiment, the above step S202 adjusts the load balancing strategy of the microservice gateway API to be inspected according to the performance indicator information, and also includes: determining the change trend information of the performance indicator of the microservice gateway API to be inspected according to the performance indicator information; and adjusting the load balancing strategy of the microservice gateway API to be inspected according to the change trend information.
[0081] Exemplarily, the terminal collects historical performance indicator data from a database or log file, and the historical data records the operation of the microservice gateway API to be inspected in different time periods. Then, the terminal uses statistical analysis methods or machine learning algorithms to perform trend analysis on the historical performance indicator data. By comparing data from different time periods, the terminal can identify the changing trend information of the performance indicators, such as a gradual increase in response time, or a gradual increase in the load of certain nodes. Based on the changing trend information of the performance indicators, the terminal formulates an adjustment plan for the load balancing strategy. For example, if the load of certain nodes gradually increases, the terminal may increase the resources of these nodes in advance, or optimize traffic distribution. The terminal predicts possible future load changes based on the changing trend information and takes measures in advance. For example, if it is predicted that traffic will increase in certain time periods, the terminal can increase node resources in advance, or optimize the load balancing algorithm.
[0082] In this embodiment, by predicting the change trend of the performance index, measures can be taken in advance to avoid system overload and performance degradation. The load balancing strategy adjustment based on the change trend information can more effectively deal with sudden traffic and keep the system running efficiently.
[0083] In an exemplary embodiment, Figure 3 As shown, the present application provides a microservice gateway API inspection method, the method comprising the following steps:
[0084] Step S301, obtain the business information of all microservice gateway APIs.
[0085] Step S302: Determine the microservice gateway API to be inspected from all microservice gateway APIs according to the business information.
[0086] Step S303, obtaining basic resource data of the microservice gateway API to be inspected.
[0087] Step S304: Determine inspection task information for the microservice gateway API to be inspected based on the basic resource data.
[0088] Step S305: regularly obtain the operation information of the microservice gateway API to be inspected according to the inspection task information.
[0089] Step S306, obtaining the inspection standard information in the inspection task information, and comparing the inspection standard information with the operation information to obtain a comparison result.
[0090] Step S307: Determine the inspection result of the microservice gateway API to be inspected according to the comparison result.
[0091] Step S308: Determine the adaptability evaluation information of the inspection task information according to the inspection result.
[0092] Step S309: dynamically adjust the inspection task information according to the adaptability evaluation information to obtain new inspection task information.
[0093] Step S310: extracting performance indicator information of the microservice gateway API to be inspected from the inspection results.
[0094] Step S311: Determine the change trend information of the performance indicator of the microservice gateway API to be inspected according to the performance indicator information.
[0095] Step S312: According to the change trend information, the load balancing strategy of the microservice gateway API to be inspected is adjusted to obtain a new load balancing strategy of the microservice gateway API to be inspected.
[0096] In this embodiment, the management and maintenance efficiency of the microservice gateway API is significantly improved through the automated inspection method. Compared with the traditional manual inspection method, it can obtain and analyze the operating status of the API more efficiently and accurately, discover and solve problems in time, and reduce the error and cost of manual operation. Through the combination of basic resource data and inspection task information, it is ensured that the inspection task is targeted and effective, and the stability and reliability of the microservice gateway system are further guaranteed. In addition, by predicting the changing trend of performance indicators, measures can be taken in advance to avoid system overload and performance degradation. The load balancing strategy adjustment based on the change trend information can more effectively deal with sudden traffic and keep the system running efficiently. In addition, through adaptability evaluation and dynamic adjustment, the inspection task information can be adjusted in real time according to the actual operating environment and inspection results to make it more suitable for the current system status. By adding or deleting inspection indicators, adjusting the inspection frequency and threshold, the operating status of the API is covered more comprehensively and accurately, and the accuracy and timeliness of the inspection report are improved. And the dynamic adjustment of the inspection task information can continuously optimize the inspection process, reduce manual operations, and improve the inspection efficiency and accuracy.
[0097] In another exemplary embodiment, Figure 4 As shown in the figure, a microservice gateway API inspection system that executes the inspection method of the microservice gateway API. Among them, consul can be used as the registration center and configuration center, and the service call framework can use openfeign. The service call can be implemented based on the integration of Feign Client and Ribbon, and the user can access the service call framework based on Nginx.
[0098] Inspection information service: used to manage user-defined or terminal-generated inspection task information including inspection indicators, inspection items, inspection thresholds, regular times, etc.
[0099] Inspection task service: regularly trigger inspections based on inspection task information and send inspection reports.
[0100] Resource service: used to manage the basic resource data of the microservice platform and support inspection information configuration.
[0101] Message service: used to manage all notification messages.
[0102] Notification service: provides an entry for sending various notifications.
[0103] Inspection process: 1) Import each microservice platform and wait for basic resource data synchronization. 2) Create inspection task information. Inspection items include whether the API call volume hits the threshold and whether the API has been called. 3) The inspection engine compares the API call volume and the set threshold according to the time setting of the inspection task, and generates an inspection report simultaneously.
[0104] The inspection service can use Quartz as the task scheduling framework for the inspection project. When the inspection service is started, it will obtain the inspection configuration from the database. Currently, the default is to perform an inspection task scan once a minute. At the same time, the scheduling management framework class SmartScheduleManager is initialized. The SmartScheduleManager class will initialize the Quartz scheduler Scheduler through StdSchedulerFactory and create a scheduling task job SmartTaskJob. SmartTaskJob will initialize the Quartz trigger CronTrigger and JobDetail objects. And use Scheduler to start the scheduling task.
[0105] The scheduling task performs an inspection task scan periodically. The tasks that need to be inspected are stored as a list and sent to the insp-task service through Feign call for actual inspection.
[0106] The insp-task service will obtain detailed information about the microservice from the resource service according to the microservice ID that needs to be inspected. After obtaining the detailed information about the microservice, it will encapsulate an http request to request the tsf-dispatch service of the microservice platform to obtain the microservice instance and call chain details. After obtaining the microservice gateway API call information, it will compare it with the inspection notification threshold in the inspection task to give the inspection result, send platform messages through the message service, send emails and SMS notifications through the sender notification service, and generate an inspection report at the same time, which users can view on the platform.
[0107] In this embodiment, multiple microservice platforms can be managed in a unified manner, and the usage data of the microservice gateway API in each platform can be effectively observed. This allows more timely and accurate discovery of abnormal API data, and prevents potential performance bottlenecks or service failures. The inspection configuration is simple and easy to use, allowing users to easily and quickly formulate inspection tasks and indicators without the need for complex manual operations and manual statistics on each microservice platform. Based on the inspection, the system business can be deeply analyzed, useless microservice gateway APIs can be counted and processed in the next step to improve the system quality.
[0108] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0109] Based on the same inventive concept, the embodiment of the present application also provides a microservice gateway API inspection device for implementing the microservice gateway API inspection method involved above. The implementation solution for solving the problem provided by the device is similar to the implementation solution recorded in the above method, so the specific limitations in the embodiments of the inspection device for one or more microservice gateway APIs provided below can refer to the limitations of the inspection method for the microservice gateway API above, and will not be repeated here.
[0110] In an exemplary embodiment, Figure 5 As shown, a microservice gateway API inspection device is provided, including: a data acquisition module 501, an information determination module 502, a regular inspection module 503 and a result determination module 504, wherein:
[0111] The data acquisition module 501 is used to acquire the basic resource data of the microservice gateway API to be inspected;
[0112] The information determination module 502 is used to determine the inspection task information for the microservice gateway API to be inspected according to the basic resource data;
[0113] The regular inspection module 503 is used to regularly obtain the operation information of the microservice gateway API to be inspected according to the inspection task information;
[0114] The result determination module 504 is used to determine the inspection result of the microservice gateway API to be inspected according to the inspection task information and the operation information.
[0115] In one of the embodiments, the inspection device of the microservice gateway API further includes an inspection determination module, which is used to obtain business information of all microservice gateway APIs; and determine the microservice gateway API to be inspected from all microservice gateway APIs according to the business information.
[0116] In one embodiment, the above-mentioned result determination module 504 is also used to obtain the inspection standard information in the inspection task information; compare the inspection standard information and the operation information to obtain the comparison result; and determine the inspection result of the microservice gateway API to be inspected based on the comparison result.
[0117] In one of the embodiments, the inspection device of the microservice gateway API further includes an information adjustment module, which is used to determine the adaptability evaluation information of the inspection task information according to the inspection results; and dynamically adjust the inspection task information according to the adaptability evaluation information to obtain new inspection task information.
[0118] In one of the embodiments, the inspection device of the above-mentioned microservice gateway API also includes a load balancing module, which is used to extract performance indicator information of the microservice gateway API to be inspected from the inspection results; according to the performance indicator information, adjust the load balancing strategy of the microservice gateway API to be inspected to obtain a new load balancing strategy of the microservice gateway API to be inspected.
[0119] In one of the embodiments, the load balancing module is further used to determine the change trend information of the performance indicator of the microservice gateway API to be inspected according to the performance indicator information; and adjust the load balancing strategy of the microservice gateway API to be inspected according to the change trend information.
[0120] Each module in the inspection device of the microservice gateway API can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0121] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 6As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (Near Field Communication, NFC) or other technologies. When the computer program is executed by the processor, a method for inspecting a microservice gateway API is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0122] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0123] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0124] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0125] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0126] It should be noted that the user 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 regulations.
[0127] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0128] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0129] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A microservice gateway API inspection method, It is characterized in that The method comprises: Get the basic resource data of the microservice gateway API to be inspected; Determine inspection task information for the microservice gateway API to be inspected according to the basic resource data; According to the inspection task information, regularly obtain the operation information of the microservice gateway API to be inspected; According to the inspection task information and the operation information, the inspection result of the microservice gateway API to be inspected is determined.
2. The method according to claim 1, It is characterized in that Before obtaining the basic resource data of the microservice gateway API to be inspected, it also includes: Get business information of all microservice gateway APIs; According to the business information, the microservice gateway API to be inspected is determined from all the microservice gateway APIs.
3. The method according to claim 1, It is characterized in that The step of determining the inspection result of the microservice gateway API to be inspected according to the inspection task information and the operation information includes: Obtaining inspection standard information in the inspection task information; Comparing the inspection standard information with the operation information to obtain a comparison result; According to the comparison result, the inspection result of the microservice gateway API to be inspected is determined.
4. The method according to claim 1, It is characterized in that After determining the inspection result of the microservice gateway API to be inspected, the process further includes: Determining adaptability evaluation information of the inspection task information according to the inspection result; According to the adaptability evaluation information, the inspection task information is dynamically adjusted to obtain new inspection task information.
5. The method according to claim 1, It is characterized in that After determining the inspection result of the microservice gateway API to be inspected, the process further includes: Extracting performance indicator information of the microservice gateway API to be inspected from the inspection results; According to the performance indicator information, the load balancing strategy of the microservice gateway API to be inspected is adjusted to obtain a new load balancing strategy of the microservice gateway API to be inspected.
6. The method according to claim 5, It is characterized in that The step of adjusting the load balancing strategy of the microservice gateway API to be inspected according to the performance indicator information includes: According to the performance indicator information, determining the change trend information of the performance indicator of the microservice gateway API to be inspected; According to the change trend information, adjust the load balancing strategy of the microservice gateway API to be inspected.
7. A microservice gateway API inspection device, It is characterized in that The device comprises: The data acquisition module is used to obtain the basic resource data of the microservice gateway API to be inspected; An information determination module, used to determine the inspection task information for the microservice gateway API to be inspected according to the basic resource data; A regular inspection module, used to regularly obtain the operation information of the microservice gateway API to be inspected according to the inspection task information; The result determination module is used to determine the inspection result of the microservice gateway API to be inspected according to the inspection task information and the operation information.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program. It is characterized in that When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
