A real-time code review processing method, system and related device

By acquiring and analyzing model context protocol link information in real time, combined with machine learning models, the problems of time-consuming and inaccurate code review have been solved, achieving a more accurate and efficient code review process.

CN120743725BActive Publication Date: 2025-11-04湖南长银五八消费金融股份有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511233009.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-01
Publication Date
2025-11-04
Estimated Expiration
2045-09-01

AI Technical Summary

Technical Problem

Existing code review methods are time-consuming and prone to errors due to reviewers' subjective judgment and fatigue, resulting in low accuracy.

Method used

Real-time acquisition of model context protocol link information, obtaining code execution path through distributed link tracing and performance monitoring tools, parsing into structured call link information, performing data analysis and matching with code address knowledge base, and using machine learning models for dynamic analysis to identify potential problems and optimization points.

Benefits of technology

It improves the comprehensiveness and accuracy of code review, provides detailed code review reports and suggestions, and assists development teams in efficiently developing and maintaining code.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120743725B_ABST
    Figure CN120743725B_ABST
Patent Text Reader

Abstract

The application discloses a real-time code review processing method and system and related equipment, relates to the technical field of code review, and acquires model context protocol link information in real time, so that a machine learning model can better understand the intention and context relationship of code, inputs the model context protocol link information, the intention and context relationship of code and other information into the machine learning model for analysis, dynamically understands the specific data performance of the code in the network, the overall structure and specific function of the code, identifies potential problems and optimization points based on the specific data performance of the code in the network, the overall structure and specific function of the code, and the like. The scheme can dynamically analyze and improve the model based on the specific function, calling path and other factors of the code, so that the comprehensiveness and accuracy of code review are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of code review technology, and more specifically, to a real-time code review processing method, system, and related equipment. Background Technology

[0002] Code review is a valuable but time-consuming process in software development. Current code review methods typically involve code reviewers or team members carefully examining the source code to ensure it conforms to coding standards and is logically correct.

[0003] However, existing code review methods are not only time-consuming, but may also introduce errors due to reviewers' subjective judgment and fatigue, resulting in low accuracy of code reviews.

[0004] Therefore, improving the accuracy of code review is a problem that this application urgently needs to solve. Summary of the Invention

[0005] In view of this, this application discloses a real-time code review processing method, system and related equipment, which aims to improve the comprehensiveness and accuracy of code review.

[0006] To achieve the above objectives, the disclosed technical solution is as follows:

[0007] The first aspect of this application discloses a real-time code review processing method, the method comprising:

[0008] Real-time acquisition of model context protocol link information;

[0009] The model context protocol link information is parsed to extract structured call link information;

[0010] The structured call chain information is integrated to form a call chain;

[0011] Data analysis is performed on the call chain to obtain data analysis information; wherein, the data analysis information includes at least the call response time, the number of calls, and the call chain complexity; the call chain complexity is determined by the node set and the call relationships between various services;

[0012] The services in the node set are matched with the code address knowledge base to obtain matching information;

[0013] The data analysis information and the matching information are analyzed to complete the real-time code review process.

[0014] Preferably, the real-time acquisition of model context protocol link information includes:

[0015] By using distributed tracing and performance monitoring tools, we can obtain real-time model context protocol link information of the code in the operating environment.

[0016] Preferably, parsing the model context protocol link information to extract structured call link information includes:

[0017] The parser parses the read model context protocol link information into structured call link information;

[0018] The call chain information includes at least the chain ID, interface address, service name, request start and end time, and the call relationship between the caller and the callee.

[0019] Preferably, the step of performing data analysis on the call chain to obtain data analysis information includes:

[0020] Obtain the request start time and request end time from the call chain;

[0021] The response time for each call is calculated based on the request start time and the request end time.

[0022] The number of times each service is called is counted within the same link ID in the call chain;

[0023] The call chain complexity is obtained by performing a chain complexity analysis based on the graph data structure.

[0024] Preferably, the step of matching the services in the node set with the code address knowledge base to obtain matching information includes:

[0025] Obtain the service name and code address from the node set, and the address of the distributed version control system in the knowledge base;

[0026] The service name and the address of the distributed version control system are mapped to obtain a mapping table; wherein the mapping table includes at least a service name field, a URL field of the distributed version control system repository, and a code path field;

[0027] The code repository information is obtained from the mapping table to complete the process of matching the services in the node set with the code address knowledge base to obtain matching information.

[0028] Preferably, the process of analyzing the data analysis information and the matching information to complete the real-time code review includes:

[0029] The data analysis information and the matching information are analyzed through Model Context Protocol Link Information Service, distributed version control system code, and artificial intelligence model to dynamically obtain the data performance of the code in the network.

[0030] Based on the code's performance data on the network, identify performance issues and provide optimization suggestions;

[0031] An analysis report is generated based on the performance issues and optimization suggestions to complete the real-time code review process.

[0032] A second aspect of this application discloses a real-time code review processing system, the system comprising:

[0033] The real-time acquisition unit is used to acquire model context protocol link information in real time.

[0034] The parsing and extraction unit is used to parse the model context protocol link information to extract structured call link information;

[0035] An integration unit is used to integrate the structured call chain information to form a call chain;

[0036] A data analysis unit is used to perform data analysis on the call chain to obtain data analysis information; wherein, the data analysis information includes at least the call response time, the number of calls, and the call chain complexity; the call chain complexity is determined by the node set and the call relationships between various services;

[0037] The matching unit is used to match the services in the node set with the code address knowledge base to obtain matching information;

[0038] The generation unit is used to analyze the data analysis information and the matching information to complete the real-time code review process.

[0039] Preferably, the real-time acquisition unit is specifically used to acquire the model context protocol link information of the code in the operating environment in real time through distributed link tracing and performance monitoring tools.

[0040] A third aspect of this application discloses a storage medium comprising stored instructions, wherein, when the instructions are executed, the device in which the storage medium resides executes the real-time code review processing method as described in any one of the first aspects.

[0041] The fourth aspect of this application discloses an electronic device including a memory and one or more instructions, wherein one or more instructions are stored in the memory and configured to be executed by one or more processors using the real-time code review processing method as described in any one of the first aspects.

[0042] As can be seen from the above technical solution, this application discloses a real-time code review processing method, system, and related equipment. It acquires model context protocol link information in real time, parses the model context protocol link information to extract structured call link information, integrates the structured call link information to form a call link, performs data analysis on the call link to obtain data analysis information, wherein the data analysis information includes at least call response time, statistical call count, and call link complexity. The call link complexity is determined by the node set and the call relationships between various services. The services in the node set are matched with the code address knowledge base to obtain matching information. The data analysis information and matching information are analyzed to complete the real-time code review process.

[0043] The beneficial effects of this application are as follows: Real-time acquisition of model context protocol link information allows machine learning models to better understand the intent and contextual relationships of the code. This information, along with the code's intent and contextual relationships, is input into the machine learning model for analysis, enabling a dynamic understanding of the code's specific data performance in the network, its overall structure, and its specific functions. Based on this understanding, potential problems and optimization points can be identified. This solution, based on the model context protocol, can dynamically analyze and improve the model according to factors such as the code's specific functions and call paths, thereby improving the comprehensiveness and accuracy of code review. Furthermore, based on feedback from the machine learning model, this solution can provide developers with specific and detailed code review reports and suggestions, assisting development teams in more efficient code development and maintenance, enhancing the model's generalization ability and analytical accuracy, and ultimately achieving more accurate and efficient identification of potential code problems. Attached Figure Description

[0044] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0045] Figure 1 This is a flowchart illustrating a real-time code review processing method disclosed in an embodiment of this application;

[0046] Figure 2 This is a schematic diagram of the process for obtaining data analysis information disclosed in an embodiment of this application;

[0047] Figure 3 This is a schematic diagram of the process for obtaining matching information disclosed in an embodiment of this application;

[0048] Figure 4 This is a schematic diagram illustrating the process of completing real-time code review as disclosed in an embodiment of this application;

[0049] Figure 5 This is a schematic diagram of the structure of a real-time code review and processing system disclosed in an embodiment of this application;

[0050] Figure 6 This is a schematic diagram of the structure of the electronic device disclosed in the embodiments of this application. Detailed Implementation

[0051] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0052] In this application, the terms "comprising," "including," or any other variations thereof are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0053] As the background technology shows, existing code review methods are not only time-consuming, but may also introduce errors due to the reviewer's subjective judgment and fatigue, resulting in low accuracy of code review.

[0054] To address the aforementioned issues, this application discloses a real-time code review processing method, system, and related equipment. This method acquires model context protocol link information in real time, enabling machine learning models to better understand the intent and contextual relationships of the code. The model context protocol link information, code intent, and contextual relationships are input into the machine learning model for analysis, dynamically understanding the code's specific data performance in the network, its overall structure, and its specific functions. Based on this understanding, potential problems and optimization points are identified. This solution, based on the model context protocol, can dynamically analyze and improve the model according to factors such as the code's specific functions and call paths, thereby enhancing the comprehensiveness and accuracy of code review. Furthermore, based on feedback from the machine learning model, this solution can provide developers with specific and detailed code review reports and suggestions, assisting development teams in more efficient code development and maintenance, enhancing the model's generalization ability and analytical accuracy, and thus achieving more accurate and efficient identification of potential code problems. Specific implementation methods are described in detail through the following embodiments.

[0055] It should be noted that the real-time code review processing method, system and related equipment provided in this application can be used in the technical field of code review, etc. The above is only an example and does not limit the application field of the real-time code review processing method, system and related equipment provided in this application.

[0056] refer to Figure 1 As shown in the figure, a real-time code review processing method disclosed in this application mainly includes the following steps:

[0057] S101: Real-time acquisition of Model Context Protocol (MCP) link information.

[0058] In S101, the MCP link information of the code in the operating environment is obtained in real time through the application programming interface (API) of distributed link tracing and performance monitoring tools (such as SkyWalking), and the MCP link information is stored in the database.

[0059] It should be noted that the performance monitoring tool is an open-source performance monitoring tool.

[0060] S102: Parse the MCP link information to extract structured call link information.

[0061] In S102, the parser parses the read MCP link information into structured call link information.

[0062] The call chain information includes, but is not limited to, the chain ID, interface address, service name, request start and end time, and the call relationship between the caller and the callee.

[0063] S103: Integrate the structured call chain information to form a call chain.

[0064] In S103, structured call chain information, such as chain ID, interface address, service name, request start and end time, and call relationship between caller and callee, is integrated into a complete call chain.

[0065] S104: Perform data analysis on the call chain to obtain data analysis information; the data analysis information includes at least the call response time, the number of calls, and the call chain complexity; the call chain complexity is determined by the set of nodes and the call relationships between various services.

[0066] The specific process of obtaining data analysis information, such as Figure 2 As shown. Specifically, it includes the following steps:

[0067] S201: Obtain the request start time and request end time from the call chain.

[0068] S202: Calculate the response time for each call based on the request start time and request end time.

[0069] S203: Count the number of times each service is called within the same link ID in the call chain.

[0070] S204: Perform link complexity analysis on the call chain based on the graph data structure to obtain the call chain complexity.

[0071] In S204, the call chain complexity is derived based on graph theory, i.e., graph data structures. The call chain is viewed as a directed graph. The expression for a directed graph is shown in formula (1).

[0072] G = (N, E) (1)

[0073] Where G is a directed graph; N is a set of nodes, which represents services; and E is a set of directed edges, which represents the call relationships between services. A graph data structure can be used to represent the call relationships between services to ensure the correctness of the call order.

[0074] To better understand the complexity of the call chain, an example is provided here:

[0075] For example, N = {User Service, Order Service}, the node set contains only two basic services, E = {(User Service, Order Service)}, the directed edge set has only one link, representing the user service calling the order service. In this case, the complexity of G is relatively low.

[0076] For example, N = {User Service, Product Service, Inventory Service, Payment Service, Logistics Service}, and the node set covers multiple core services, E = {(User Service, Product Service), (User Service, Order Service), (Order Service, Inventory Service), (Order Service, Payment Service), (Payment Service, Logistics Service)}.

[0077] The key concepts and formulas involved in graph theory and call chain analysis are as follows:

[0078] Node degree:

[0079] For nodes in a directed graph , in-degree The number of edges pointing to the node is represented by the formula shown in formula (2).

[0080] (2)

[0081] in, This represents the number of edges pointing to this node; Let A be a vertex in a directed graph; N is a node; N is the set of vertices; E is the set of edges connecting vertices; 1 is the indicator function, also called the characteristic function. When edge (v, u) belongs to edge set E, 1=1. If edge (v, u) does not belong to edge set E, then it is 0. Here, the out-degree of node v is obtained by counting the cases that satisfy (v, u)∈E.

[0082] For example, in the example, to calculate the in-degree of ServiceA, we would count the number of all edges pointing to ServiceA;

[0083] Out-degree of ServiceA This represents the number of edges originating from this node, and its calculation formula is shown in formula (3).

[0084] (3)

[0085] in, This represents the number of edges originating from this node; For nodes; Let A be a vertex in a directed graph; It is the set of edges that connect vertices.

[0086] For example, calculating the out-degree of serviceB means counting the number of edges originating from serviceB and pointing to other services.

[0087] Path Length:

[0088] The average shortest path length L is an important metric for directed graphs. It is defined as the average of the shortest path lengths between all pairs of nodes. Where N is the set of vertices; E is the set of edges.

[0089] set up Represents a node The shortest path length between node v and node v can be calculated using Dijkstra's algorithm, and the formula for calculating the average shortest path length L is shown in formula (4).

[0090] (4)

[0091] Where L is the average shortest path length; N is the set of vertices; u is a vertex in the directed graph; and v is a node. For nodes The shortest path length between node v and node v.

[0092] Diameter of the diagram:

[0093] The diameter D of the graph is the maximum value of the shortest path length between all pairs of nodes in the graph. The formula for calculating the diameter D of the graph is shown in formula (5).

[0094] (5)

[0095] The diameter of a graph reflects the distance between the two farthest nodes in the graph. In call chain analysis, it can represent the longest indirect call path on the call chain.

[0096] Clustering Coefficient:

[0097] For nodes Its local clustering coefficient Used to measure nodes The degree of interconnection between neighboring nodes. The calculation formula is shown in formula (6).

[0098] (6)

[0099] in, Local clustering coefficients; For nodes The degree; For nodes The clustering coefficient is the set of actual edges between neighboring nodes. In a call chain scenario, a high clustering coefficient means that there are also many mutual call relationships between multiple callers of a certain service, reflecting the local tightness of service calls.

[0100] Additional sample data:

[0101] Service and code address mapping data format

[0102] {

[0103] "services": [

[0104] {

[0105] "serviceName": "User Service",

[0106] "gitUrl": "https: / / github.com / example / userservice",

[0107] "codePath": "src / main / java / com / example / userservice"

[0108] },

[0109] {

[0110] "serviceName": "Order Service",

[0111] "gitUrl": "https: / / github.com / example / orderservice",

[0112] "codePath": "src / main / java / com / example / orderservice"

[0113] } ]

[0115] }

[0116] "interfaceCodeMapping": [

[0117] {

[0118] "serviceName": "User Service",

[0119] "operationName": "Create Order",

[0120] "interface": "POST / user / orders",

[0121] "codeFile": "user_service / controllers / order_controller.py"

[0122] },

[0123] {

[0124] "serviceName": "Order Service",

[0125] "operationName": "Create Order",

[0126] "interface": "POST / order / create",

[0127] "codeFile": "order_service / controllers / order_controller.py"

[0128] } ]

[0130] Link information data format:

[0131] {

[0132] "traceId": "1234567890abcdef", / / Link ID

[0133] "spans": [

[0134] {

[0135] "spanId": "0001", / / Call ID

[0136] "parentId": "0000", / / Parent caller ID, root caller ID is 0000

[0137] "serviceName": "User Service", / / Service Name

[0138] "operationName": "Get User Information", / / Operation Name

[0139] "startTime": 1633072800000, / / Request start time, millisecond-level timestamp

[0140] "endTime": 1633072801000, / / Request end time, millisecond-level timestamp

[0141] "duration": 1000, / / Duration of the call, in milliseconds

[0142] "tags": {

[0143] "http.method": "GET",

[0144] "http.url": "http: / / userservice / api / user / 123"

[0145] },

[0146] "logs": [

[0147] {

[0148] "timestamp": 1633072800500, / / Log timestamp

[0149] "event": "SQL query execution" / / Log event

[0150] } ]

[0152] },

[0153] {

[0154] "spanId": "0002",

[0155] "parentId": "0001",

[0156] "serviceName": "Order Service",

[0157] "operationName": "Create Order",

[0158] "startTime": 1633072801500,

[0159] "endTime": 1633072802500,

[0160] "duration": 1000,

[0161] "tags": {

[0162] "http.method": "POST",

[0163] "http.url": "http: / / orderservice / api / order"

[0164] },

[0165] "logs": [

[0166] {

[0167] "timestamp": 1633072802000,

[0168] "event": "Inventory check"

[0169] } ]

[0171] } ]

[0173] }

[0174] Mcp provides AI-recognizable data formats:

[0175] {

[0176] "traceId": "1234567890abcdef", / / Trace ID, uniquely identifying a complete call chain.

[0177] "topology": {

[0178] "nodes": [

[0179] {

[0180] "id": "User Service", / / Node ID, representing the service name

[0181] "name": "User Service" / / Node name, same as ID, used for display in the graph.

[0182] },

[0183] {

[0184] "id": "Order Service", / / Node ID, representing the service name

[0185] "name": "Order Service" / / Node name, same as ID, used for display in the graph.

[0186] }

[0187] ],

[0188] "edges": [

[0189] {

[0190] "source": "User Service", / / Caller Service Name

[0191] "target": "Order Service", / / Name of the service being called

[0192] "label": "Create Order" / / Operation name used for display in the graph

[0193] } ]

[0195] },

[0196] "responseTimeStats": {

[0197] "average": 1000, / / Average response time (milliseconds)

[0198] "max": 1500, / / Maximum response time (milliseconds)

[0199] "min": 500 / / Minimum response time (milliseconds)

[0200] },

[0201] "callCountStats": {

[0202] "User Service": 100, / / Number of times the user service is called

[0203] "Order Service": 50 / / Number of times the order service is called

[0204] },

[0205] "performanceBottlenecks": [

[0206] {

[0207] "serviceName": "Order Service", / / Service name where performance bottleneck exists

[0208] "operationName": "Create Order", / / Operation name that has a performance bottleneck

[0209] "issue": "Response time too long", / / Problem description

[0210] "suggestion": "Optimize database queries and reduce network latency" / / Optimization suggestion

[0211] }

[0212] ],

[0213] "optimizationSuggestions": [

[0214] {

[0215] "category": "Performance Optimization", / / Category of optimization suggestions

[0216] "details": "Optimize database queries, reduce network latency, and add caching mechanisms" / / Detailed optimization suggestions

[0217] },

[0218] {

[0219] "category": "code optimization", / / Category of optimization suggestions

[0220] "details": "Refactor code logic, reduce redundant operations, and improve code efficiency" / / Detailed optimization suggestions

[0221] },

[0222] {

[0223] "category": "Resource allocation optimization", / / Category of optimization suggestions

[0224] "details": "Adjust server configuration, add load balancer nodes, and optimize resource allocation" / / Details of optimization suggestions

[0225] } ]

[0227] }

[0228] S105: Match the services in the node set with the code address knowledge base to obtain matching information.

[0229] The specific process of obtaining matching information, such as Figure 3 As shown, the specific steps include the following:

[0230] S301: Retrieves the service name and code address from the node set and the address of the distributed version control system (GIT) in the knowledge base.

[0231] The Git address refers to the Git address of the project code in the code address knowledge base.

[0232] S302: Map the service name and the Git address to obtain a mapping table and store it in the database; the mapping table shall include at least the service name field, the Uniform Resource Locator (URL) field of the distributed version control system (GIT) repository, and the code path field.

[0233] S303: Retrieve code repository information from the mapping table to match the services in the node set with the code address knowledge base and obtain matching information.

[0234] In S303, information about the code repository can be obtained using methods such as the Git API.

[0235] The matching information is the information of the code repository, which includes, but is not limited to, commit history, code changes, etc.

[0236] S106: Analyze data analysis and matching information to complete the real-time code review process.

[0237] In S106, data analysis and matching information are analyzed to identify potential performance issues and optimization suggestions, thereby generating a detailed analysis report.

[0238] Specifically, the data analysis and matching information are analyzed to complete the real-time code review process, such as... Figure 4 As shown, the specific steps include the following:

[0239] S401: Through MCP link information service, Git code and artificial intelligence (AI) model (machine learning model), analyze data analysis information and matching information to dynamically obtain the data performance of the code in the network (i.e., understanding the overall structure and specific functions of the code).

[0240] In S401, the MCP link information service and Git code are combined to use an AI big model to analyze the call link information in order to dynamically understand the data performance of the code in the network.

[0241] The data representation of code on the network includes the overall structure of the code and the understanding of its specific functions.

[0242] S402: Based on the code's performance data on the network, identify performance issues and provide optimization suggestions.

[0243] The optimization suggestions include, but are not limited to, performance optimization suggestions, code optimization suggestions, and resource allocation optimization suggestions.

[0244] S403: Generates analysis reports based on performance issues and optimization suggestions to complete the real-time code review process.

[0245] In S403, an analysis report is generated based on the report generator, performance issues, and optimization suggestions.

[0246] The report generator's function is to generate detailed review reports based on the context information model provided by the MCP protocol and then provide feedback to the user.

[0247] The report includes, but is not limited to, the following: the topology of the call chain, call response time statistics, call count statistics, performance bottleneck analysis, and optimization suggestions.

[0248] The following is an example of the content of a specific analysis report:

[0249] Call chain topology:

[0250] When a user service is obtained, an order is created based on the user service, and the order service is provided through the order.

[0251] The call response time statistics are shown in Table 1.

[0252] Table 1

[0253]

[0254] The number of calls is shown in Table 2.

[0255] Table 2

[0256]

[0257] Performance bottleneck analysis is shown in Table 3.

[0258] Table 3

[0259]

[0260] The optimization suggestions include performance optimization, code optimization, and resource allocation optimization.

[0261] Performance optimization:

[0262] Optimize database queries, reduce network latency, and add caching mechanisms.

[0263] Code optimizations are shown in Table 4.

[0264] Table 4

[0265]

[0266] Resource allocation optimization:

[0267] Based on the report analysis, resource allocation optimization was carried out. Specifically, server configuration was adjusted and load balancing nodes were added to optimize resource allocation.

[0268] This application utilizes the MCP protocol to enhance the intelligence and accuracy of the code review process. Specifically, firstly, the MCP protocol is used to acquire information in real time about the execution path of the code in the operating environment and related code call relationships. Then, this information is input into a machine learning model for analysis to dynamically understand how the code performs on specific data within the network. Secondly, based on its understanding of the overall code structure and specific functions, the machine learning model identifies potential problems and optimization points. Finally, based on the feedback from the machine learning model, specific and detailed code review reports and suggestions are provided to developers to assist the development team in more efficient code development and maintenance.

[0269] By acquiring information such as code execution paths in real time, this application dynamically analyzes and improves the accuracy and efficiency of code review. It aims to introduce the MCP protocol to enable machine learning models to better understand the intent and context of the code, enhancing the model's generalization ability and analytical accuracy, thereby achieving more precise and efficient identification of potential code problems. The method implemented based on the MCP protocol can dynamically analyze and improve the model according to factors such as the specific function and call path of the code, thus improving the comprehensiveness and accuracy of code review.

[0270] The beneficial effects of this application's embodiments are as follows: Real-time acquisition of model context protocol link information allows machine learning models to better understand the intent and contextual relationships of the code. The model context protocol link information, code intent, and contextual relationships are input into the machine learning model for analysis, dynamically understanding the code's specific data performance in the network, its overall structure, and its specific functions. Based on this understanding, potential problems and optimization points are identified. This solution, based on the model context protocol, can dynamically analyze and improve the model according to factors such as the code's specific functions and call paths, thereby improving the comprehensiveness and accuracy of code review. Furthermore, based on feedback from the machine learning model, this solution can provide developers with specific and detailed code review reports and suggestions, assisting development teams in more efficient code development and maintenance, enhancing the model's generalization ability and analytical accuracy, and thus achieving more accurate and efficient identification of potential code problems.

[0271] Based on the above embodiments Figure 1 The present application discloses a real-time code review processing method and a corresponding real-time code review processing system. The real-time code review processing system is as follows: Figure 5 As shown, the real-time code review processing system includes:

[0272] Real-time acquisition unit 501 is used to acquire model context protocol link information in real time;

[0273] The parsing and extraction unit 502 is used to parse the model context protocol link information in order to extract structured call link information;

[0274] Integration unit 503 is used to integrate structured call chain information to form a call chain;

[0275] The data analysis unit 504 is used to perform data analysis on the call chain to obtain data analysis information; wherein, the data analysis information includes at least the call response time, the number of calls, and the call chain complexity; the call chain complexity is determined by the node set and the call relationship between various services;

[0276] Matching unit 505 is used to match the services in the node set with the code address knowledge base to obtain matching information;

[0277] The generation unit 506 is used to analyze data analysis information and matching information to complete the real-time code review process.

[0278] Furthermore, the real-time acquisition unit 501 is specifically used to acquire the model context protocol link information of the code in the operating environment in real time through distributed link tracing and performance monitoring tools.

[0279] Furthermore, the parsing and extraction unit 502 is specifically used to parse the read model context protocol link information into structured call link information through a parser; wherein, the call link information includes at least the link ID, interface address, service name, request start and end time, and call relationship between the caller and the callee.

[0280] Furthermore, the data analysis information includes at least the response time, number of calls, and call chain complexity for each call. Data analysis unit 504 includes:

[0281] The first acquisition module is used to obtain the request start time and request end time from the call chain;

[0282] The calculation module is used to calculate the response time of each call based on the request start time and request end time;

[0283] The statistics module is used to count the number of times each service is called within the same link ID in the call chain;

[0284] The first analysis module is used to perform link complexity analysis on the call chain based on the graph data structure, and obtain the call chain complexity.

[0285] Furthermore, the matching unit 505 includes:

[0286] The second acquisition module is used to acquire the service name and code address in the node set and the address of the distributed version control system in the knowledge base.

[0287] The mapping module is used to map service names to the addresses of the distributed version control system to obtain a mapping table; wherein the mapping table includes at least a service name field, a URL field of the distributed version control system repository, and a code path field;

[0288] The third acquisition module is used to retrieve code repository information from the mapping table in order to complete the process of matching the services in the node set with the code address knowledge base and obtaining matching information.

[0289] Furthermore, the generating unit 506 includes:

[0290] The second analysis module is used to analyze data analysis information and matching information through model context protocol link information service, distributed version control system code and artificial intelligence model, so as to dynamically obtain the data performance of the code in the network.

[0291] The identification module is used to identify performance issues and provide optimization suggestions based on the code's performance data on the network.

[0292] The generation module is used to generate analysis reports based on performance issues and optimization suggestions to complete the real-time code review process.

[0293] The beneficial effects of this application's embodiments are as follows: Real-time acquisition of model context protocol link information allows machine learning models to better understand the intent and contextual relationships of the code. The model context protocol link information, code intent, and contextual relationships are input into the machine learning model for analysis, dynamically understanding the code's specific data performance in the network, its overall structure, and its specific functions. Based on this understanding, potential problems and optimization points are identified. This solution, based on the model context protocol, can dynamically analyze and improve the model according to factors such as the code's specific functions and call paths, thereby improving the comprehensiveness and accuracy of code review. Furthermore, based on feedback from the machine learning model, this solution can provide developers with specific and detailed code review reports and suggestions, assisting development teams in more efficient code development and maintenance, enhancing the model's generalization ability and analytical accuracy, and thus achieving more accurate and efficient identification of potential code problems.

[0294] This application also provides a storage medium that includes stored instructions, wherein when the instructions are executed, the device where the storage medium is located is controlled to perform the real-time code review processing method described above.

[0295] This application also provides an electronic device, the structural schematic diagram of which is shown below. Figure 6 As shown, it specifically includes a memory 601 and one or more instructions 602, wherein one or more instructions 602 are stored in the memory 601 and are configured to be executed by one or more processors 603 to perform the above-mentioned real-time code review processing method.

[0296] For the foregoing method embodiments, in order to simplify the description, they are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, because according to this application, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0297] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For apparatus embodiments, since they are basically similar to method embodiments, the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.

[0298] The steps in the methods of the various embodiments of this application can be adjusted, combined, or deleted according to actual needs.

[0299] Finally, it should be noted that in this paper, relational terms such as first and second are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations.

[0300] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

[0301] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A real-time code review processing method, characterized in that, The method includes: Real-time acquisition of model context protocol link information; The model context protocol link information is parsed to extract structured call link information; The structured call chain information is integrated to form a call chain; Data analysis is performed on the call chain to obtain data analysis information; wherein, the data analysis information includes at least the call response time, the number of calls, and the call chain complexity; the call chain complexity is determined by the node set and the call relationships between various services; The services in the node set are matched with the code address knowledge base to obtain matching information; The data analysis information and the matching information are analyzed to complete the real-time code review process; The process of analyzing the data analysis information and the matching information to complete real-time code review includes: The data analysis information and the matching information are analyzed through Model Context Protocol Link Information Service, distributed version control system code, and artificial intelligence model to dynamically obtain the data performance of the code in the network. Based on the code's performance data on the network, identify performance issues and provide optimization suggestions; An analysis report is generated based on the performance issues and optimization suggestions to complete the real-time code review process.

2. The method according to claim 1, characterized in that, The real-time acquisition of model context protocol link information includes: By using distributed tracing and performance monitoring tools, we can obtain real-time model context protocol link information of the code in the operating environment.

3. The method according to claim 1, characterized in that, The step of parsing the model context protocol link information to extract structured call link information includes: The parser parses the read model context protocol link information into structured call link information; The call chain information includes at least the chain ID, interface address, service name, request start and end time, and the call relationship between the caller and the callee.

4. The method according to claim 1, characterized in that, The data analysis of the call chain to obtain data analysis information includes: Obtain the request start time and request end time from the call chain; The response time for each call is calculated based on the request start time and the request end time. The number of times each service is called is counted within the same link ID in the call chain; The call chain complexity is obtained by performing a chain complexity analysis based on the graph data structure.

5. The method according to claim 1, characterized in that, The step of matching the services in the node set with the code address knowledge base to obtain matching information includes: Obtain the service name and code address from the node set, and the address of the distributed version control system in the knowledge base; The service name and the address of the distributed version control system are mapped to obtain a mapping table; wherein the mapping table includes at least a service name field, a URL field of the distributed version control system repository, and a code path field; The code repository information is obtained from the mapping table to complete the process of matching the services in the node set with the code address knowledge base to obtain matching information.

6. A real-time code review and processing system, characterized in that, The system includes: The real-time acquisition unit is used to acquire model context protocol link information in real time. The parsing and extraction unit is used to parse the model context protocol link information to extract structured call link information; An integration unit is used to integrate the structured call chain information to form a call chain; A data analysis unit is used to perform data analysis on the call chain to obtain data analysis information; wherein, the data analysis information includes at least the call response time, the number of calls, and the call chain complexity; the call chain complexity is determined by the node set and the call relationships between various services; The matching unit is used to match the services in the node set with the code address knowledge base to obtain matching information; A generation unit is used to analyze the data analysis information and the matching information to complete the real-time code review process; The generation unit includes: The second analysis module is used to analyze the data analysis information and the matching information through the Model Context Protocol Link Information Service, the distributed version control system code, and the artificial intelligence model, so as to dynamically obtain the data performance of the code in the network. The identification module is used to identify performance issues and provide optimization suggestions based on the code's performance data on the network. The generation module is used to generate an analysis report based on the performance issues and optimization suggestions to complete the real-time code review process.

7. The system according to claim 6, characterized in that, The real-time acquisition unit is specifically used to acquire the model context protocol link information of the code in the operating environment in real time through distributed link tracing and performance monitoring tools.

8. A storage medium, characterized in that, The storage medium includes stored instructions, wherein, when the instructions are executed, the device containing the storage medium is controlled to perform the real-time code review processing method as described in any one of claims 1 to 5.

9. An electronic device, characterized in that, It includes a memory, and one or more instructions, wherein one or more instructions are stored in the memory and configured to be executed by one or more processors as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Code fault positioning method, device and apparatus and storage medium

    CN111382023A

  • Code analysis method and system and readable storage medium

    CN117193852A