A version control method and system based on API gateway
By confirming the contribution level of the API in the API gateway and splitting the monitoring list to determine sub-monitoring strategies, the problem of uneven distribution of monitoring resources in the API gateway is solved, and the timely update of the API version and the improvement of user experience are achieved.
Patent Information
- Application Number
- CN202410534037.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-30
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2044-04-30
AI Technical Summary
The existing API gateway has uneven distribution of monitoring resources, resulting in untimely API version updates, high latency, and inability to adapt to API needs in different situations.
By confirming all APIs under API gateway management, obtain their monitoring logs, define the contribution level of each API, split the monitoring list, determine sub-monitoring strategies, evaluate the effectiveness of the strategies, and adjust resource allocation to achieve timely updates of API versions.
It improves the adaptability and timeliness of API version control, ensures the effectiveness of monitoring resource usage, and ensures user experience and API timeliness.
Smart Images

Figure CN118118364B
Abstract
Description
Technical Field
[0001] The present application relates to the field of API gateway technology, and more specifically, to a version control method and system based on API gateway. Background Art
[0002] An API gateway-based versioning scheme involves using an API gateway as a central point to manage and route to different versions of backend services. This allows developers to maintain multiple API versions, ensuring that the progressive deployment of new features does not break existing clients. By including version information in the request, whether through the URL, header, or parameter, the API gateway can forward the request to the appropriate service version based on client needs. This strategy supports flexible API evolution and helps achieve backward compatibility and smooth transition.
[0003] In the prior art, the API gateway involves multiple APIs, resulting in uneven distribution of monitoring resources and failure to perform adaptive monitoring on APIs in different situations, resulting in untimely API version updates and high latency.
[0004] Therefore, how to improve the adaptability and timeliness of version control is a technical problem that needs to be solved. Summary of the invention
[0005] The present invention provides a version control method based on an API gateway to solve the technical problems of adaptability and timeliness of API monitoring in the prior art. The method comprises:
[0006] Confirm all APIs managed by the API gateway and add them to the monitoring list;
[0007] Get the monitoring log of the API gateway for the API, and define the contribution level of the current version of each API in the monitoring list;
[0008] Split the monitoring list into multiple sub-monitoring lists based on the contribution level of the current API version, and determine the monitoring strategy for each sub-monitoring list;
[0009] Evaluate the effectiveness of the monitoring strategy for each sub-monitoring list and adjust the monitoring strategy for API monitoring;
[0010] If you receive a version update notification or monitor that the API needs to be updated, update the API version.
[0011] In some embodiments of the present application, the monitoring log of the API gateway for the API is obtained, and the contribution level of the current version of each API in the monitoring list is defined, including:
[0012] Obtain the usage frequency and performance data of the current version of the API based on the API monitoring log, and decompose the performance data into multiple performance indicators;
[0013] Obtain the overall business process and identify the business functions, participants, inputs and outputs, and interaction relationships in the overall business process;
[0014] Identify the APIs involved in the overall business process, record the business functions, inputs and outputs involved in each API, and determine the position of the API in the overall business process;
[0015] Determine the dependencies between APIs and the dependencies between APIs and other business components based on the business functions, inputs and outputs, interactions, and locations involved in the APIs;
[0016] The dependencies between APIs and the dependencies between APIs and other business components are called API internal dependencies and API external dependencies respectively;
[0017] Build a dependency graph based on all API internal dependencies and API external dependencies. The nodes in the graph represent APIs or business components, and the edges represent the strength of the dependencies.
[0018] Determine the basic contribution of the API based on the dependency graph, and determine the contribution level of the current version of the API through the basic contribution of the API, API usage frequency, and multiple performance indicators.
[0019] In some embodiments of the present application, determining the basic contribution of an API based on a dependency graph includes:
[0020] Identify the directly dependent APIs and directly dependent business components of each API through the dependency graph, and build a direct dependency list, which includes all the directly dependent APIs and directly dependent business components of the API;
[0021] Identify the indirect dependent APIs and indirect dependent business components of each API through the dependency graph, and build an indirect dependency list, which includes all the indirect dependent APIs and indirect dependent business components of the API;
[0022] Analyze each API and each business component in the direct dependency list and the indirect dependency list, and quantify the weight factors of the API and business components. The weight factors include importance, complexity, error rate, and stability.
[0023] Normalize importance, complexity, error rate, and stability based on the preset percentage of each API and business component;
[0024] Determine the basic weight of each API and business component by presetting the proportion and weight factors, calculate the sum of the basic weights of each API and business component, and thus determine the average basic weight of each API and business component;
[0025] Determine the direct weight of the API and business components based on their average basic weights, and thus determine the direct dependency of the API;
[0026] According to the indirect dependency list, the indirect dependency of the API is obtained by traversing the dependency graph and calculating the weight product of all edges on the path;
[0027] Determine the basic contribution of the API based on the direct and indirect dependencies of the API.
[0028] In some embodiments of the present application, the contribution level of the current version of the API is determined by the basic contribution of the API, the frequency of API usage, and a variety of performance indicators, including:
[0029] ;
[0030] Among them, M is the contribution level of the current version of an API. is the basic contribution of the API, n is the number of performance indicators of the API, is the performance weight corresponding to the i-th performance indicator, is the parameter size corresponding to the i-th performance indicator, is the contribution function of API basic contribution and comprehensive performance, exp is the exponential function, r is the API usage frequency, is the first constant, is the second constant, and [] is the rounding symbol.
[0031] In some embodiments of the present application, the monitoring list is split into multiple sub-monitoring lists according to the contribution level of the current version of the API, and the monitoring strategy of each sub-monitoring list is determined, including:
[0032] Integrate the contribution levels of all current API versions and determine the scope of contribution levels;
[0033] Based on the contribution level existence range, a contribution level approximate interval is defined, and the contribution level approximate interval includes multiple contribution levels;
[0034] Split the APIs in each contribution level approximate range into multiple sub-monitoring lists;
[0035] Two mapping relationships are preset, and the monitoring strategy of each sub-monitoring list is determined by the mapping relationship.
[0036] In some embodiments of the present application, the monitoring strategy of each sub-monitoring list is determined by a mapping relationship, including:
[0037] The two mapping relationships are integer mapping and half mapping. When the average contribution level in the sub-monitoring list is an integer, the monitoring strategy is determined by integer mapping. When the average contribution level in the sub-monitoring list is not an integer, the monitoring strategy is determined by half mapping.
[0038] The mapping relationship is that the average contribution level in the sub-monitoring list corresponds to different levels of monitoring strategies, and the monitoring strategies are different resource allocations at the business demand level, user demand level and functional demand level.
[0039] In some embodiments of the present application, evaluating the effectiveness of the monitoring strategy of each sub-monitoring list and adjusting the monitoring strategy for API monitoring include:
[0040] Preset the functional relationship between resource utilization and response time, and build a benchmark graph of the two;
[0041] Determine the benchmark matching degree interval according to the monitoring strategy level of the sub-monitoring list;
[0042] Monitor the resource utilization and response time of each API in the sub-monitoring list, integrate them, and build a real-time change chart of the two;
[0043] Compare the baseline graph and the real-time change graph to get the matching degree;
[0044] If the matching degree is within the benchmark matching degree range, the monitoring strategy will not be adjusted;
[0045] Otherwise, the matching degree deviation is calculated, and the different resource allocation ratios at the business demand level, user demand level, and functional demand level are adjusted through the matching degree deviation.
[0046] In some embodiments of the present application, monitoring that the API needs to be updated includes:
[0047] The business requirements, performance requirements, and security vulnerability requirements of the quantified API meet the standards;
[0048] If one or more of the API's business requirements, performance requirements, and security vulnerability requirements do not meet the preset corresponding thresholds, the API needs to be updated.
[0049] In some embodiments of the present application, the API version is updated, including:
[0050] Configure API version information in the API gateway, determine the version control method based on one or more of the API change frequency, client integration method, backward compatibility requirements, and security, and then perform version updates;
[0051] Among them, version control methods include URL path control, HTTP header control and request parameter control.
[0052] Correspondingly, this application also provides a version control system based on API gateway, including:
[0053] The first module is used to confirm all APIs managed by the API gateway and add these APIs to the monitoring list;
[0054] The second module is used to obtain the monitoring log of the API gateway for the API and define the contribution level of the current version of each API in the monitoring list;
[0055] The third module is used to split the monitoring list into multiple sub-monitoring lists according to the contribution level of the current version of the API, and determine the monitoring strategy of each sub-monitoring list;
[0056] The fourth module is used to evaluate the effectiveness of the monitoring strategy of each sub-monitoring list and adjust the monitoring strategy for API monitoring;
[0057] The fifth module is used to update the API version if a version update notification is received or the API is monitored to need to be updated.
[0058] By applying the above technical solutions, all APIs managed by the API gateway are confirmed, and these APIs are added to the monitoring list; the monitoring log of the API gateway is obtained, and the contribution level of the current version of each API in the monitoring list is defined; the monitoring list is split into multiple sub-monitoring lists according to the contribution level of the current version of the API, and the monitoring strategy of each sub-monitoring list is determined; the effectiveness of the monitoring strategy of each sub-monitoring list is evaluated, and the monitoring strategy is adjusted to perform API monitoring; if a version update notification is received or the API is monitored to need to be updated, the API is updated. This application defines the contribution level of the current version of each API in the monitoring list, splits the monitoring list into multiple sub-monitoring lists, and thus determines the corresponding monitoring strategy, ensures the effectiveness and adaptability of the use of monitoring resources, enables the API to be updated in a timely manner, and ensures user experience and API timeliness. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0060] Figure 1A schematic diagram of a process flow of a version control method based on an API gateway proposed in an embodiment of the present invention is shown;
[0061] Figure 2 A schematic diagram of the structure of a version control system based on an API gateway proposed in an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0062] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0063] The present application embodiment provides a version control method based on API gateway, such as Figure 1 As shown, the method comprises the following steps:
[0064] Step S101, confirm all APIs managed by the API gateway and add these APIs to the monitoring list.
[0065] In this embodiment, the API gateway is an intermediate layer between the client and the server, which provides a unified entrance for the client to access multiple microservices in the backend. As a unified entrance to the system, the API gateway can simplify the interaction between the client and the backend services. The API gateway integrates functions such as API publishing, environment management, access authentication, user authentication, and access control, making API management more efficient, secure, and low-cost.
[0066] Step S102, obtain the monitoring log of the API gateway for the API, and define the contribution level of the current version of each API in the monitoring list.
[0067] In this embodiment, the contribution level of the current version of the API refers to the comprehensive contribution of the current version of the API to the overall system.
[0068] In some embodiments of the present application, the monitoring log of the API gateway for the API is obtained, and the contribution level of the current version of each API in the monitoring list is defined, including:
[0069] Obtain the usage frequency and performance data of the current version of the API based on the API monitoring log, and decompose the performance data into multiple performance indicators;
[0070] Obtain the overall business process and identify the business functions, participants, inputs and outputs, and interaction relationships in the overall business process;
[0071] Identify the APIs involved in the overall business process, record the business functions, inputs and outputs involved in each API, and determine the position of the API in the overall business process;
[0072] Determine the dependencies between APIs and the dependencies between APIs and other business components based on the business functions, inputs and outputs, interactions, and locations involved in the APIs;
[0073] The dependencies between APIs and the dependencies between APIs and other business components are called API internal dependencies and API external dependencies respectively;
[0074] Build a dependency graph based on all API internal dependencies and API external dependencies. The nodes in the graph represent APIs or business components, and the edges represent the strength of the dependencies.
[0075] Determine the basic contribution of the API based on the dependency graph, and determine the contribution level of the current version of the API through the basic contribution of the API, API usage frequency, and multiple performance indicators.
[0076] In some embodiments of the present application, determining the basic contribution of an API based on a dependency graph includes:
[0077] Identify the directly dependent APIs and directly dependent business components of each API through the dependency graph, and build a direct dependency list, which includes all the directly dependent APIs and directly dependent business components of the API;
[0078] Identify the indirect dependent APIs and indirect dependent business components of each API through the dependency graph, and build an indirect dependency list, which includes all the indirect dependent APIs and indirect dependent business components of the API;
[0079] Analyze each API and each business component in the direct dependency list and the indirect dependency list, and quantify the weight factors of the API and business components. The weight factors include importance, complexity, error rate, and stability.
[0080] Normalize importance, complexity, error rate, and stability based on the preset percentage of each API and business component;
[0081] Determine the basic weight of each API and business component by presetting the proportion and weight factors, calculate the sum of the basic weights of each API and business component, and thus determine the average basic weight of each API and business component;
[0082] Determine the direct weight of the API and business components based on their average basic weights, and thus determine the direct dependency of the API;
[0083] According to the indirect dependency list, the indirect dependency of the API is obtained by traversing the dependency graph and calculating the weight product of all edges on the path;
[0084] Determine the basic contribution of the API based on the direct and indirect dependencies of the API.
[0085] In this embodiment, the weight factors include importance, complexity, error rate and stability, and the preset proportion is the corresponding proportion of each weight factor, for example, importance, complexity, error rate and stability are 0.3, 0.2, 0.2, 0.3, etc. The sum of the basic weights of each API and business component is calculated and multiplied by the sum of the corresponding parameters to obtain the sum of the basic weights.
[0086] Importance: How critical a component is to the business logic or system.
[0087] Complexity: number of lines of code, logical structure, etc. of the component.
[0088] Error rate: The ratio of errors or exceptions that occur during the operation of a component.
[0089] Stability: reliability of components, such as fault recovery capability, fault tolerance, etc.
[0090] In some embodiments of the present application, the contribution level of the current version of the API is determined by the basic contribution of the API, the frequency of API usage, and a variety of performance indicators, including:
[0091] ;
[0092] Among them, M is the contribution level of the current version of an API. is the basic contribution of the API, n is the number of performance indicators of the API, is the performance weight corresponding to the i-th performance indicator, is the parameter size corresponding to the i-th performance indicator, is the contribution function of API basic contribution and comprehensive performance, exp is the exponential function, r is the API usage frequency, is the first constant, is the second constant, and [] is the rounding symbol.
[0093] In this embodiment, is a contribution function about API basic contribution and performance synthesis, and the contribution function is obtained by using two parameters: API basic contribution and performance synthesis. Indicates the correction of API usage frequency to contribution.
[0094] Step S103: split the monitoring list into multiple sub-monitoring lists according to the contribution level of the current version of the API, and determine the monitoring strategy of each sub-monitoring list.
[0095] In this embodiment, APIs with similar contribution levels are divided into a sub-monitoring list and monitored using a monitoring strategy.
[0096] In some embodiments of the present application, the monitoring list is split into multiple sub-monitoring lists according to the contribution level of the current version of the API, and the monitoring strategy of each sub-monitoring list is determined, including:
[0097] Integrate the contribution levels of all current API versions and determine the scope of contribution levels;
[0098] Based on the contribution level existence range, a contribution level approximate interval is defined, and the contribution level approximate interval includes multiple contribution levels;
[0099] Split the APIs in each contribution level approximate range into multiple sub-monitoring lists;
[0100] Two mapping relationships are preset, and the monitoring strategy of each sub-monitoring list is determined by the mapping relationship.
[0101] In this embodiment, the contribution level existence range is all ranges of contribution levels, and the contribution level approximate interval is defined based on the contribution level existence range, and different ranges correspond to different intervals.
[0102] In some embodiments of the present application, the monitoring strategy of each sub-monitoring list is determined by a mapping relationship, including:
[0103] The two mapping relationships are integer mapping and half mapping. When the average contribution level in the sub-monitoring list is an integer, the monitoring strategy is determined by integer mapping. When the average contribution level in the sub-monitoring list is not an integer, the monitoring strategy is determined by half mapping.
[0104] The mapping relationship is that the average contribution level in the sub-monitoring list corresponds to different levels of monitoring strategies, and the monitoring strategies are different resource allocations at the business demand level, user demand level and functional demand level.
[0105] In this embodiment, integer mapping and half mapping respectively refer to that when the sum of contribution levels in the sub-monitoring list can divide the number of APIs, it is an integer, otherwise, it is a decimal, and two mapping relationships are adopted.
[0106] Step S104, evaluate the effectiveness of the monitoring strategy of each sub-monitoring list, and adjust the monitoring strategy to perform API monitoring.
[0107] In some embodiments of the present application, evaluating the effectiveness of the monitoring strategy of each sub-monitoring list and adjusting the monitoring strategy for API monitoring include:
[0108] Preset the functional relationship between resource utilization and response time, and build a benchmark graph of the two;
[0109] Determine the benchmark matching degree interval according to the monitoring strategy level of the sub-monitoring list;
[0110] Monitor the resource utilization and response time of each API in the sub-monitoring list, integrate them, and build a real-time change chart of the two;
[0111] Compare the baseline graph and the real-time change graph to get the matching degree;
[0112] If the matching degree is within the benchmark matching degree range, the monitoring strategy will not be adjusted;
[0113] Otherwise, the matching degree deviation is calculated, and the different resource allocation ratios at the business demand level, user demand level, and functional demand level are adjusted through the matching degree deviation.
[0114] In this embodiment, different monitoring strategy levels correspond to different benchmark matching degree intervals. Matching degree deviation refers to the difference between the matching degree and the adjacent endpoints of the benchmark matching degree interval. Different matching degree deviations correspond to different adjustment coefficients, thereby adjusting different resource allocation ratios at the business demand level, user demand level, and functional demand level.
[0115] Step S105: If a version update notification is received or it is monitored that the API needs to be updated, the API is updated.
[0116] In some embodiments of the present application, monitoring that the API needs to be updated includes:
[0117] The business requirements, performance requirements, and security vulnerability requirements of the quantified API meet the standards;
[0118] If one or more of the API's business requirements, performance requirements, and security vulnerability requirements do not meet the preset corresponding thresholds, the API needs to be updated.
[0119] In this embodiment, the business requirements meet the standards. If the existing functions of the API cannot meet the new business requirements, or new functions need to be added, the API may need to be updated. The performance requirements meet the standards. In order to improve the performance of the API, such as reducing response time or improving processing power, the API may need to be updated. The security vulnerability requirements meet the standards. When security vulnerabilities are found in the API, they must be updated as soon as possible to fix these problems to ensure the security of user data.
[0120] In some embodiments of the present application, the API version is updated, including:
[0121] Configure API version information in the API gateway, determine the version control method based on one or more of the API change frequency, client integration method, backward compatibility requirements, and security, and then perform version updates;
[0122] Among them, version control methods include URL path control, HTTP header control and request parameter control.
[0123] In this embodiment, the frequency of API changes.
[0124] High frequency of changes: If the API is frequently updated or new features are added, using HTTP header control or request parameter control may be more flexible because these methods do not require frequent changes to the URL path.
[0125] Low-frequency changes: For APIs that change less frequently, URL path control may be more intuitive and easier to manage.
[0126] The client integration method.
[0127] Multiple clients: If the API needs to be integrated with multiple different types of clients (such as mobile applications, web front-ends, back-end services, etc.), using HTTP headers or request parameters may be more common because these methods can be versioned independently of the URL path.
[0128] Single or fixed client: For APIs that integrate only with a specific type or a fixed number of clients, URL path control may be simpler and more direct.
[0129] Security considerations.
[0130] Leakage of sensitive information: If the version information may leak sensitive information (such as a version with a security vulnerability), avoid exposing the version information directly in the URL path or request parameters. Instead, use HTTP headers or other encryption methods to control it.
[0131] Backward compatibility requirements.
[0132] Strong backward compatibility: If the API needs to support old versions for a long time to be compatible with existing clients, it may be more appropriate to use the media type control or versioning route because they allow new versions to be introduced without breaking existing functionality.
[0133] Weak backward compatibility: If backward compatibility is not a major concern, other versioning methods can be chosen based on the frequency of changes and client integration methods.
[0134] By applying the above technical solutions, all APIs managed by the API gateway are confirmed, and these APIs are added to the monitoring list; the monitoring log of the API gateway is obtained, and the contribution level of the current version of each API in the monitoring list is defined; the monitoring list is split into multiple sub-monitoring lists according to the contribution level of the current version of the API, and the monitoring strategy of each sub-monitoring list is determined; the effectiveness of the monitoring strategy of each sub-monitoring list is evaluated, and the monitoring strategy is adjusted to perform API monitoring; if a version update notification is received or the API is monitored to need to be updated, the API is updated. This application defines the contribution level of the current version of each API in the monitoring list, splits the monitoring list into multiple sub-monitoring lists, and thus determines the corresponding monitoring strategy, ensures the effectiveness and adaptability of the use of monitoring resources, enables the API to be updated in a timely manner, and ensures user experience and API timeliness.
[0135] Through the description of the above implementation methods, those skilled in the art can clearly understand that the present invention can be implemented by hardware, or by software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each implementation scenario of the present invention.
[0136] In order to further explain the technical idea of the present invention, the technical solution of the present invention is now described in combination with specific application scenarios.
[0137] Correspondingly, this application also provides a version control system based on API gateway, such as Figure 2 As shown, including:
[0138] The first module is used to confirm all APIs managed by the API gateway and add these APIs to the monitoring list;
[0139] The second module is used to obtain the monitoring log of the API gateway for the API and define the contribution level of the current version of each API in the monitoring list;
[0140] The third module is used to split the monitoring list into multiple sub-monitoring lists according to the contribution level of the current version of the API, and determine the monitoring strategy of each sub-monitoring list;
[0141] The fourth module is used to evaluate the effectiveness of the monitoring strategy of each sub-monitoring list and adjust the monitoring strategy for API monitoring;
[0142] The fifth module is used to update the API version if a version update notification is received or the API is monitored to need to be updated.
[0143] Those skilled in the art will appreciate that the modules in the system in the implementation scenario can be distributed in the system of the implementation scenario according to the implementation scenario description, or can be changed accordingly and located in one or more systems different from the implementation scenario. The modules in the above implementation scenario can be combined into one module, or can be further split into multiple submodules.
[0144] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A version control method based on API gateway, It is characterized in that include: Confirm all APIs managed by the API gateway and add them to the monitoring list; Get the monitoring log of the API gateway for the API, and define the contribution level of the current version of each API in the monitoring list; Split the monitoring list into multiple sub-monitoring lists based on the contribution level of the current API version, and determine the monitoring strategy for each sub-monitoring list; Evaluate the effectiveness of the monitoring strategy for each sub-monitoring list and adjust the monitoring strategy for API monitoring; If a version update notification is received or the API needs to be updated, the API version will be updated; Get the monitoring log of the API gateway for the API, and define the contribution level of the current version of each API in the monitoring list, including: Obtain the usage frequency and performance data of the current version of the API based on the API monitoring log, and decompose the performance data into multiple performance indicators; Obtain the overall business process and identify the business functions, participants, inputs and outputs, and interaction relationships in the overall business process; Identify the APIs involved in the overall business process, record the business functions, inputs and outputs involved in each API, and determine the position of the API in the overall business process; Determine the dependencies between APIs and the dependencies between APIs and other business components based on the business functions, inputs and outputs, interactions, and locations involved in the APIs; The dependencies between APIs and the dependencies between APIs and other business components are called API internal dependencies and API external dependencies respectively; Build a dependency graph based on all API internal dependencies and API external dependencies. The nodes in the graph represent APIs or business components, and the edges represent the strength of the dependencies. Determine the basic contribution of the API based on the dependency graph, and determine the contribution level of the current version of the API through the basic contribution of the API, the frequency of API use, and multiple performance indicators; Determine the basic contribution of the API based on the dependency graph, including: Identify the directly dependent APIs and directly dependent business components of each API through the dependency graph, and build a direct dependency list, which includes all the directly dependent APIs and directly dependent business components of the API; Identify the indirect dependent APIs and indirect dependent business components of each API through the dependency graph, and build an indirect dependency list, which includes all the indirect dependent APIs and indirect dependent business components of the API; Analyze each API and each business component in the direct dependency list and the indirect dependency list, and quantify the weight factors of the API and business components. The weight factors include importance, complexity, error rate, and stability. Normalize importance, complexity, error rate, and stability based on the preset percentage of each API and business component; Determine the basic weight of each API and business component by presetting the proportion and weight factors, calculate the sum of the basic weights of each API and business component, and thus determine the average basic weight of each API and business component; Determine the direct weight of the API and business components based on their average basic weights, and thus determine the direct dependency of the API; According to the indirect dependency list, the indirect dependency of the API is obtained by traversing the dependency graph and calculating the weight product of all edges on the path; Determine the basic contribution of the API based on its direct and indirect dependencies; Split the monitoring list into multiple sub-monitoring lists based on the contribution level of the current API version, and determine the monitoring strategy for each sub-monitoring list, including: Integrate the contribution levels of all current API versions and determine the scope of contribution levels; Based on the contribution level existence range, a contribution level approximate interval is defined, and the contribution level approximate interval includes multiple contribution levels; Split the APIs in each contribution level approximate range into multiple sub-monitoring lists; Two mapping relationships are preset, and the monitoring strategy of each sub-monitoring list is determined by the mapping relationship.
2. The version control method based on API gateway as claimed in claim 1, It is characterized in that The contribution level of the current version of the API is determined by the basic contribution of the API, the frequency of API usage, and a variety of performance indicators, including: ; Among them, M is the contribution level of the current version of an API. is the basic contribution of the API, n is the number of performance indicators of the API, is the performance weight corresponding to the i-th performance indicator, is the parameter size corresponding to the i-th performance indicator, is the contribution function of API basic contribution and comprehensive performance, exp is the exponential function, r is the API usage frequency, is the first constant, is the second constant, and [] is the rounding symbol.
3. The version control method based on API gateway as claimed in claim 2, It is characterized in that The monitoring strategy of each sub-monitoring list is determined through the mapping relationship, including: The two mapping relationships are integer mapping and half mapping. When the average contribution level in the sub-monitoring list is an integer, the monitoring strategy is determined by integer mapping. When the average contribution level in the sub-monitoring list is not an integer, the monitoring strategy is determined by half mapping. Integer mapping and half mapping refer to two mapping relationships: when the sum of contribution levels in the sub-monitoring list can divide the number of APIs, it is an integer; otherwise, it is a decimal. The mapping relationship is that the average contribution level in the sub-monitoring list corresponds to different levels of monitoring strategies, and the monitoring strategies are different resource allocations at the business demand level, user demand level and functional demand level.
4. The version control method based on API gateway as claimed in claim 3, It is characterized in that Evaluate the effectiveness of the monitoring strategy for each sub-monitoring list and adjust the monitoring strategy for API monitoring, including: Preset the functional relationship between resource utilization and response time, and build a benchmark graph of the two; Determine the benchmark matching degree interval according to the monitoring strategy level of the sub-monitoring list; Monitor the resource utilization and response time of each API in the sub-monitoring list, integrate them, and build a real-time change chart of the two; Compare the baseline graph and the real-time change graph to get the matching degree; If the matching degree is within the benchmark matching degree range, the monitoring strategy will not be adjusted; Otherwise, the matching degree deviation is calculated, and the different resource allocation ratios at the business demand level, user demand level, and functional demand level are adjusted through the matching degree deviation.
5. The version control method based on API gateway as claimed in claim 1, It is characterized in that The API needs to be updated, including: The business requirements, performance requirements, and security vulnerability requirements of the quantified API meet the standards; If one or more of the API's business requirements, performance requirements, and security vulnerability requirements do not meet the preset corresponding thresholds, the API needs to be updated.
6. The version control method based on API gateway as claimed in claim 1, It is characterized in that Update the API version, including: Configure API version information in the API gateway, determine the version control method based on one or more of the API change frequency, client integration method, backward compatibility requirements, and security, and then perform version updates; Among them, version control methods include URL path control, HTTP header control and request parameter control.
7. A version control system based on an API gateway, using the version control method based on an API gateway according to any one of claims 1 to 6 above, It is characterized in that include: The first module is used to confirm all APIs managed by the API gateway and add these APIs to the monitoring list; The second module is used to obtain the monitoring log of the API gateway for the API and define the contribution level of the current version of each API in the monitoring list; The third module is used to split the monitoring list into multiple sub-monitoring lists according to the contribution level of the current version of the API, and determine the monitoring strategy of each sub-monitoring list; The fourth module is used to evaluate the effectiveness of the monitoring strategy of each sub-monitoring list and adjust the monitoring strategy for API monitoring; The fifth module is used to update the API version if a version update notification is received or the API is monitored to need to be updated.
Citation Information
Patent Citations
Micro-service upgrading plan evaluation method and system and computer equipment
CN114327555A
Method and device for realizing gray release based on API (Application Program Interface) gateway
CN117650985A
