Error log automatic repair method, system, device and storage medium

CN122884737APending Publication Date: 2026-10-09SANGFOR TECH INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611132201.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-28
Publication Date
2026-10-09

AI Technical Summary

Technical Problem

[0004]本发明提供了一种报错日志自动修复方法、系统、设备及存储介质,以至少解决相关技术中从运行环境产生报错日志到修复故障的过程效率低下的问题

Benefits of technology

[0015]通过本发明,由于在研发环境侧获取由运行环境同步而来的报错日志,并据此自动创建修复任务的提示词、调用预训练语言模型对报错日志进行分析并生成修复代码,再经测试验证后自动生成包含报错日志、分析结果及修复代码的合并请求以供人工复核,形成报错日志的获取、分析、修复、验证与请求提交的完整自动化处理流程,无需开发人员在运行环境与研发环境之间逐环节人工搬运日志与代码,因此,可以解决相关技术中故障修复依赖人工逐环节衔接、自动化程度低的技术问题,达到缩短故障修复周期、降低对开发人员经验依赖、并在运行环境与研发环境相互隔离的约束下仍能自动完成报错日志到代码修复的技术效果。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122884737A_ABST
    Figure CN122884737A_ABST
Patent Text Reader

Abstract

The application discloses an error log automatic repairing method, system and device and a storage medium, relates to the technical field of computers, and comprises the following steps: acquiring error logs synchronized from a running environment on a research and development environment side, automatically creating a repair task prompt word according to the error logs, calling a pre-trained language model to analyze the error logs and generate repair codes, automatically generating a merging request containing the error logs, analysis results and repair codes for manual review after test verification, forming a complete automatic processing flow of error log acquisition, analysis, repair, verification and request submission, and eliminating the need for a developer to manually transport logs and codes between the running environment and the research and development environment, so that the problems of manual link-by-link connection for fault repair and low automation in the prior art can be solved, the fault repair cycle is shortened, the dependence on the experience of the developer is reduced, and the error log to code repair can be automatically completed under the isolation of the running environment and the research and development environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to an automatic error log repair method, system, device, and storage medium. Background Technology

[0002] As software systems grow in scale, the number of error logs generated during operation increases dramatically, placing higher demands on the rapid repair of faults in the Development and Operations (DevOps) process. Currently, related technologies rely on manual experience for fault diagnosis after error logs are generated in the runtime environment. Operations personnel often spend a significant amount of time on environment reproduction and code debugging, resulting in long Mean Time To Repair (MTTR) times and low efficiency.

[0003] Improving the efficiency of repairing error logs generated in the operation and maintenance environment is a technical problem that needs to be solved by those skilled in the art. Summary of the Invention

[0004] This invention provides an automatic error log repair method, system, device, and storage medium to at least solve the problem of low efficiency in the process from generating error logs in the operating environment to repairing faults in related technologies.

[0005] To solve the above technical problems, the present invention provides an automatic error log repair method, comprising: Obtain error logs synchronized from the runtime environment to the development environment; Based on the error log, create prompts for the repair task; The prompt words are input into a pre-trained language model so that the pre-trained language model can analyze the error log and generate repair code; The repair code was tested and verified. After the test is passed, a merge request is generated, which includes the error log, analysis results and the repair code, for manual review and merging.

[0006] Optionally, the error log synchronized from the runtime environment to the development environment is a valid error log captured in the runtime environment, filtered and deduplicated, and then unidirectionally encrypted and synchronized to the development environment; the valid error log is a newly appearing error log that is not in the whitelist.

[0007] Optionally, sensitive information in the prompt words can be de-identified; The step of inputting the prompt word into the pre-trained language model includes: The desensitized prompts are sent to a pre-trained language model located outside the R&D environment via the network forwarding layer.

[0008] Optionally, the prompt words for creating a repair task based on the error log include: Obtain an overview of the target code project's framework; The error log, the context information corresponding to the error log, and the framework overview information are assembled into the prompt word.

[0009] Optionally, the testing and verification of the repair code includes: The original data that caused the error is input into the pre-trained language model to obtain test cases generated by the pre-trained language model for the error. Run the test cases to test and verify the fixed code.

[0010] Optionally, generating the merge request includes: The merge request is generated according to the preset template; The preset template includes the original error message, error analysis, repair plan, and test record. The original error message is the error log, the error analysis is the analysis result, the repair plan includes the repair code, and the test record is the execution result of the test verification.

[0011] Optional, also includes: If the merger request is rejected, The rejection reason is fed back to the pre-trained language model, so that the pre-trained language model re-analyzes the error log and generates new fix code. The test verification and the steps of generating the merge request are repeated for the new fix code until the merge request passes manual review or reaches the preset number of retries. And / or, add the error type corresponding to the merge request to the whitelist used to filter the error logs.

[0012] To address the aforementioned technical problems, the present invention also provides an automatic error log repair system, comprising a log processing device located on the operating environment side and a repair device located on the research and development environment side; The log processing device is used to capture error logs from the operating environment, preprocess the error logs, and then synchronize them to the development environment. The repair device is used to acquire the error log, create prompt words for the repair task based on the error log, input the prompt words into a pre-trained language model to analyze the error log and generate repair code, test and verify the repair code, and generate a merge request containing the error log, analysis results and repair code after the test is passed, so that they can be merged after manual review.

[0013] To address the aforementioned technical problems, the present invention also provides an electronic device, comprising: The first memory is used to store computer programs; A first processor is configured to implement the steps of the automatic error log repair method as described in any of the preceding embodiments when executing the computer program.

[0014] To address the aforementioned technical problems, the present invention also provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of the automatic error log repair method as described in any of the preceding claims.

[0015] This invention achieves a complete automated process for acquiring, analyzing, repairing, verifying, and submitting error logs. It obtains error logs synchronized from the runtime environment in the development environment, automatically creates prompts for repair tasks, analyzes the error logs using a pre-trained language model, generates repair code, and automatically generates a merge request containing the error logs, analysis results, and repair code for manual review after testing and verification. This eliminates the need for developers to manually transfer logs and code between the runtime and development environments step by step. Therefore, it solves the technical problems of low automation and reliance on manual step-by-step coordination in fault repair in related technologies. This results in shorter fault repair cycles, reduced dependence on developer experience, and automatic completion of error log-to-code repair even under the constraint of isolation between the runtime and development environments. Attached Figure Description

[0016] To more clearly illustrate the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 An architecture diagram of an automatic error log repair system provided in an embodiment of the present invention; Figure 2 A flowchart of the first automatic error log repair method provided in this embodiment of the invention; Figure 3A flowchart of a second automatic error log repair method provided in an embodiment of the present invention. Detailed Implementation

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

[0019] It should be noted that, in the description of this invention, the terms "comprising," "including," or any other variations thereof are intended to cover 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. The terms "first," "second," etc., used in this invention are used to distinguish similar objects and are not used to describe a specific order or sequence.

[0020] To enable those skilled in the art to better understand the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0021] Here, we will first explain some key terms used in the embodiments of the present invention.

[0022] Container orchestration platform (Kubernetes, k8s): An open-source container orchestration platform used to automatically deploy, scale, and manage containerized applications.

[0023] Pod: A deployment unit in Kubernetes that contains one or more interconnected containers.

[0024] Log: A record file generated by a computer system, device, or software program during operation to record operating status, error messages, and operation processes.

[0025] Development and Operations (DevOps): A collective term for a set of methods and tools used to facilitate communication and collaboration among development, technical operations, and quality assurance.

[0026] Pull Request (PR): A request initiated by a developer on a code hosting platform to merge code changes into a target branch.

[0027] Artificial Intelligence for IT Operations (AIOps): Applying artificial intelligence to the field of IT operations and maintenance for automatic monitoring, fault prediction, and fault handling.

[0028] Mean Time To Repair (MTTR): The average time required from the occurrence of a fault to its repair.

[0029] Application Programming Interface (API): An interface for different software to make calls and exchange data.

[0030] Abstract Syntax Tree (AST): A method of representing the syntactic structure of program code in a tree-like format.

[0031] Pre-trained language models: Language models that have been pre-trained and are capable of understanding and generating text and code.

[0032] MongoShake is a data synchronization tool used for synchronizing, replicating, and transferring data between document databases, such as MongoDB.

[0033] In software development and operations, troubleshooting the runtime environment (also known as the production environment) is a time-consuming and high-risk process. A common process is as follows: when a container group (Pod) in the runtime environment generates an error, operations personnel discover the error through the log platform, manually analyze the stack trace of the error to locate the corresponding code, write the fix locally, submit the code for review, and finally deploy it online.

[0034] Because the complexity of the runtime environment is far greater than that of the development environment, the handling of software errors in the runtime environment in related technologies mainly relies on human experience for fault diagnosis. Although some alarm tools and log analysis tools based on preset rules exist, these tools can only serve as notifications and cannot automatically understand the root cause of the fault or automatically generate repair code. Developers need to spend a lot of time on environment reproduction and code debugging, resulting in a long Mean Time To Repair (MTTR). Furthermore, manual repair is prone to oversights, and for less experienced developers, handling errors generated in complex runtime environments is particularly difficult.

[0035] To address the inefficiency of the process from generating error logs in the runtime environment to repairing faults in related technologies, this invention provides an automatic error log repair method, system, device, and storage medium. It acquires error logs synchronized from the runtime environment in the development environment, automatically creates prompts for repair tasks, calls a pre-trained language model to analyze the error logs and generate repair code, and automatically generates a merge request containing the error logs, analysis results, and repair code after testing and verification for manual review. This forms a complete automated processing flow for acquiring, analyzing, repairing, verifying, and submitting error logs, eliminating the need for developers to manually transfer logs and code between the runtime and development environments step by step. Therefore, it solves the technical problems of low automation and reliance on manual step-by-step connection for fault repair in related technologies, achieving the technical effects of shortening the fault repair cycle, reducing dependence on developer experience, and automatically completing the error log to code repair process even under the constraint of isolation between the runtime and development environments.

[0036] Figure 1 This is an architecture diagram of an automatic error log repair system provided in an embodiment of the present invention.

[0037] The specific application environment architecture or specific hardware architecture on which the automatic error log repair method depends is described here.

[0038] like Figure 1 As shown, the automatic error log repair system provided in this embodiment of the invention may include a log processing device located on the operating environment side and a repair device located on the research and development environment side.

[0039] Log processing equipment is used to capture error logs from the runtime environment, preprocess the error logs, and then synchronize them to the development environment.

[0040] The repair equipment is used to obtain error logs, create prompts for repair tasks based on the error logs, input the prompts into a pre-trained language model to analyze the error logs and generate repair code, test and verify the repair code, and generate a merge request containing error logs, analysis results and repair code after the test is passed, so that they can be merged after manual review.

[0041] like Figure 1 As shown, the automatic error log repair system includes a log processing device 10 located in the operating environment and a repair device 20 located in the development environment. The operating environment and the development environment are two isolated network environments.

[0042] Log processing device 10 is deployed on the runtime environment side to capture error logs generated in the runtime environment, filter and deduplicate the error logs to obtain valid error logs, and synchronize the valid error logs to the development environment side. In some optional embodiments of the present invention, log processing device 10 may include a log acquisition module 11, a filtering and deduplication module 12, and a first storage module 13. Log acquisition module 11 is used to read the standard output and error output of the target software unit (such as a container group (Pod)) in the runtime environment in real time. Filtering and deduplication module 12 is used to preprocess the errors of the target software unit, such as removing logs in the whitelist and duplicate stack trace information, and retaining valid error logs. First storage module 13 is used to store the preprocessed error logs in a structured manner according to a preset data format (such as JSON).

[0043] The repair device 20 is deployed in the R&D environment to acquire valid error logs, create prompt words based on the error logs, input the prompt words into a pre-trained language model 30, which analyzes the error logs and generates repair code. The repair code is then tested and verified, and a merge request is generated upon successful testing. In some optional embodiments of this invention, the repair device 20 may include an acquisition module 21, a prompt word construction module 22, a model invocation module 23, a testing and verification module 24, and a merge request generation module 25. The acquisition module 21 acquires valid error logs synchronized from the runtime environment to the R&D environment. The prompt word construction module 22 creates prompt words for the repair task based on the error logs. The model invocation module 23 inputs the prompt words into the pre-trained language model 30 and receives the analysis results and repair code output by the pre-trained language model 30. The testing and verification module 24 tests and verifies the repair code. The merge request generation module 25 generates a merge request upon successful testing.

[0044] The pre-trained language model 30 can be located outside the development environment. Before the model invocation module 23 sends the prompt words to the pre-trained language model 30, the model invocation module 23 can desensitize the sensitive information in the prompt words and send the desensitized prompt words to the pre-trained language model 30 through the network forwarding layer.

[0045] The automatic error log repair system provided in this embodiment of the invention deploys the log processing device on the runtime environment side and the repair device on the development environment side. The log processing device synchronizes valid error logs to the development environment side for the repair device to use. Therefore, even when the runtime environment and the development environment are isolated from each other, the repair device on the development environment side can complete the acquisition, analysis, repair, verification and merging requests of error logs. This improves the degree of automation in the process of error logs to code repair and reduces the reliance on manual handling and human experience.

[0046] The embodiments of the present invention provide an automatic error log repair method. The method is described in detail below in conjunction with the execution flow of the automatic error log repair method.

[0047] Figure 2 A flowchart of the first automatic error log repair method provided in the embodiments of the present invention.

[0048] like Figure 2 As shown, the automatic error log repair method provided in this embodiment of the invention may include S201~S205.

[0049] S201: Obtain error logs synchronized from the runtime environment to the development environment.

[0050] In practical implementation, the automatic error log repair method provided in this embodiment of the invention is applied to devices on the R&D environment side. Error logs generated on the runtime environment side are preprocessed and then synchronized to the R&D environment, where devices obtain these error logs. The error logs record error information generated during software runtime in the runtime environment, and may include stack traces and error codes. Devices on the R&D environment side can obtain the error logs generated by the runtime environment without directly accessing it.

[0051] S202: Prompt words for creating a repair task based on the error log.

[0052] In practice, the equipment in the R&D environment assembles prompt words based on the acquired error logs. The prompt words are text content input to the pre-trained language model, used to instruct the pre-trained language model to analyze and repair the error logs.

[0053] S203: Input the prompt words into the pre-trained language model so that the pre-trained language model can analyze the error log and generate repair code.

[0054] In practice, the assembled prompts are input into a pre-trained language model, which analyzes the root cause of the error log and generates fix code based on the analysis results. The fix code can be represented as a data difference (Diff) table, showing the differences between the code before and after the modification. The pre-trained language model can be a general-purpose pre-trained language model or a pre-trained language model trained or fine-tuned based on historical fix records and other information.

[0055] S204: Test and verify the fix code.

[0056] In practice, the fix code is executed in an isolated runtime environment, and corresponding tests are run to determine if the fix code is correct. If the tests pass, the fix is ​​considered effective.

[0057] S205: After the test passes, a merge request is generated. The merge request includes error logs, analysis results, and fix code for manual review and merging.

[0058] In practice, once the test passes, the equipment in the R&D environment generates a pull request (PR), which includes error logs, analysis results, and fix code. The pull request is then submitted for manual review, and the merge is performed after confirmation.

[0059] The automatic error log repair method provided in this invention obtains error logs synchronized from the runtime environment in the development environment, automatically creates prompts for repair tasks based on these logs, calls a pre-trained language model to analyze the error logs and generate repair code, and then automatically generates a merge request containing the error logs, analysis results, and repair code after testing and verification for manual review. This forms a complete automated processing flow for obtaining, analyzing, repairing, verifying, and submitting error logs, eliminating the need for developers to manually transfer logs and code between the runtime and development environments step by step. Therefore, it can solve the technical problems of low automation and reliance on manual step-by-step connection in fault repair in related technologies, achieving the technical effects of shortening the fault repair cycle, reducing reliance on developer experience, and automatically completing the error log to code repair even under the constraint of mutual isolation between the runtime and development environments.

[0060] Figure 3 A flowchart of a second automatic error log repair method provided in an embodiment of the present invention.

[0061] Based on the above embodiments, this embodiment of the invention further describes the process of obtaining and synchronizing error logs, and combines... Figure 3 A more complete implementation of the automatic error log repair method provided in this invention is given.

[0062] In this embodiment of the invention, a scheduled task (Cron Job) can be deployed on the R&D environment side to query the error logs stored on the R&D environment side at preset time intervals, and identify new error logs by comparing the identifiers of processed records. The preset time interval can be determined according to the frequency of error occurrence and system resource conditions, for example, set to 1 minute, or a value between 30 seconds and 5 minutes. When errors occur frequently, the time interval can be appropriately shortened. When a new error log is identified, a repair task is started, which can be executed asynchronously.

[0063] In some optional embodiments of the present invention, the error log synchronized from the runtime environment to the development environment can be a valid error log captured in the runtime environment and then encrypted and synchronized to the development environment in a one-way manner after being filtered and deduplicated; the valid error log is a newly appearing error log that is not in the whitelist.

[0064] Specifically, the error logs obtained from the development environment can be valid error logs captured and processed by the runtime environment and then synchronized. On the runtime environment side, the standard output and error output of the target software unit (such as a container group (Pod)) are read in real time, and then the read logs are filtered and deduplicated. Filtering refers to removing logs from the whitelist, and deduplication refers to removing duplicate errors. Valid error logs refer to newly appearing error logs that are not on the whitelist. For errors that are not appearing for the first time, filtering is performed based on the whitelist. This embodiment of the invention attempts to repair all valid error logs, not just those with specific error codes or levels.

[0065] The processed and valid error logs can be structured and stored in a data exchange format (JavaScript Object Notation, JSON), and then synchronized to the development environment via one-way encrypted synchronization. One-way encrypted synchronization means that data flows only from the runtime environment to the development environment, and is encrypted during transmission. In one specific implementation, MongoShake, a data synchronization tool between document databases (MongoDB), can be used to perform one-way incremental synchronization. This tool has data compression, encryption, and breakpoint resumption capabilities. In another specific implementation, synchronization tools for other databases can be used, such as Canal, a data synchronization tool for relational databases (MySQL), or a custom Application Programming Interface (API) transmission method can be employed.

[0066] Since the R&D environment obtains valid error logs that have been filtered, deduplicated, and then encrypted and synchronized in one direction, it avoids the recurrence of errors and errors that have been confirmed to not need to be fixed from occupying repair resources. On the other hand, since the data only flows unidirectionally from the runtime environment to the R&D environment and is transmitted in an encrypted manner, it is beneficial to protect the security of code data in the R&D environment.

[0067] In other specific implementations, the source of error logs is not limited to container group (Pod) error logs, but can also be physical machine logs, serverless function logs, operating system logs, cloud service logs, or standard error output from other applications. This embodiment of the invention also applies to error logs from the above sources.

[0068] In this embodiment of the invention, different handling methods can be adopted when the same error occurs repeatedly. One method is to trigger a repair task every time. Another method is to trigger a repair task only the first time, and reuse the existing repair results when the error occurs repeatedly. Yet another method is to perform a more thorough code cleanup for frequently occurring errors, such as extracting common code or adjusting the project structure. The expected effect is to select the appropriate handling method based on the occurrence of the error.

[0069] Furthermore, metrics such as the time taken and success rate of each repair can be recorded, and the execution method of repair tasks can be adjusted based on these metrics. For example, when a certain type of repair task takes a long time, its triggering interval can be appropriately extended to avoid consuming too many resources. The expected effect is to reduce resource consumption.

[0070] Based on the above embodiments, the present invention further describes the construction of the repair task prompt words and the calling process of the pre-trained language model.

[0071] In this embodiment of the invention, before inputting the prompt word into the pre-trained language model, the method may further include: desensitizing sensitive information in the prompt word. Inputting the prompt word into the pre-trained language model in step S203 may include: sending the desensitized prompt word to the pre-trained language model located outside the research and development environment via a network forwarding layer.

[0072] Specifically, before sending the prompts to the pre-trained language model, sensitive information in the prompts is anonymized. Sensitive information can include hostnames, domain names, and company identifiers. Anonymization involves replacing or removing this sensitive information so that the sent prompts no longer contain identifiable sensitive content. The anonymized prompts are then sent through the network forwarding layer to the pre-trained language model, which is located outside the development environment. The pre-trained language model resides outside the development environment, and the code repository in the development environment is not directly exposed.

[0073] By desensitizing the prompt words before calling the pre-trained language model outside the R&D environment and sending them through the network forwarding layer, it is still possible to call the pre-trained language model outside the R&D environment to complete the analysis and repair even when the code data in the R&D environment is not directly exposed to the outside world, thus balancing data security and the use of model capabilities.

[0074] In this embodiment of the invention, the prompt words for creating a repair task based on the error log in S202 may include: obtaining the framework overview information of the target code project; and assembling the error log, the context information corresponding to the error log, and the framework overview information into prompt words.

[0075] Specifically, when creating the error message, in addition to the error log itself, the framework overview information of the target code project is also obtained. The error log, its corresponding context information, and the framework overview information are then assembled into the error message. The framework overview information can come from the target code project's engineering knowledge base and describes the overall structure of the project. The context information can include code and related configurations near the location where the error occurred. By providing this information to the pre-trained language model, the model can analyze errors in conjunction with the overall project structure, rather than just analyzing the fragment of the error message.

[0076] In some optional embodiments of this invention, the target code project directory can be navigated to, and a separate repair branch can be created based on the current main branch of the target code project. The repair branch name can be generated according to a fixed naming rule, such as a combination of a prefix, date, and sequence number. The date can be in the format of year, month, and day, and the sequence number is used to distinguish different repair tasks within the same day. Subsequent repairs and tests are performed on the separate repair branch, ensuring that different repair tasks do not interfere with each other.

[0077] By incorporating framework overview information of the target code project and contextual information of the error into the prompt words, the pre-trained language model can understand the error in conjunction with the overall structure of the project, which helps to improve the accuracy of error analysis and the quality of the generated repair code; by performing repair and testing on independent repair branches, it helps to ensure that different repair tasks do not affect each other.

[0078] In some alternative embodiments of the present invention, the pre-trained language model is not limited to a model located outside the research and development environment, but may also be other language models with code processing capabilities.

[0079] For example, pre-trained language models can also be deployed locally within the development environment. When using local deployment, historical fix records and results of manual review can be used to adjust the pre-trained language model to adapt it to the coding style and error types of a specific project, thereby reducing the need to call models outside the development environment.

[0080] Furthermore, manually reviewed and approved repair records can be used as training data to periodically adjust or optimize the prompt word templates of the pre-trained language model, thereby increasing the accuracy of repairs over time. The expected effect is that the accuracy of repairs will increase with usage time.

[0081] Based on the above embodiments, the embodiments of the present invention further illustrate the testing and verification of the repair code, the generation of the merge request, and the processing after review.

[0082] In this embodiment of the invention, S204, testing and verifying the repair code, may include: inputting the original data that caused the error into a pre-trained language model to obtain test cases generated by the pre-trained language model for the error; and running the test cases to test and verify the repair code.

[0083] It's important to note that the testing and verification process involves more than just running existing standard tests. The original data causing the error is input into a pre-trained language model, which then generates targeted test cases to address the error. These test cases are then run to test the fixed code. Testing can be conducted in an isolated runtime environment, and the tests can be either unit tests or integration tests. The fix is ​​considered effective when all generated test cases pass.

[0084] Because targeted test cases are generated based on the original data that caused the error, and these test cases are run to test the repair code, the repair results can be verified starting from the data that caused the error. This helps prevent the same error from recurring. Compared to simply judging whether the code can be compiled, the verification results are more reliable.

[0085] In this embodiment of the invention, generating a merge request in step S205 may include: generating a merge request according to a preset template; the preset template includes the original error message, error analysis, repair plan, and test record, wherein the original error message is the error log, the error analysis is the analysis result, the repair plan includes the repair code, and the test record is the execution result of the test verification.

[0086] Specifically, a merge request is generated according to a preset template, which may include four parts: the original error message, error analysis, repair plan, and test log. The original error message is the error log, which can quote specific error log content. The error analysis is the analysis result given by the pre-trained language model. The repair plan includes the repair code, which can provide the differences in the repair code and explanations. The test log is the execution result of the test verification, which can be the result of the test run or the log. In some optional embodiments of this invention, the application programming interface (API) of the code hosting platform can be called to submit code changes and generate a merge request. The code hosting platform can be GitLab, GitHub, or Gitee.

[0087] By generating a merge request according to a preset template that includes four parts: the original error message, error analysis, repair plan, and test records, the content of the merge request is uniform and complete. This facilitates a quick understanding of the error message, repair content, and test results during manual review, improving review efficiency and making it easier to review afterwards.

[0088] The automatic error log repair method provided in this embodiment of the invention further includes: when the merge request is rejected, feeding back the reason for rejection to the pre-trained language model so that the pre-trained language model can re-analyze the error log and generate new repair code, and repeating the steps of testing and verifying and generating the merge request for the new repair code until the merge request passes manual review or reaches the preset number of retries; and / or, adding the error type corresponding to the merge request to the whitelist used for filtering error logs.

[0089] In practical applications, after a merge request is submitted for manual review, there are two possible outcomes: the request is merged or it is rejected. Manual review can also be called human-in-the-loop review. When a merge request is merged, the patched code enters the subsequent release process. When a merge request is rejected, the reason for rejection is fed back to a pre-trained language model. The pre-trained language model then re-analyzes the error logs and generates new patched code. The new patched code is then retested and verified, and a new merge request is generated. This process is repeated until the merge request is merged or the preset number of retries is reached. The preset number of retries limits the number of repetitions to avoid infinite repetition. The preset number of retries can be determined based on the success rate of the patch and resource consumption; for example, it can be set to 3 times, or it can be between 2 and 5 times. When the success rate of the patch is low, the number of retries can be increased appropriately.

[0090] Alternatively, when a manual review determines that a certain error does not need to be fixed, the error type corresponding to the merge request can be added to a whitelist so that subsequent identical errors will not trigger a fix task.

[0091] The above options include re-repairing the error based on manual review rejection, or adding the error type to the whitelist. You can choose to perform one of these steps or both.

[0092] By feeding back the reason for rejection to the pre-trained language model when a merge request is rejected and then re-fixing and testing, it is beneficial to increase the proportion of the final acceptance of the repair results and avoid ending the process after a single failure. By adding errors that do not need to be fixed to a whitelist, it is beneficial to avoid the repeated occupation of repair resources by the same errors in the future.

[0093] Furthermore, a confidence threshold can be set for the repair results output by the pre-trained language model. That is, after testing and verifying the repair code in S204, if the confidence level of the repair result is lower than this threshold, a merge request will not be directly generated; instead, it will be transferred to manual processing. The confidence threshold can range from 0 to 1, for example, set to 0.8. When the confidence level is lower than 0.8, it will be transferred to manual processing. The confidence threshold can be determined based on the required repair quality. When the repair quality requirement is high, the threshold can be appropriately increased to reduce the number of low-quality repair results entering the review process.

[0094] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method.

[0095] It should be noted that in the embodiments of the automatic error log repair methods of the present invention, some steps or features may be ignored or not executed. The hardware or software functional modules described are for ease of explanation and are not the only implementation of the automatic error log repair methods provided in the embodiments of the present invention.

[0096] The above details various embodiments of the automatic error log repair method provided by the present invention. Based on this, the present invention also discloses an automatic error log repair device, electronic device, and computer-readable storage medium corresponding to the above method.

[0097] This invention provides an automatic error log repair device for log processing equipment, which may include: a log acquisition module, a filtering and deduplication module, and a first storage module. The log acquisition module is used to read the standard output and error output of the target software unit (such as a container group (Pod)) in the runtime environment in real time; the filtering and deduplication module is used to preprocess the errors of the target software unit, such as removing logs in the whitelist and duplicate stack trace information, and retaining valid error logs; the first storage module is used to store the preprocessed error logs in a structured manner according to a preset data format (such as JSON).

[0098] This invention provides an automatic error log repair device for repair equipment, which may include: an acquisition module, a prompt word construction module, a model invocation module, a testing and verification module, and a merge request generation module. The acquisition module acquires valid error logs synchronized from the runtime environment to the development environment. The prompt word construction module creates prompt words for the repair task based on the error logs. The model invocation module inputs the prompt words into a pre-trained language model and receives the analysis results and repair code output by the pre-trained language model. The testing and verification module tests and verifies the repair code. The merge request generation module generates a merge request after the tests pass.

[0099] It should be noted that in the various embodiments of the automatic error log repair device provided in this invention, the division of units is only a logical functional division, and other division methods can be used. The connection between different units can be electrical, mechanical, or other connection methods. Separate units can be located in the same physical location or distributed across multiple network nodes. Each unit can be implemented in hardware or as a software functional unit. That is, according to actual needs, some or all of the units provided in this invention can be selected and corresponding connection or integration methods can be used to achieve the purpose of the solution in this invention.

[0100] For an example of the automatic error log repair device, please refer to the description of the automatic error log repair system and method embodiments, which will not be repeated here.

[0101] This invention also provides an electronic device, which may include: a first memory for storing a first computer program; and a first processor for executing the first computer program to implement the steps of the automatic error log repair method for a repair device provided in any of the above embodiments.

[0102] The first processor may include one or more processing cores, such as a 3-core processor or an 8-core processor. The first processor may be implemented using at least one hardware form selected from Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The first processor may also include a main processor and a coprocessor. The main processor, also known as the Central Processing Unit (CPU), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the first processor may integrate a Graphics Processing Unit (GPU) responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the first processor may also include an Artificial Intelligence (AI) processor for handling computational operations related to machine learning.

[0103] The first memory may include one or more computer-readable storage media, which may be non-transitory. The first memory may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In this embodiment, the first memory is used to store at least the following first computer program, which, after being loaded and executed by the first processor, is capable of implementing the relevant steps in the automatic error log repair method for the repair device disclosed in any of the foregoing embodiments. In addition, the resources stored in the first memory may also include an operating system and data, and the storage method may be temporary or permanent storage. The operating system may be Windows or other types of operating systems. The data may include, but is not limited to, the data involved in the above methods.

[0104] In some embodiments, the electronic device provided in this invention may further include a display screen, a power supply, a communication interface, an input / output interface, a sensor, and a communication bus.

[0105] Those skilled in the art will understand that the above structure does not constitute a limitation on the electronic device provided in the embodiments of the present invention, and may include more or fewer components than shown in the figures.

[0106] The electronic device provided in this embodiment of the invention includes a first memory and a first processor. When the first processor executes a first computer program stored in the first memory, it can implement the steps of the automatic error log repair method for repair devices provided in the above embodiment, with the same effect.

[0107] This invention also provides an electronic device, which may include: a second memory for storing a second computer program; and a second processor for executing the second computer program to implement the steps of an automatic error log repair method applied to a log processing device.

[0108] The second processor may include one or more processing cores, such as a 3-core processor or a 9-core processor. The second processor may be implemented using at least one hardware form selected from Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The second processor may also include a main processor and a coprocessor. The main processor, also known as the Central Processing Unit (CPU), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the second processor may integrate a Graphics Processing Unit (GPU) responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the second processor may also include an Artificial Intelligence (AI) processor for handling computational operations related to machine learning.

[0109] The second memory may include one or more computer-readable storage media, which may be non-transitory. The second memory may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In this embodiment, the second memory is used to store at least the following second computer program, which, after being loaded and executed by the second processor, is capable of implementing the relevant steps in the automatic error log repair method for the log processing device disclosed in any of the foregoing embodiments. Furthermore, the resources stored in the second memory may also include an operating system and data, and the storage method may be temporary or permanent storage. The operating system may be Windows or other types of operating systems. The data may include, but is not limited to, the data involved in the above methods.

[0110] In some embodiments, the electronic device provided in this invention may further include a display screen, a power supply, a communication interface, an input / output interface, a sensor, and a communication bus.

[0111] Those skilled in the art will understand that the above structure does not constitute a limitation on the electronic device provided in the embodiments of the present invention, and may include more or fewer components than shown in the figures.

[0112] The electronic device provided in this embodiment of the invention includes a second memory and a second processor. When the second processor executes the second computer program stored in the second memory, it can implement the steps of the automatic error log repair method for the log processing device provided in the above embodiment, and the effect is the same as above.

[0113] The present invention also provides an embodiment corresponding to a computer-readable storage medium. The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps described in the above-described embodiment of the automatic error log repair method (which may be a method corresponding to the repair device side, a method corresponding to the log processing device side, or a method corresponding to both the repair device side and the log processing device side).

[0114] It is understood that if the methods in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and executes all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0115] The computer-readable storage medium provided by this invention includes the aforementioned automatic error log repair method, with the same effect.

[0116] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0117] The above provides a detailed description of the automatic error log repair method, system, device, and storage medium provided by this invention. Specific examples have been used to illustrate the principles and implementation methods of this invention. The descriptions of the above embodiments are only intended to help understand the method and core ideas of this invention. It should be noted that those skilled in the art can make various improvements and modifications to this invention without departing from its principles, and these improvements and modifications also fall within the protection scope of this invention.

Claims

1. An automatic error log repair method, characterized in that, include: Obtain error logs synchronized from the runtime environment to the development environment; Based on the error log, create prompts for the repair task; The prompt words are input into a pre-trained language model so that the pre-trained language model can analyze the error log and generate repair code; The repair code was tested and verified. After the test is passed, a merge request is generated, which includes the error log, analysis results and the repair code, for manual review and merging.

2. The automatic error log repair method according to claim 1, characterized in that, The error log synchronized from the runtime environment to the development environment is a valid error log captured in the runtime environment, filtered and deduplicated, and then unidirectionally encrypted and synchronized to the development environment; the valid error log is a newly appearing error log that is not in the whitelist.

3. The automatic error log repair method according to claim 1, characterized in that, Before inputting the prompt word into the pre-trained language model, the method further includes: Sensitive information in the prompt words is de-identified; The step of inputting the prompt word into the pre-trained language model includes: The desensitized prompts are sent to a pre-trained language model located outside the R&D environment via the network forwarding layer.

4. The automatic error log repair method according to claim 1, characterized in that, The prompt words for creating a repair task based on the error log include: Obtain an overview of the target code project's framework; The error log, the context information corresponding to the error log, and the framework overview information are assembled into the prompt word.

5. The automatic error log repair method according to claim 1, characterized in that, The testing and verification of the repair code includes: The original data that caused the error is input into the pre-trained language model to obtain test cases generated by the pre-trained language model for the error. Run the test cases to test and verify the fixed code.

6. The automatic error log repair method according to claim 1, characterized in that, The generation of the merge request includes: The merge request is generated according to the preset template; The preset template includes the original error message, error analysis, repair plan, and test record. The original error message is the error log, the error analysis is the analysis result, the repair plan includes the repair code, and the test record is the execution result of the test verification.

7. The automatic error log repair method according to claim 1, characterized in that, Also includes: If the merger request is rejected, The rejection reason is fed back to the pre-trained language model, so that the pre-trained language model re-analyzes the error log and generates new fix code. The test verification and the steps of generating the merge request are repeated for the new fix code until the merge request passes manual review or reaches the preset number of retries. And / or, add the error type corresponding to the merge request to the whitelist used to filter the error logs.

8. An automatic error log repair system, characterized in that, This includes log processing equipment located on the operational environment side and repair equipment located on the research and development environment side; The log processing device is used to capture error logs from the operating environment, preprocess the error logs, and then synchronize them to the development environment. The repair device is used to acquire the error log, create prompt words for the repair task based on the error log, input the prompt words into a pre-trained language model to analyze the error log and generate repair code, test and verify the repair code, and generate a merge request containing the error log, analysis results and repair code after the test is passed, so that they can be merged after manual review.

9. An electronic device, characterized in that, include: The first memory is used to store computer programs; A first processor is configured to implement the steps of the automatic error log repair method as described in any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the automatic error log repair method as described in any one of claims 1 to 7.