Code error analysis method and apparatus, and log scanning rule generation method and apparatus

By generating log scanning rules to automatically analyze code errors, it solves the problem of low efficiency in manually finding code errors by developers in large projects, and achieves more efficient code error analysis and development.

WO2026012201A1PCT designated stage Publication Date: 2026-01-15CLOUD INTELLIGENCE ASSETS HOLDING (SINGAPORE) PTE LTD +1

Patent Information

Application Number
PCT/CN2025/105303
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-07-08
Filing Date
2025-06-30
Publication Date
2026-01-15

AI Technical Summary

Technical Problem

In existing technologies, when developers encounter code errors, especially in large projects, manually browsing through development materials to find errors is inefficient, leading to low development efficiency.

Method used

This paper provides a code error analysis method that obtains the program code to be analyzed and error code samples, uses an error analysis model to perform context learning, generates log scanning rules, and automatically scans program logs to locate errors.

Benefits of technology

It improves the efficiency of code error analysis, reduces the time spent manually finding errors, and increases development efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025105303_15012026_PF_FP_ABST
    Figure CN2025105303_15012026_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the embodiments of the present description are a code error analysis method and apparatus, and a log scanning rule generation method and apparatus. The log scanning rule generation method comprises: acquiring a program code to be analyzed which corresponds to a code error analysis task; determining an analysis task data group on the basis of said program code, wherein the analysis task data group comprises said program code, and a first error code sample and a corresponding log scanning rule sample; and inputting the analysis task data group into an error analysis model, such that the error analysis model generates a log scanning rule, wherein the error analysis model is used for performing context learning on the basis of the first error code sample and the corresponding log scanning rule sample, and generating the corresponding log scanning rule for said program code, and the log scanning rule is used for performing error scanning on a program log. Therefore, the efficiency of error analysis for a program code is improved, and the development efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Code error analysis methods, log scanning rule generation methods, and their respective devices

[0001] This disclosure claims priority to Chinese Patent Application No. 202410910797.2, filed with the China Patent Office on July 8, 2024, entitled “Code Error Analysis Method, Log Scanning Rule Generation Method and Respective Apparatus”, the entire contents of which are incorporated herein by reference. Technical Field

[0002] The embodiments in this specification relate to the field of computer technology, and in particular to code error analysis methods, log scanning rule generation methods, and respective apparatuses. Background Technology

[0003] Developers frequently encounter errors during program development. For example, when using Spark (an open-source big data processing framework), they might encounter errors like "unable to broadcast a table larger than 5GB." When developers encounter errors, they usually need to manually browse through the relevant development materials to find the mistakes. However, the development content of a typical large project is enormous, making it difficult to manually find errors, leading to low development efficiency.

[0004] Therefore, there is an urgent need for a code error analysis solution to improve the efficiency of code error analysis and thus improve development efficiency. Summary of the Invention

[0005] In view of this, embodiments of this specification provide a method for generating log scanning rules for code error analysis. One or more embodiments of this specification also relate to an apparatus for generating log scanning rules for code error analysis, a code error analysis method, a code error analysis device, a computing device, a computer-readable storage medium, and a computer program product, in order to address the technical deficiencies existing in the prior art.

[0006] According to a first aspect of the embodiments of this specification, a method for generating log scanning rules for code error analysis is provided, comprising: in response to receiving a code error analysis task, obtaining program code to be analyzed corresponding to the code error analysis task; determining an analysis task data group based on the program code to be analyzed, wherein the analysis task data group includes: the program code to be analyzed, a first error code example, and a corresponding log scanning rule example; inputting the analysis task data group as at least a portion of a prompt word into an error analysis model, and generating log scanning rules by the error analysis model; wherein the error analysis model is configured to perform context learning based on the first error code example and the corresponding log scanning rule example, learn a first correlation between the first error code example and the corresponding log scanning rule example, and generate corresponding log scanning rules for the program code to be analyzed using the first correlation, wherein the log scanning rules are used to perform error scanning on program logs.

[0007] According to a second aspect of the embodiments of this specification, a code error analysis method is provided, comprising: acquiring log scanning rules, the log scanning rules being generated by an error analysis model, the error analysis model being configured to perform context learning based on an input first error code sample and a corresponding log scanning rule sample, learning a first correlation between the first error code sample and the corresponding log scanning rule sample, and using the first correlation to generate corresponding log scanning rules for the input program code to be analyzed; acquiring program logs, the program logs being logs generated during program code execution; and using the log scanning rules to perform error scanning on the program logs to obtain error scanning results.

[0008] According to a third aspect of the embodiments of this specification, a code error analysis method is provided, applied to a client device, comprising: sending a code error analysis request to a server, causing the server to obtain log scanning rules and program logs corresponding to the code error analysis request, performing error scanning on the program logs using the log scanning rules, and obtaining error scanning results; wherein the log scanning rules are generated by an error analysis model, the error analysis model being used to perform context learning based on an input first error code sample and a corresponding log scanning rule sample, learning a first correlation between the first error code sample and the corresponding log scanning rule sample, and using the first correlation to generate corresponding log scanning rules for the input program code to be analyzed; and receiving the error scanning results returned by the server.

[0009] According to a fourth aspect of the embodiments of this specification, a log scanning rule generation apparatus for code error analysis is provided, comprising: a code acquisition module configured to acquire program code to be analyzed corresponding to the code error analysis task in response to receiving a code error analysis task; a task data determination module configured to determine an analysis task data set based on the program code to be analyzed, wherein the analysis task data set includes: the program code to be analyzed, a first error code example, and a corresponding log scanning rule example; and a model input module configured to input the analysis task data set as at least a portion of a prompt word into an error analysis model, and generate log scanning rules by the error analysis model; wherein the error analysis model is used to perform context learning based on the first error code example and the corresponding log scanning rule example, learn a first correlation between the first error code example and the corresponding log scanning rule example, and generate corresponding log scanning rules for the program code to be analyzed using the first correlation, wherein the log scanning rules are used to perform error scanning on the program log.

[0010] According to a fifth aspect of the embodiments of this specification, a code error analysis apparatus is provided, comprising: a scanning rule acquisition module configured to acquire log scanning rules, the log scanning rules being generated by an error analysis model, the error analysis model being configured to perform context learning based on an input first error code sample and a corresponding log scanning rule sample, learning a first correlation between the first error code sample and the corresponding log scanning rule sample, and using the first correlation to generate corresponding log scanning rules for the input program code to be analyzed; a program log acquisition module configured to acquire program logs, the program logs being logs generated during program code execution; and an error scanning module configured to perform error scanning on the program logs using the log scanning rules to obtain error scanning results.

[0011] According to a sixth aspect of the embodiments of this specification, a code error analysis apparatus is provided, configured in a client device, comprising: a request sending module configured to send a code error analysis request to a server, causing the server to obtain log scanning rules and program logs corresponding to the code error analysis request, and to perform error scanning on the program logs using the log scanning rules to obtain error scanning results; wherein the log scanning rules are generated by an error analysis model, the error analysis model being used to perform context learning based on an input first error code sample and a corresponding log scanning rule sample, to learn a first correlation between the first error code sample and the corresponding log scanning rule sample, and to generate corresponding log scanning rules for the input program code to be analyzed using the first correlation; and a result receiving module configured to receive the error scanning results returned by the server.

[0012] According to a seventh aspect of the embodiments of this specification, a computing device is provided, including: a memory and a processor; wherein the memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions, wherein when the computer programs / instructions are executed by the processor, they implement the steps of the log scanning rule generation method or code error analysis method for code error analysis described above.

[0013] According to an eighth aspect of the embodiments of this specification, a computer-readable storage medium is provided that stores a computer program / instructions that, when executed by a processor, implement the steps of the log scanning rule generation method or code error analysis method for code error analysis described above.

[0014] According to a ninth aspect of the embodiments of this specification, a computer program product is provided, including a computer program / instructions that, when executed by a processor, implement the steps of the log scanning rule generation method or code error analysis method for code error analysis described above.

[0015] This specification implements a code error analysis method in one embodiment. Since this method uses program source code as the analysis entry point, in response to receiving a code error analysis task, it obtains the program code to be analyzed corresponding to the code error analysis task, and determines an analysis task data group based on the program code to be analyzed. The analysis task data group includes: the program code to be analyzed, a first error code example, and a corresponding log scanning rule example. Therefore, by inputting the analysis task data group as at least part of the prompt words into the error analysis model, the error analysis model can perform context learning based on the first error code example and the corresponding log scanning rule example, learning the first correlation between the first error code example and the corresponding log scanning rule example. Using the first correlation, it automatically generates corresponding log scanning rules for the program code to be analyzed, ensuring the accuracy of the log scanning rules and the error tracking effect. Subsequently, it can perform error scanning on the program logs based on the log scanning rules to find errors in the program code, improving the efficiency of program code error analysis and development efficiency. Attached Figure Description

[0016] Figure 1 is an architecture diagram of a code error analysis system provided in one embodiment of this specification;

[0017] Figure 2 is an architecture diagram of a code error analysis system provided in another embodiment of this specification;

[0018] Figure 3 is a flowchart of a log scanning rule generation method for code error analysis provided in one embodiment of this specification;

[0019] Figure 4 is a flowchart of the processing procedure of a log scanning rule generation method for code error analysis provided in an embodiment of this specification;

[0020] Figure 5 is a flowchart of a code error analysis method provided in one embodiment of this specification;

[0021] Figure 6 is a flowchart of a code error analysis method provided in yet another embodiment of this specification;

[0022] Figure 7 is a schematic diagram of a user interface provided in one embodiment of this specification;

[0023] Figure 8 is a schematic diagram of a log scanning rule generation device for code error analysis provided in one embodiment of this specification;

[0024] Figure 9 is a schematic diagram of a code error analysis device provided in another embodiment of this specification;

[0025] Figure 10 is a schematic diagram of a code error analysis device provided in another embodiment of this specification;

[0026] Figure 11 is a structural block diagram of a computing device provided in one embodiment of this specification. Detailed Implementation

[0027] Many specific details are set forth in the following description to provide a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this specification. Therefore, this specification is not limited to the specific implementations disclosed below.

[0028] The terminology used in one or more embodiments of this specification is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of this specification. The singular forms “a,” “described,” and “the” as used in one or more embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.

[0029] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of this specification, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of this specification, and similarly, second may also be referred to as first. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to a determination."

[0030] Furthermore, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data authorized by the user or fully authorized by all parties. Moreover, the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0031] In one or more embodiments of this specification, a large model refers to a deep learning model with a large number of model parameters, typically containing hundreds of millions, tens of billions, hundreds of billions, trillions, or even tens of trillions of model parameters. A large model can also be called a foundation model. It is pre-trained using large-scale unlabeled corpora to produce a pre-trained model with hundreds of millions of parameters. Such models can adapt to a wide range of downstream tasks and have good generalization ability. Examples include Large Language Models (LLMs) and multi-modal pre-training models.

[0032] In practical applications, large models only require a small number of samples to fine-tune the pre-trained model before they can be applied to different tasks. Large models can be widely used in fields such as Natural Language Processing (NLP) and Computer Vision. Specifically, they can be applied to computer vision tasks such as Visual Question Answering (VQA), Image Captioning (IC), and Image Generation, as well as natural language processing tasks such as text-based sentiment classification, text summarization, and machine translation. The main application scenarios for large models include digital assistants, intelligent robots, search, online education, office software, e-commerce, and intelligent design.

[0033] First, the terms and concepts used in one or more embodiments of this specification will be explained.

[0034] Apache Spark: An open-source distributed computing engine typically used for offline data processing.

[0035] LLM (Large Language Model) is an artificial intelligence model designed to understand and generate human language. Trained on large amounts of text data, LLMs can perform a wide range of tasks, including text summarization, translation, sentiment analysis, and more.

[0036] Developers often encounter errors during program development. For example, when using Spark (an open-source big data processing framework), they might encounter errors like "Cannot broadcast the table that is larger than 5GB". When developers encounter errors, they usually need to manually browse through the relevant development materials to find the mistakes. However, the development content of a typical large project is enormous, making it difficult to find errors manually, resulting in low development efficiency.

[0037] To improve the efficiency of code error analysis and development, this specification provides a code error analysis method. This method, in response to receiving a code error analysis task, obtains the program code to be analyzed corresponding to the task, and then determines an analysis task data set based on the program code. The analysis task data set includes the program code to be analyzed, a first error code example, and a corresponding log scanning rule example. By inputting the analysis task data set as at least a portion of the prompt words into an error analysis model, the model can perform contextual learning based on the first error code example and the corresponding log scanning rule example, learning a first correlation between them. Using this first correlation, corresponding log scanning rules are automatically generated for the program code to be analyzed. Subsequently, error scanning of the program logs can be performed based on these log scanning rules to identify errors in the program code, thereby improving the efficiency of code error analysis and development.

[0038] This specification provides a method for generating log scanning rules for code error analysis. This specification also relates to a log scanning rule generation apparatus for code error analysis, a code error analysis method, a code error analysis apparatus, a computing device, a computer-readable storage medium, and a computer program product, which will be described in detail in the following embodiments.

[0039] Referring to Figure 1, Figure 1 shows an architecture diagram of a code error analysis system provided in one embodiment of this specification. The code error analysis system may include a client device 100 and a server 200.

[0040] Client device 100 is used to send a code error analysis request to server 200.

[0041] Server 200 is used to parse code error analysis requests, obtain the program logs corresponding to the code error analysis requests, and obtain log scanning rules, use the log scanning rules to perform error scanning on the program logs, and obtain error scanning results.

[0042] The log scanning rules are generated by an error analysis model. Specifically, upon receiving a code error analysis task, the server 200 obtains the program code to be analyzed corresponding to the code error analysis task, determines an analysis task data group based on the program code to be analyzed, and inputs the analysis task data group as at least part of the prompt words into the error analysis model, which generates the corresponding log scanning rules. The analysis task data group includes: the program code to be analyzed, a first error code example, and a corresponding log scanning rule example. The error analysis model is used to perform context learning based on the first error code example and the corresponding log scanning rule example to learn a first correlation between the first error code example and the corresponding log scanning rule example, and uses the first correlation to generate corresponding log scanning rules for the program code to be analyzed.

[0043] Server 200 can also be used to send the error scan results to client device 100.

[0044] The client device 100 is also used to receive the error scan results returned by the server.

[0045] Furthermore, the server 200 can also generate error resolution strategies corresponding to the error scan results and send the error resolution strategies to the client device 100 to automatically correct the errors.

[0046] By applying the scheme of the embodiments of this specification, after the server obtains the program code to be analyzed, it determines an analysis task data group based on the program code to be analyzed. The analysis task data group includes: the program code to be analyzed, a first error code example, and a corresponding log scanning rule example. Therefore, by inputting the analysis task data group into the error analysis model, the error analysis model can perform context learning based on the first error code example and the corresponding log scanning rule example, and automatically generate corresponding log scanning rules for the program code to be analyzed. Subsequently, it can perform error scanning on the program logs based on the log scanning rules, find errors in the program code, improve the error analysis efficiency of the program code, and improve development efficiency.

[0047] In one or more embodiments, the code error analysis system may include multiple client devices 100 and a server 200, wherein the client devices 100 may include edge devices, and the server 200 may include cloud devices. Multiple client devices 100 can establish communication connections through the server 200. In the code error analysis scenario, the server 200 is used to provide log scanning rule generation services and / or code error analysis services among the multiple client devices 100. The multiple client devices 100 can act as senders or receivers, communicating through the server 200.

[0048] Users can interact with server 200 through client device 100 to receive data sent by other client devices 100, or send data to other client devices 100, etc. In a code error analysis scenario, a user can send a code error analysis request to server 200 through client device 100. The code error analysis request can carry information for obtaining program logs. Server 200 obtains the program logs based on this information, retrieves the log scanning rules generated in advance using the error analysis model, and uses the log scanning rules to perform error scanning on the program logs to obtain the error scanning results.

[0049] In this setup, the client device 100 and the server 200 establish a connection via a network. The network provides the medium for the communication link between the client device 100 and the server 200. The network can include various connection types, such as wired or wireless communication links or fiber optic cables. The data transmitted by the client device 100 may need to undergo encoding, transcoding, compression, or other processing before being published to the server 200.

[0050] Client device 100 may include browsers, apps, web applications such as H5 (HyperText Markup Language 5) applications, lightweight applications (also known as mini-programs), or cloud applications. Applications on client device 100 can be developed using software development kits (SDKs) provided by server 200, such as Real-Time Communication (RTC) SDKs. Client device 100 can be deployed in electronic devices and depends on the device or certain apps running on it. Electronic devices may have displays and support information browsing, such as personal mobile terminals like mobile phones, tablets, and personal computers. Various other types of applications can also be configured in electronic devices, such as human-computer interaction applications, model training applications, text processing applications, web browser applications, shopping applications, search applications, instant messaging tools, email clients, and social media platforms.

[0051] Server 200 may include servers providing various services, such as servers providing communication services for multiple client devices, servers supporting backend training of models used on client devices, and servers processing data sent by client devices. It should be noted that server 200 can be implemented as a distributed server cluster composed of multiple servers, or as a single server. The server can also be a server in a distributed system, or a server integrated with blockchain. The server can also be a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology.

[0052] Considering the large number of model parameters in error analysis models and the limited computing resources of client devices, the code error analysis method provided in this specification can be applied to the server 200 in the code error analysis system shown in Figure 1, but is not limited thereto. For example, in one or more embodiments, the code error analysis method can be implemented based on a system composed of client devices and servers.

[0053] Referring to Figure 2, which shows an architecture diagram of a code error analysis system provided in another embodiment of this specification, the server in the code error analysis system may include: a management module, an object storage service, a database, and a model invocation module.

[0054] Based on the architecture diagram of the code error analysis system shown in Figure 2, exemplarily, in an Apache Spark program development project, the client device can display a user interface and receive code error analysis requests input by the user for the Spark program. The client device sends a code error analysis request to the management module based on the user's input. This code error analysis request may carry information for obtaining program logs. The program logs are the logs generated by the user's Spark program during runtime.

[0055] The management module can be understood as a task execution engine, which can be configured to obtain program logs from the object storage service and log scanning rules from the database based on the code error analysis request, and use the log scanning rules to scan the program logs to obtain error scanning results.

[0056] The database can be any type of database, such as MySQL (Structured Query Language), and this specification does not impose any restrictions on it. The database can be configured to store log scanning rules.

[0057] The model invocation module can be configured to, upon obtaining the program code to be analyzed, determine an analysis task data group based on the program code to be analyzed, input the analysis task data group as at least a portion of the prompt words into an error analysis model, and have the error analysis model generate log scanning rules. The first error code sample in the analysis task data group and the program code to be analyzed can both belong to the Spark source code, or they can be source code in different languages, as long as the code error information is interoperable. The error analysis model is used to perform context learning based on the first error code sample and the corresponding log scanning rule sample, learn a first correlation between the first error code sample and the corresponding log scanning rule sample, and use the first correlation to generate corresponding log scanning rules for the program code to be analyzed. The generated log scanning rules are stored in the database.

[0058] In addition, the model calling module can also obtain error-related search data (such as discussion data from the code development community) through search technology, so as to perform error analysis and generate error resolution strategies.

[0059] The model invocation module is a framework used to simplify and accelerate the integration and utilization of machine learning models (such as large models) in applications. The model invocation module provides a series of modular components and tools capable of interacting with any one or more machine learning models to perform functions such as data querying, processing, analysis, and generating natural language responses. The model invocation module provides highly modular components, such as data source adapters, model interfaces, and information retrieval systems, which can be freely combined to achieve rapid prototyping and flexible system construction. Through the model invocation module, models can seamlessly interface with external data sources, applications, and other computing resources. The model invocation module implemented according to the methods provided in the embodiments of this specification can organize and invoke these resources through custom "links," thereby combining with machine learning models to achieve log scanning rule generation and / or code error analysis functions.

[0060] It should be noted that the methods provided in the embodiments of this specification can be applied to error analysis of the program code of any program development tool, including but not limited to error analysis of Spark program code. According to the methods provided in the embodiments of this specification, there is no need for manual inspection of logs and source code. Instead, log scanning rules for scanning program logs are directly generated from the source code using an error analysis model. Code errors are then located from the program logs using these log scanning rules, thereby effectively improving code development efficiency.

[0061] It is worth noting that the code error analysis method provided in the embodiments of this specification is generally executed by a server. However, in other embodiments of this specification, the client device may also have similar functions to the server, thereby executing the code error analysis method provided in the embodiments of this specification. In other embodiments, the code error analysis method provided in the embodiments of this specification may also be executed jointly by the client device and the server.

[0062] Referring to Figure 3, a flowchart of a log scanning rule generation method for code error analysis according to an embodiment of this specification is shown, which specifically includes the following steps.

[0063] Step 302: In response to receiving a code error analysis task, obtain the program code to be analyzed corresponding to the code error analysis task.

[0064] The program code to be analyzed can be program code developed using any one or more program development tools. For example, the program code to be analyzed can be program code developed using Spark. Spark can be written using programming languages ​​such as Scala, Java, Python (PySpark), or R (SparkR).

[0065] In practical applications, there are multiple ways to obtain the program code to be analyzed, and the specific method should be selected according to the actual situation. This specification does not impose any limitations on this method. In one possible implementation of this specification, the program code to be analyzed can be received from a user. In another possible implementation of this specification, the program code to be analyzed can be read from another server or database.

[0066] For example, a server can receive a scan rule generation request from a client device. This request can be understood as an analysis task, which retrieves the program code to be analyzed based on the client device's scan rule generation request. This scan rule generation request may carry the program code to be analyzed, or it may carry a command to retrieve the program code (such as a read command to read the program code from a specified storage location), or the system's default storage location for the program code to be analyzed. In this way, the program code to be analyzed can be retrieved based on the scan rule generation request.

[0067] For example, the server can obtain program code from one or more program error files from the program development tools as the program code to be analyzed. For instance, the server can respond to updates to the program error files and obtain the updated program code from the error file to track error update log scanning rules. For example, for Spark program development tools, the files from which the program code to be analyzed can include: the Spark SQL execution error file "QueryExecutionErrors.scala" (where "QueryExecutionErrors.scala" represents the error file name, which can be any character in practice); files in the Spark SQL folder "catalyst" (where "catalyst" represents the folder name, which can be any character in practice), containing SQL parsing error information; files in the Spark SQL folder "util" (where "util" represents the folder name), containing type conversion error information; files in the Spark SQL folder "execution" (where "execution" represents the folder name), containing execution error information; and code files that throw SparkException errors during Spark SQL execution. By scanning these files, the code of the program to be analyzed is obtained, and log scanning rules are generated based on the code of the program to be analyzed using an error analysis model.

[0068] In one or more embodiments of this specification, to provide more useful information and make the log scanning rules generated by the error analysis model more accurate, the processing step of obtaining the program code to be analyzed can also extract help information from the initial program code to be analyzed based on preset help information extraction rules to obtain help information (such as code comments). Based on the help information and the initial program code to be analyzed, the program code to be analyzed is obtained and used as the data group for the analysis task. For example, the preset help information extraction rules can be used to extract help information from the program code to be analyzed, and the help information can be added to the program code to be analyzed.

[0069] It is understood that, in the embodiments of this specification, the purpose of obtaining the program code to be analyzed is to generate log scanning rules for locating code errors in the program logs based on the program code to be analyzed. Therefore, the step of obtaining the program code to be analyzed can be triggered in response to receiving the task description information of the code error analysis task. For example, the task description information of the code error analysis task can be carried in the scanning rule generation request. The task description information can be used to describe the task processing requirements of the analysis task. For example, for an analysis task that generates scanning rules for program logs generated during the runtime of Spark source code, the task description information can be expressed as "generate log scanning rules for Spark source code".

[0070] Step 304: Based on the program code to be analyzed, determine the analysis task data group, wherein the analysis task data group includes: the program code to be analyzed, a first error code sample, and a corresponding log scanning rule sample.

[0071] The analysis task data set is the data input into the error analysis model, used to enable the model to understand the context and generate log scanning rules. Specifically, the analysis task data set includes: the program code to be analyzed, a first error code example, and a corresponding log scanning rule example. The generation method of the analysis task data set is not limited. For example, in one or more embodiments of this specification, the program code to be analyzed can be parsed based on preset generation rules or a machine learning model with generation capabilities to generate the analysis task data set containing the program code to be analyzed, the first error code example, and the corresponding log scanning rule example.

[0072] The first error code example can be program code developed using any one or more programming tools, containing code error information. Code error information indicates defects in the code or errors that do not conform to predetermined programming standards, such as error messages like "Buffer Overflow" or "Broadcast too large". The first error code example and the program code to be analyzed can be in the same programming language or different programming languages, as long as their error information is interchangeable. The method of obtaining the first error code example is not limited. For example, program code can be obtained from one or more program error files from a programming tool, and the first error code example can be obtained from it based on known code error information. Another example is that the first error code example can be manually written by an experienced developer. Yet another example is that known error information can be input into a machine learning model capable of generating error code examples to generate a first program code example containing code error information. More specifically, the first error code example based on Spark source code can be represented as the following source code segment:

[0073] "Spark source code statement 1..."

[0074] Spark source code statement 2…

[0075] throw executeBroadcastTimeoutError / throws the executeBroadcastTimeoutError error

[0076] Spark source code statement 3…”

[0077] As shown in the example of the first error code above, it contains the error message "executeBroadcastTimeoutError".

[0078] The log scanning rule example described above is a descriptive rule example used for error scanning of program logs. Error scanning of program logs refers to the scanning process that detects code error information appearing in the program logs using a series of criteria. These criteria are the log scanning rules. The log scanning rules are descriptive rules used for error scanning of program logs. The log scanning rules can be expressed as static rules. By matching the static log scanning rules with the program log text, errors existing in the source code can be automatically detected in the program log. For example, the log scanning rule example corresponding to the first error code example above can be expressed as the static rule: "Unable to execute broadcast within .* seconds".

[0079] Furthermore, when the error analysis model performs tasks guided by prompt words, the analysis task data set can be input into the error analysis model as at least part of the analysis task prompt words. The analysis task prompt words are used to instruct the error analysis model to perform context learning based on the first error code example and the corresponding log scanning rule example, and generate corresponding log scanning rules for the program code to be analyzed. The log scanning rules are used to perform error scanning on the program log.

[0080] The form of the analysis task prompt is not limited. For example, the analysis task prompt can be represented as a natural language description text, the semantics of which express the aforementioned instruction information. For example, taking the first error code example and the corresponding log scanning rule example above, the analysis task prompt can be represented as:

[0081] "As an Apache Spark developer, please read the Spark source code. Some code error messages correspond to specific regular expressions in the program logs. Please provide a regular expression to help me find code errors from the program logs. Here is an example:"

[0082] Spark source code statement 1…

[0083] Spark source code statement 2…

[0084] throw executeBroadcastTimeoutError / throws the executeBroadcastTimeoutError error

[0085] Spark source code statement 3…

[0086] Our expected output for the log scanning rule is: Unable to perform broadcast within .* seconds.

[0087] The example above identifies a log scanning rule that prevents broadcasting within .* seconds. This log scanning rule can be used to locate the corresponding error message in the program log and identify the log entry containing the corresponding error message.

[0088] Step 306: Input the analysis task data group as at least part of the prompt words into the error analysis model, and the error analysis model generates log scanning rules.

[0089] The error analysis model is used to perform context learning based on the first error code example and the corresponding log scanning rule example, learning a first correlation between the first error code example and the corresponding log scanning rule example. Using this first correlation, corresponding log scanning rules are generated for the program code to be analyzed. The log scanning rules are used to perform error scanning on the program logs. The program logs are logs generated during program code execution. In this step, context learning refers to the model fully considering the context information of the analysis task data group when analyzing and predicting data, learning the correlation between the first error code example and the corresponding log scanning rule example, and predicting the corresponding log scanning rules from the program code to be analyzed by capturing and utilizing these correlations.

[0090] In the embodiments of this specification, the error analysis model can be a specialized machine learning model built specifically for code error analysis tasks, a large model, or a model trained on code error analysis sample data using a large model as a foundation. For example, using a large model as a foundation, training the large model on code error analysis sample data for error analysis tasks yields an error analysis model for generating log scanning rules. By training the large model on data from a specific domain, the large model can acquire knowledge of that domain and perform reasoning and judgment based on that knowledge, thus improving the accuracy of key task information. Error analysis models include, but are not limited to, large models, BERT (Bidirectional Encoder Representations from Transformers) models, and T5 (Text-to-Text Transfer Transformer) models.

[0091] For example, the process of training the error analysis model may include the following steps: acquiring code error analysis sample data, inputting it into the error analysis model, and obtaining log scanning rule prediction results; adjusting the model parameters of the error analysis model based on the difference between the log scanning rule prediction results and the log scanning rule ground truth, to obtain the trained error analysis model. Here, the code error analysis sample data is the object of processing during the model training process. The log scanning rule ground truth is the true, ideal log scanning rule corresponding to the code error analysis sample data. There are various ways to acquire code error analysis sample data, and the specific method should be selected according to the actual situation. This specification does not limit this method in any way. For example, code error analysis sample data can be read from other servers or databases, or it can be received from user-input code error analysis sample data.

[0092] It should be noted that the generated log scanning rules can be regular expressions that are consistent with or similar to the log scanning rule examples. After the error analysis model learns the semantic correlation between the first error code example and the corresponding log scanning rule example, it can generate log scanning rules that are consistent with or similar to the regular expressions and are capable of error scanning.

[0093] The generated log scanning rules can be sent to users and / or stored in the database. Sending the rules to users allows for flexible, on-demand use. Storing the rules in the database allows the system to retrieve them from the database and scan the program logs when code error analysis is needed.

[0094] This method, after obtaining the program code to be analyzed, determines an analysis task data group based on the program code. The analysis task data group includes the program code to be analyzed, a first error code example, and a corresponding log scanning rule example. Therefore, by inputting the analysis task data group as at least a portion of the prompt words into the error analysis model, the model can perform contextual learning based on the first error code example and the corresponding log scanning rule example. This allows the model to learn the first correlation between the first error code example and the corresponding log scanning rule example. Using this first correlation, the model automatically generates corresponding log scanning rules for the program code to be analyzed. Subsequently, it can perform error scanning on the program logs based on the log scanning rules, identify errors in the program code, improve the efficiency of error analysis, and enhance development efficiency.

[0095] In this embodiment of the specification, to generate log scanning rules more efficiently and accurately, the analysis task data group also includes second error code examples and corresponding error cause examples related to the error codes. This allows the error analysis model to perform context learning based on the second error code examples and corresponding error cause examples, identifying the error codes and their corresponding error causes in the program code to be analyzed. After clarifying the error causes, log scanning rules can be generated more accurately. Specifically, the analysis task data group also includes: second error code examples and corresponding error cause examples. The second error code examples and the first error code examples are related to the error codes.

[0096] Accordingly, the error analysis model is used to perform context learning based on the second error code example and the corresponding error cause example, learn the second correlation between the second error code example and the corresponding error cause example, use the second correlation to identify the error code in the program code to be analyzed and the error cause corresponding to the error code, and perform context learning based on the first error code example and the corresponding log scanning rule example to generate a corresponding log scanning rule for the error code.

[0097] An error code is a way of representing code error information. It can be a code error message in the source code or a standardized representation derived from the source code error message. One error code represents one type of code error message. For example, an error code can be represented by a combination of one or more characters, such as Chinese characters, numbers, letters, and special characters. Because an error code is associated with a specific type of code error message, the meaning of the error message represented by the error code is standardized, allowing for quick and accurate location of code errors. For example, the error code can be represented as the letter combination "BROADCAST_TOO_LARGE," indicating a code error message that the size of the data attempted to be broadcast exceeds the system's allowed limit. This code error message may appear directly in the source code in the form of "BROADCAST_TOO_LARGE," or it may appear in the source code in other forms, such as a natural language description associated with "BROADCAST_TOO_LARGE," but the meaning of the error is consistent.

[0098] The second error code example can be program code developed using any one or more programming tools, containing code error information. The method for obtaining the second error code example can be the same as that for obtaining the first error code example. The practical manifestation of the second error code example can be referenced from the example of the first error code example, and will not be repeated here. The content of the second error code example and the first error code example can be the same or different, as long as the error information in the second error code example has corresponding error reason information in the corresponding error reason example. For example, the second error code example can be represented as:

[0099] "Spark source code statement 1..."

[0100] Spark source code statement 2…

[0101] throw QueryExecutionErrors.divideByZeroError

[0102] The error "QueryExecutionErrors.divideByZeroError" is thrown.

[0103] Spark source code statement 3…”

[0104] Error reason examples are examples used to explain the reasons for errors corresponding to error codes. Error reasons provide information about the context in which the error occurred. Analyzing error reasons helps error analysis models fully understand the context and the scenario in which the error occurred, enabling the model to more accurately locate errors and generate log scanning rules. For example, the error reason example corresponding to the second error code example above can be represented as: [{"errorName":"divideByZeroError","errorType":"CLEAR"}]. Here, "errorName" represents the error code field, and the specific content of the error code is "divideByZeroError", indicating a division-by-zero error; "errorType" represents the error reason field, and the specific content of the error reason is "CLEAR", indicating that the error reason is explicit.

[0105] In practical applications, if the error analysis model can determine the clear cause of an error based on the context, it can accurately generate error codes, log scanning rules, and resolve errors. Therefore, in the embodiments of this specification, the purpose of using the error analysis model to perform cause analysis is to identify error codes with definite causes in order to accurately generate log scanning rules and error resolution strategies. Based on this, the error cause in the error cause example can be represented as precise error cause description information, and / or as information on whether it is a clear error cause, such as "CLEAR" (indicating clear) or "UNKNOWN" (indicating unclear) to represent the error cause. It should be noted that, in order for the error analysis model to better understand the difference between clear and unclear, the second error code example and the corresponding error cause example can include both examples with clear error causes and opposite examples with unclear error causes, so that the error analysis model can fully understand the context from the perspective of both positive and negative examples and more accurately learn the correlation between code error information and error causes.

[0106] It is understandable that there are many types of errors in program code. Some errors require focused attention and resolution, while others may be unsolvable due to their ambiguity and therefore do not require attention. For example, errors caused by improper parameter configuration or those with clearly defined triggering rules can be resolved more precisely compared to other errors. Based on this, in one or more embodiments of this specification, to more accurately analyze code errors of interest and improve analysis efficiency, error cause attention information is added to the cause analysis task data group, thus including error cause attention information in the cause analysis task data group. In this way, the error analysis model can be used to generate relevant error codes and their corresponding error causes based on the error cause attention information after identifying the error codes and their corresponding error causes in the program code to be analyzed.

[0107] Error cause focus information is descriptive information used to describe which error cause is being focused on. For example, the error cause focus information can be expressed as: "Of all errors, we only focus on errors caused by improper parameter configuration, or errors with clearly defined triggering rules." When the error analysis model performs tasks guided by prompt words, error cause focus information can be added to the cause analysis task prompt words to guide the error analysis model to generate corresponding error causes for the focused error codes. This embodiment follows the previous example of cause analysis task prompt words, which can be expressed as:

[0108] "As an Apache Spark developer, please read the Spark source code. If you encounter 'SparkException' or 'QueryExecutionErrors' in the source code, please provide the reason for the error based on the error code. If the reason is unclear, mark it as UNKNOWN; if the reason is clear from the context, mark it as CLEAR. Of all errors, only focus on those caused by improper parameter configuration or those with clearly defined triggering rules..."

[0109] In this embodiment, the error analysis model can identify the error codes and their corresponding error causes in the program code to be analyzed, and then generate the error codes of interest and their corresponding error causes based on the error cause information. This allows for more accurate analysis of the code errors of interest and improves analysis efficiency.

[0110] In one or more embodiments of this specification, the error analysis model can first perform a cause analysis task to find the cause of the error, and then perform a rule analysis task to generate log scanning rules. Specifically, the analysis task data group includes: a cause analysis task data group and a rule analysis task data group.

[0111] The cause analysis task data set includes: the program code to be analyzed, a second error code example related to the error code, and a corresponding error cause example. The rule analysis task data set includes: a first error code example related to the error code and a corresponding log scanning rule example.

[0112] Accordingly, the analysis task data set is input as at least a portion of the prompt words into the error analysis model, which then generates log scanning rules, including:

[0113] The cause analysis task data set is input into the error analysis model as at least part of the prompt words. The error analysis model generates an error code and the error cause corresponding to the error code. The error analysis model is used to perform context learning based on the second error code example and the corresponding error cause example to identify the error code and the error cause corresponding to the error code in the program code to be analyzed.

[0114] The rule analysis task data set is input into the error analysis model as at least part of the prompt words. The error analysis model generates log scanning rules for the error code. The error analysis model is used to perform context learning based on the first error code example and the corresponding log scanning rule example to generate corresponding log scanning rules for the error code.

[0115] In this embodiment, the error analysis model first performs a cause analysis task to find the cause of the error, and then performs a rule analysis task to generate log scanning rules. This allows the model to fully understand the context based on a clear understanding of the cause of the error, generate log scanning rules more accurately, and effectively improve the accuracy of the log scanning rules generated by the model.

[0116] When the error analysis model performs tasks guided by prompts, the cause analysis task data set comprises at least a portion of the cause analysis task prompts described in natural language. These prompts instruct the error analysis model to perform context learning based on the second error code example and the corresponding error cause example to identify the error code and its corresponding error cause in the program code to be analyzed. Similarly, the rule analysis task data set comprises at least a portion of the rule analysis task prompts described in natural language. These prompts instruct the error analysis model to perform context learning based on the first error code example and the corresponding log scanning rule example to generate corresponding log scanning rules for the error code.

[0117] For example, the cause analysis task prompts can be linguistically organized for smooth semantic expression by combining the second error code example and the error cause example, specifically including the following:

[0118] "As an Apache Spark developer, please read the Spark source code. If you encounter 'SparkException' or 'QueryExecutionErrors' in the source code, please provide the reason for the error based on the error code. If the reason is unclear, mark it as UNKNOWN; if the reason is clear from the context, mark it as CLEAR. Of all errors, only focus on those caused by improper parameter configuration or those with clearly defined triggering rules."

[0119] The output is a JSON array, where each element contains two fields: 'errorName' and 'errorType', used to indicate the error code and whether the error reason is explicit, respectively. Here is an example:

[0120] Spark source code statement 1…

[0121] Spark source code statement 2…

[0122] throw QueryExecutionErrors.divideByZeroErro

[0123] The error "QueryExecutionErrors.divideByZeroError" is thrown.

[0124] Spark source code statement 3…

[0125] Our expected output is [{"errorName":"divideByZeroError","errorType":"CLEAR"}]. In this example, we can see that the source code triggers a divideByZeroError due to division by 0, and the triggering rule is clear: division by 0 is not allowed.

[0126] Here is a counterexample, with the source code as follows:

[0127] Spark source code statement 4…

[0128] Spark source code statement 5…

[0129] throw new UnsupportedCallbackException(callback);

[0130] Throws a new UnsupportedCallbackException(callback) error.

[0131] Spark source code statement 6…

[0132] Our expected output is [{"errorName":"UnsupportedCallbackException","errorType":"UNKNOWN"}]. In this example, we can see that the error reason for "UnsupportedCallbackException" in the source code is unclear, so the value of the error reason field is "UNKNOWN".

[0133] For example, the rule analysis task prompts can be linguistically organized for the smoothness of semantic expression, taking into account the first error code example and log scanning rule example related to the error code "executeBroadcastTimeoutError", as follows:

[0134] "As an Apache Spark developer, please read the Spark source code. Some code error messages correspond to specific regular expressions in the program logs. Please provide a regular expression to help me find code errors from the program logs. Here is an example:"

[0135] Spark source code statement 1…

[0136] Spark source code statement 2…

[0137] throw executeBroadcastTimeoutError

[0138] / Throws an executeBroadcastTimeoutError error

[0139] Spark source code statement 3…

[0140] Our expected output for the log scanning rule is: Unable to perform broadcast within .* seconds.

[0141] The example above identifies a log scanning rule that prevents broadcasting within .* seconds. This log scanning rule can be used to locate the corresponding error message in the program log and identify the log entry containing the corresponding error message.

[0142] In this embodiment, the error analysis model, based on the prompt words, first performs a cause analysis task to find the cause of the error, and then performs a rule analysis task to generate log scanning rules. The model can generate log scanning rules based on a full understanding of the context and the cause of the error, thereby improving the accuracy and generation efficiency of the log scanning rules generated by the model.

[0143] In one or more embodiments, when the model determines that the error cause corresponding to the error code is clear, it can further perform context learning based on error code examples and corresponding error resolution examples to generate error resolution strategies for the error codes, so as to help users quickly resolve code errors and improve code development efficiency. Specifically, the analysis task data group also includes: third error code examples related to the error codes and corresponding error resolution examples;

[0144] The error analysis model is further used to, after identifying the error code and the error cause corresponding to the error code in the program code to be analyzed, perform context learning based on the third error code example and the corresponding error resolution example, learn the third correlation between the third error code example and the corresponding error resolution example, and use the third correlation to generate a corresponding error resolution strategy for the error code.

[0145] The third error code example can be program code developed using any one or more program development tools, containing code error information. The method for obtaining the third error code example can be the same as that for obtaining the first error code example. The practical application of the third error code example can refer to the example of the first error code example, and will not be repeated here. The content of the third error code example and the first error code example can be the same or different, as long as the error information (such as the error code) in the third error code example has a corresponding error resolution strategy in the corresponding error resolution example. For example, the third error code example may also include relevant information about the resolution strategy for resolving the errors therein, such as the third error code example being:

[0146] "Spark source code statement 1..."

[0147] Spark source code statement 2…

[0148] executeBroadcastTimeoutError(timeout:Long,ex:Option[TimeoutException]):Throwable={new SparkException(…

[0149] Broadcasts cannot be executed within $timeout seconds. You can increase the broadcast timeout.

[0150] | Set ${SQLConf.BROADCAST_TIMEOUT.key} or disable broadcast connections

[0151] This can be achieved by setting ${SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key} to -1.

[0152] Spark source code statement 3…”

[0153] Error resolution examples are sample error resolution strategies used to resolve errors corresponding to error codes. Error resolution strategies are information about the methods used to resolve errors in the code. Through error resolution examples, error analysis models can fully understand the context, learn error resolution capabilities, and generate error resolution strategies based on the location of the error code.

[0154] For example, the error resolution example corresponding to the third error code example above can be expressed as follows:

[0155] "To resolve this exception, you can set SQLConf.BROADCAST_TIMEOUT.key to -1, or set SQLConf.BROADCAST_TIMEOUT.key to a larger value. Another configuration option is to get the exact string values ​​of SQLConf.BROADCAST_TIMEOUT and SQLConf.AUTO_BROADCASTJOIN_THRESHOLD."

[0156] It is understandable that in practical applications, if the error analysis model can determine the clear cause of the error based on the context, it can accurately generate error codes, more accurately generate log scanning rules, and resolve errors. Therefore, in the embodiments of this specification, after performing the cause analysis task using the error analysis model, for error codes with clear causes, it can more accurately generate corresponding error resolution strategies for the error codes.

[0157] In one or more embodiments, the analysis task data group includes: the program code to be analyzed, a second error code sample related to the error code and a corresponding error cause sample, a first error code sample related to the error code and a corresponding log scanning rule sample, and a third error code sample related to the error code and a corresponding error resolution sample.

[0158] Accordingly, the error analysis model is also used to perform context learning based on the third error code example and the corresponding error resolution example after identifying the error code in the program code to be analyzed and the error cause corresponding to the error code, and to generate a corresponding error resolution strategy for the error code.

[0159] In this embodiment, when the error analysis model performs tasks guided by prompt words, analyzing the task prompt words can instruct the error analysis model to perform context learning based on the second error code example and the corresponding error cause example, identify the error code and the corresponding error cause in the program code to be analyzed, and after identifying the error code and the corresponding error cause in the program code to be analyzed, perform context learning based on the third error code example and the corresponding error resolution example to determine the corresponding error resolution strategy for the error code, and perform context learning based on the first error code example and the corresponding log scanning rule example to generate the corresponding log scanning rule for the error code, thereby guiding the error analysis model to finally output the log scanning rule and error resolution strategy corresponding to the error code.

[0160] For example, the analysis task prompt words can be expressed as:

[0161] "As a software engineer, you are working on a project using Apache Spark for large-scale data processing. During operation, you have encountered several SparkException exceptions. You would like to analyze the source code to identify the error codes and causes of these exceptions, and to determine the corresponding error resolution strategies and log scanning rules to prevent recurrence. The log scanning rules should include at least one regular expression to scan the program logs of the code where the error occurred for relevant error information. Below are examples of error codes, their corresponding causes, error resolution strategies, and log scanning rules:"

[0162] 1. NullPointerException

[0163] Error reason: An unexpected null value was encountered while performing an operation on an RDD or DataFrame.

[0164] Error resolution strategy: Ensure that the dataset is cleaned before operation and perform necessary null value checks.

[0165] Log scanning rule: *NullPointerException.*

[0166] 2.TaskNotSerializableException

[0167] Error reason: Spark attempted to send a non-serializable object to a worker node.

[0168] Error resolution strategy: Confirm that the custom class or function implements the Serializable interface, or refactor the code to avoid transferring such objects across the network.

[0169] Log scanning rule: *TaskNotSerializableException.*

[0170] 3. OutOfMemoryError

[0171] Error reason: Spark executor is out of memory or data partition is too large.

[0172] Error resolution strategies: Adjust memory configuration, increase executor memory, enable memory management options (such as spark.memory.fraction), and effectively partition data.

[0173] Log scan rule: *OutOfMemoryError.*

[0174] 4. ExecutorLostFailure

[0175] Error reason: The executor was lost due to node crash or network problem.

[0176] Troubleshooting strategy: Increase the configuration of spark.task.maxFailures and spark.executor.heartbeatInterval, and investigate infrastructure issues.

[0177] Log scanning rule: .*ExecutorLostFailure.*

[0178] 5. AnalysisException

[0179] Error reason: DataFrame API logical plan problem, such as invalid column reference or operation.

[0180] Error resolution strategy: Check column names and operations to ensure compatibility with the DataFrame schema.

[0181] Log scanning rule: .*AnalysisException.*

[0182] 6. ShuffleFetchFailedException

[0183] Error reason: The task cannot obtain shuffled data.

[0184] Error resolution strategy: Adjust the shuffling-related configurations (such as spark.reducer.maxSizeInFlight) and optimize the transformation to reduce the amount of shuffled data.

[0185] Log scanning rule: *ShuffleFetchFailedException.*

[0186] 7. Py4JJavaError

[0187] Error reason: A Java error occurred in the Spark backend during PySpark usage.

[0188] Error resolution strategy: Check if the PySpark and Java Spark component versions are compatible.

[0189] Log scanning rule: .*Py4JJavaError.*

[0190] 8.SparkDriverExecutionException

[0191] Error cause: Driver-side error, such as collecting too much data into driver or broadcast variables.

[0192] Error resolution strategy: Avoid collecting large amounts of data on the driver and check the use of broadcast variables.

[0193] Log scanning rule: *SparkDriverExecutionException.*

[0194] 9. StorageLevel related issues

[0195] Error reason: The RDD or DataFrame has an incorrect storage level.

[0196] Error resolution strategy: Correctly configure persistence and storage levels according to resources and requirements.

[0197] Log scanning rule: .*StorageLevel.*Exception.*".

[0198] Unlike the aforementioned embodiment where the analysis task data set is input all at once, allowing the model to generate corresponding log scanning rules and error resolution strategies in one go, in one or more other embodiments, the cause analysis task data set can be input into the error analysis model first to obtain the error codes generated by the error analysis model and the corresponding error causes. Then, a resolution task data set is determined, wherein the resolution task data set includes: a third error code sample related to the error code and a corresponding error resolution sample. Subsequently, the resolution task data set is input into the error analysis model to obtain the error resolution strategy generated by the error analysis model for the error code.

[0199] Furthermore, when the error analysis model performs tasks guided by prompt words, the task resolution data set is at least a portion of the task resolution prompt words described in natural language. The task resolution prompt words are used to instruct the error analysis model to perform context learning based on the third error code example and the corresponding error resolution example, and to generate a corresponding error resolution strategy for the error code.

[0200] For example, the task-solving prompts may be linguistically organized to ensure smooth semantic expression, including format constraints on the output error-solving strategies. For instance, the task-solving prompts may be expressed as:

[0201] "As an Apache Spark developer, please read the Spark source code. The error messages may contain methods to resolve these errors. Here is an example:"

[0202] Spark source code statement 1…

[0203] Spark source code statement 2…

[0204] executeBroadcastTimeoutError(timeout:Long,ex:Option[TimeoutException]):Throwable={new SparkException(…

[0205] Broadcasts cannot be executed within $timeout seconds. You can increase the broadcast timeout.

[0206] | Set ${SQLConf.BROADCAST_TIMEOUT.key} or disable broadcast connections

[0207] This can be achieved by setting ${SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key} to -1.

[0208] Spark source code statement 3…

[0209] You can see that to resolve this exception, you can set SQLConf.BROADCAST_TIMEOUT.key to -1, or set SQLConf.BROADCAST_TIMEOUT.key to a larger value. Another configuration option is to retrieve the exact string values ​​of SQLConf.BROADCAST_TIMEOUT and SQLConf.AUTO_BROADCASTJOIN_THRESHOLD. The output is in JSON format; here is an example of the output:

[0210] {"error":"executeBroadcastTimeoutError","solution":"Set `SQLConf.BROADCAST_TIMEOUT.key` to -1 or `SQLConf.BROADCAST_TIMEOUT.key` to a larger value.","conf":["SQLConf.BROADCAST_TIMEOUT","SQLConf.AUTO_BROADCASTJOIN_THRESHOLD"]} If there are no configuration items in the resolution strategy, an empty array can be given."

[0211] In this embodiment, the error analysis model first performs a cause analysis task to find the cause of the error, and then performs a resolution task for the error code to generate an error resolution strategy. The model can generate an error resolution strategy based on a full understanding of the context and the cause of the error, thereby achieving the goal of improving the accuracy and generation efficiency of the error resolution strategy generated by the model.

[0212] It should be noted that the embodiments in this specification do not limit the language used for the prompts in the input error analysis model; any one or more languages, such as Chinese or English, can be used. In one or more embodiments, considering that program code is generally expressed using English letters and numbers, in order to enable the error analysis model to better understand the context and eliminate illusions, the prompts can be expressed in English, a language with prompting semantics.

[0213] In conjunction with the above embodiments, the step of inputting the analysis task data set into the error analysis model to obtain the log scanning rules generated by the error analysis model can be achieved by the error analysis model sequentially executing three steps: cause analysis task, resolution task, and rule analysis task. Specifically, the analysis task data set is input into the error analysis model as at least a portion of the prompt words, and the error analysis model generates log scanning rules, including:

[0214] The cause analysis task data set is input into the error analysis model as at least part of the prompt words, and the error analysis model generates an error code and the error cause corresponding to the error code. The cause analysis task data set includes: the program code to be analyzed, a second error code example related to the error code, and a corresponding error cause example.

[0215] The task data set is input into the error analysis model as at least part of the prompt words, and the error analysis model generates an error resolution strategy for the error code. The task data set includes: a third error code example related to the error code and a corresponding error resolution example.

[0216] The rule analysis task data set is input into the error analysis model as at least part of the prompt words, and the error analysis model generates log scanning rules for the error code. The rule analysis task data set includes: a first error code sample related to the error code and a corresponding log scanning rule sample.

[0217] In this embodiment, the error analysis model first performs context learning based on the second error code example and the corresponding error cause example to fully understand the clear error cause. Then, it generates error codes and corresponding error causes for the code to be analyzed. Based on the error analysis model's full understanding of the error cause, it then performs context learning based on the third error code example and the corresponding error resolution example to generate error resolution strategies for error codes with clear error causes. Subsequently, it generates corresponding log scanning rules for error codes that can be resolved, which can effectively improve the efficiency and accuracy of generating log scanning rules and error resolution strategies.

[0218] In one or more embodiments, when the error analysis model performs tasks guided by prompt words, the error analysis model can be a large model that performs tasks based on prompt words. When the large model sequentially performs cause analysis, resolution, and rule analysis tasks, it can input prompt words corresponding to the tasks into the error analysis model. Specifically:

[0219] The cause analysis task data set is at least part of the cause analysis task prompt words described in natural language. The cause analysis task prompt words are used to instruct the error analysis model to perform context learning based on the second error code example and the corresponding error cause example to identify the error code in the program code to be analyzed and the error cause corresponding to the error code.

[0220] The task resolution data set consists of at least a portion of the task resolution prompts described in natural language, which is used to instruct the error analysis model to perform context learning based on the third error code example and the corresponding error resolution example, and to generate a corresponding error resolution strategy for the error code.

[0221] The rule analysis task data set consists of at least a portion of rule analysis task prompts described in natural language. These prompts instruct the error analysis model to perform contextual learning based on the first error code example and the corresponding log scanning rule example, and to generate corresponding log scanning rules for the error code.

[0222] The specific implementation of the above prompt words can be found in the descriptions of the previous embodiments, and will not be repeated here.

[0223] This embodiment leverages the powerful semantic understanding capabilities of large models to generate log scanning rules and corresponding error resolution strategies more accurately under the guidance of the aforementioned prompts.

[0224] Furthermore, for errors where a solution strategy cannot be derived from the aforementioned examples, search techniques can be further incorporated to generate such strategies. Specifically, the method further includes:

[0225] If no error resolution strategy is generated for any error code, then reference data related to the error code is searched out, wherein the reference data includes: reference error code examples and corresponding error resolution examples;

[0226] The error analysis model inputs at least part of the error code and the reference data as prompt words, and the error analysis model generates an error resolution strategy for the error code.

[0227] The error analysis model is used to perform context learning based on the reference error code example and the corresponding error resolution example, learn the fourth correlation between the reference error code example and the corresponding error resolution example, and use the fourth correlation to generate a corresponding error resolution strategy for any error code.

[0228] The reference data refers to error code-related data retrieved from any website, public account, database, and / or system using any search technology. The search technology for the search parameters is not limited; for example, any one or more search applications can be used to retrieve error code-related reference data. For instance, the API of a search application can be called to retrieve error code-related information and content snapshots as reference data. Based on this, a set of search and resolution task data can be determined based on the reference data to input into the error analysis model. The error analysis model then performs context learning based on the reference error code examples and corresponding error resolution examples in the reference data, generating corresponding error resolution strategies for each error code.

[0229] Furthermore, when the error analysis model performs tasks guided by prompt words, the task resolution data set comprises at least a portion of the task resolution prompt words, which instructs the error analysis model to perform contextual learning based on the reference error code example and the corresponding error resolution example, and to generate a corresponding error resolution strategy for any of the error codes.

[0230] For example, the task-solving prompt can be expressed as:

[0231] "I will provide web search results for error code %s in JSON format. 'Title' represents the webpage title, and 'Snapshots' are a summary and main content of the webpage. Please read the solutions within these. Then, solutions will be provided for %s."

[0232] The above-mentioned prompts include reference error code examples and corresponding error resolution examples in the web search results. As a result, the error analysis code can learn the context based on the web search results, learn the correlation between the reference error code examples and the corresponding error resolution examples, and use this correlation to generate corresponding error resolution strategies for the error codes.

[0233] For example, this embodiment can combine a large model to automatically generate log scanning rules and corresponding error resolution strategies. Specifically, firstly, the large model can be used to analyze the code to be analyzed, generating error codes (such as SparkException) and their corresponding error causes. Then, the large model can be used to generate error resolution strategies for the error codes. Next, the large model can be used to generate log scanning rules for the error codes. Finally, for error codes for which no error resolution strategies have been generated, search techniques can be further combined to generate corresponding error resolution strategies.

[0234] In the above embodiments, reference data (such as discussion threads in open source communities) are retrieved by combining search technology, and corresponding error resolution strategies are generated for error codes. This can provide accurate and effective solutions for code errors, effectively improving code development efficiency.

[0235] In the embodiments of this specification, the error resolution strategy generated by the error analysis model can be further standardized to form a debugging document for subsequent use. The debugging document may contain detailed information such as the code error information corresponding to the error code, the event that triggered the error, the cause of the error, and the error resolution strategy. For example, the debugging document may contain the following content:

[0236] Why does Spark encounter network connection failures when accessing external data sources?

[0237] Cause: ENI was not enabled when accessing external data sources via VPC.

[0238] Solution: You need to configure the `spark.adb.eni.enabled`, `spark.adb.eni.vswitchId`, and `spark.adb.eni.securityGroupId` parameters in your submitted Spark application. The configuration methods for these parameters differ depending on the data source. For details, please refer to "Spark Application Configuration Parameters and Accessing External Data Sources".

[0239] To make the methods provided in the embodiments of this specification easier to understand, the following description, in conjunction with Figure 4, takes the application of the log scanning rule generation method for code error analysis provided in this specification in a large model as an example to further illustrate the log scanning rule generation method for code error analysis. Figure 4 shows a flowchart of the processing procedure of a log scanning rule generation method for code error analysis provided in an embodiment of this specification, specifically including the following steps.

[0240] Step 402: Obtain the program code to be analyzed.

[0241] In this step, in response to receiving a code error analysis task, the corresponding program code to be analyzed can be obtained.

[0242] Step 404: Generate the cause analysis task data set based on the program code to be analyzed.

[0243] Specifically, the root cause analysis task data set includes: the program code to be analyzed, second error code examples related to the error codes and their corresponding error cause examples, and root cause analysis task prompts. The program code to be analyzed, the second error code examples related to the error codes, and their corresponding error cause examples can serve as at least part of the root cause analysis task prompts to better guide the large model in performing the task.

[0244] Step 406: Input the root cause analysis task data set into the large model, so that the large model can generate error codes and corresponding error causes based on the root cause analysis task prompts.

[0245] In this step, the root cause analysis task data set is input into the large model as at least part of the root cause analysis task prompts.

[0246] Step 408: Determine the data group for resolving the task.

[0247] Specifically, the task resolution data set includes: third error code examples related to the error codes and corresponding error resolution examples. The third error code examples and corresponding error resolution examples serve as at least part of the task resolution prompts to better guide the large model in performing the task.

[0248] Step 410: Input the task resolution data set into the large model, so that the large model can generate the error resolution strategy corresponding to the error code based on the task resolution prompt words.

[0249] In this step, the task-solving data set is input into the large model as at least part of the task-solving prompts.

[0250] Step 412: Determine the data group for the rule analysis task.

[0251] Specifically, the rule analysis task data set includes: first error code examples related to error codes and corresponding log scanning rule examples. The first error code examples and corresponding log scanning rule examples serve as at least part of the rule analysis task prompts to better guide the large model in executing the task.

[0252] Step 414: Input the rule analysis task data group into the large model, so that the large model can generate log scanning rules corresponding to the error codes according to the guidance of the rule analysis task prompts.

[0253] In this step, the rule analysis task data set is input into the large model as at least part of the rule analysis task prompt words.

[0254] By going through steps 402-414 above, we can obtain the error codes output by the large model and the corresponding error causes, log scanning rules, and error resolution strategies more accurately.

[0255] For example, large models can be used to generate log scanning rules for Spark source code, thereby accelerating the process of identifying log scanning rules and corresponding error resolution strategies that cause errors due to improper configuration from the Spark source code. Generating log scanning rules from Spark source code analysis allows for faster tracking of source code changes, eliminating the need for manual error correction during use. In one or more embodiments, since log scanning rules can be represented as static rules and stored in a database, the log scanning engine can then retrieve these rules from the database and use them to perform error scanning on the program logs of Spark applications that have encountered errors in real-world applications. This eliminates the need to call large models and search engines for every error, effectively improving the efficiency of error scanning and resolution.

[0256] Corresponding to the above-described method embodiments, this specification also provides an embodiment of a code error analysis method for scanning program logs. Referring to Figure 5, a flowchart of a code error analysis method according to an embodiment of this specification is shown, specifically including the following steps.

[0257] Step 502: Obtain log scanning rules.

[0258] The log scanning rules are generated by an error analysis model. The error analysis model is used to perform context learning based on the input first error code example and the corresponding log scanning rule example, learning a first correlation between the first error code example and the corresponding log scanning rule example, and using this first correlation to generate corresponding log scanning rules for the input program code to be analyzed.

[0259] Specifically, in response to receiving a code error analysis task, the server obtains the program code to be analyzed corresponding to the code error analysis task, determines an analysis task data group based on the program code to be analyzed, and inputs the analysis task data group as at least part of the prompt words into the error analysis model. The error analysis model then generates log scanning rules. The analysis task data group includes: the program code to be analyzed, a first error code example, and a corresponding log scanning rule example. The implementation details for generating the log scanning rules can be referred to the foregoing embodiments and will not be repeated here.

[0260] In one or more embodiments, the server can update the generated log scanning rules to the log scanning rule database. By accumulating log scanning rules, more updated and comprehensive log scanning rules can be obtained from the database when code error analysis is required.

[0261] In one or more other embodiments, the server may also apply the aforementioned code error analysis method to generate log scanning rules when it receives a code error analysis request.

[0262] For example, log scanning rules can be represented as regular expressions that correspond one-to-one with error codes. Furthermore, each error code's corresponding log scanning rule can also have corresponding tagging information, which can be used to indicate which type of program logs the log scanning rule is intended to scan.

[0263] In addition, the obtained log scanning rules can also include corresponding error reasons and error resolution strategies.

[0264] For example, the error code, the corresponding marking information, the corresponding error reason, and the error resolution strategy can be represented as shown in the table below:

[0265] Step 504: Obtain the program log, which is the log generated when the program code runs.

[0266] The program log refers to the log generated when the program code is running. For example, the program log may include information such as the program's running status, code error information, performance indicators, and key events.

[0267] For example, program logs can be stored using object storage services. When program logs are needed, they can be retrieved from object storage services. For instance, if the size of broadcast data exceeds the system's allowed limit during program execution, the program log will record "Unable to execute broadcast within .* seconds".

[0268] Step 506: Using the log scanning rules, perform an error scan on the program log to obtain the error scan results.

[0269] The error scan results are descriptive information used to describe code errors found in the program log. For example, the error scan results can be used to describe the time when the code error occurred, the location of the error (such as the line number of the error in the program code), the type of error, etc.

[0270] Error scanning of program logs using log scanning rules can be achieved through the execution of automated scanning scripts. For example, when a Spark program fails to run, the automated scanning script can use the acquired log scanning rules to automatically scan the program logs for errors, obtain error scan results (such as accurately locating the error type), and corresponding error resolution strategies including parameter tuning suggestions. This reduces the time developers spend debugging programs and improves development efficiency.

[0271] For example, the above log scanning rule "unable to perform broadcast within .* seconds" can be matched in the program log. If a corresponding error occurs during the execution of the program code, the error can be located in the program log, the position of the error in the program log can be recorded, and the error scanning result can be obtained.

[0272] This method uses log scanning rules generated based on an error analysis model to perform error scanning on program logs, which can quickly identify errors in program code, improve the efficiency of error analysis, and enhance development efficiency.

[0273] In one or more embodiments, to further improve development efficiency, the method further includes: obtaining an error resolution strategy corresponding to the error scan result based on the log scanning rule corresponding to the error scan result and the error resolution strategy corresponding to the log scanning rule.

[0274] The specific generation method of the error resolution strategy corresponding to the log scanning rule can be implemented with reference to the foregoing embodiments, and will not be elaborated here. For example, the error resolution strategy corresponding to the log scanning rule can be stored in the database along with the log scanning rule. When it is necessary to perform an error scan on the program log, the error resolution strategy and the log scanning rule are read from the database together, so that when an error is detected, the error can be quickly resolved based on the obtained error resolution strategy. For example, the error scan results and the corresponding error resolution strategy can be sent to the client device for user use, or the error resolution can be automatically executed directly on the client device to improve error resolution efficiency.

[0275] For example, when the above log scanning rule "unable to perform broadcast within .* seconds" is matched in the program log, if this error is found, the corresponding error resolution strategy "disable broadcast connection" can be obtained at the same time. Then, according to the error resolution strategy, the code parameter at the corresponding error position in the program code can be changed to the parameter corresponding to "disable broadcast connection".

[0276] The error resolution strategy may include a parameter adjustment strategy for the program code.

[0277] Accordingly, the method further includes:

[0278] The error scan results and the parameter adjustment strategy are sent to the client device of the user corresponding to the program log, so that the client device can perform parameter tuning on the program code corresponding to the program log based on the parameter adjustment strategy to obtain the tuned program code.

[0279] The parameter tuning strategy refers to resolving errors in program code by adjusting its parameters. This strategy may include the names of the parameters to be adjusted. It's understood that error scanning results can pinpoint the parameters associated with the error, allowing for parameter adjustments based on the error resolution strategy to resolve the error. For example, in Spark, parameters can be passed to the SparkContext constructor via a SparkConf object. SparkContext is the main entry point for Spark applications, and its configuration is set by reading configuration information from SparkConf.

[0280] In this embodiment, considering that many code errors are caused by improper parameter adjustment, and that such errors have a formulaic adjustment strategy that does not require modification of the source code, this embodiment uses a parameter adjustment strategy to perform parameter tuning without modifying the source code. This allows for efficient and quick problem-solving through parameter tuning, improving development efficiency.

[0281] Corresponding to the above-described method embodiments, this specification also provides an embodiment of a code error analysis method applied to a client device. Referring to Figure 6, a flowchart of a code error analysis method according to yet another embodiment of this specification is shown, specifically including the following steps.

[0282] Step 602: Send a code error analysis request to the server.

[0283] This step enables the server to obtain the log scanning rules and the program logs corresponding to the code error analysis request, and to perform error scanning on the program logs using the log scanning rules to obtain the error scanning results.

[0284] The log scanning rules are generated by an error analysis model. The error analysis model is used to perform context learning based on the input first error code sample and the corresponding log scanning rule sample, learn the first correlation between the first error code sample and the corresponding log scanning rule sample, and use the first correlation to generate corresponding log scanning rules for the input program code to be analyzed.

[0285] Step 604: Receive the error scan results returned by the server.

[0286] It should be noted that the implementation details of steps 602 to 604 can be found in the relevant descriptions of steps 302 to 306 above, and will not be repeated here in the embodiments of this specification.

[0287] For example, Figure 7 shows a schematic diagram of a user interface provided in one embodiment of this specification. The client device can provide the user interface shown in Figure 7. The user interface includes a request input interface and a result display interface. The request input interface includes a request input box, "OK," and "Cancel" controls. The result display interface includes display boxes for error scan results and error resolution strategies.

[0288] Based on the user interface shown in Figure 7, users can input code error analysis requests through the request input box displayed on the client device. For example, for one or more program logs, clicking the "OK" control sends the code error analysis request to the server. The server retrieves the corresponding program logs, obtains the log scanning rules, and uses the log scanning rules to perform error scanning on the program logs, obtaining the error scanning results and error resolution strategies. The server returns the error scanning results and error resolution strategies to the client device, allowing the client device to display the error scanning results and error resolution strategies in the display box. Additionally, the client device can automatically or with user confirmation execute error resolution strategies on the program code, thereby eliminating errors in the program code and improving development efficiency.

[0289] In practical applications, users can interact with controls in various ways, including clicking, double-clicking, touching, hovering, swiping, long-pressing, voice control, or shaking. The specific method chosen depends on the actual situation, and this specification does not impose any limitations on this.

[0290] Corresponding to the above method embodiments, this specification also provides an embodiment of a log scanning rule generation device for code error analysis. Figure 8 shows a schematic diagram of the structure of a log scanning rule generation device for code error analysis provided in one embodiment of this specification. As shown in Figure 8, the device includes:

[0291] The code acquisition module 802 is configured to acquire the program code to be analyzed corresponding to the code error analysis task in response to receiving the code error analysis task.

[0292] The task data determination module 804 is configured to determine an analysis task data group based on the program code to be analyzed, wherein the analysis task data group includes: the program code to be analyzed, a first error code sample, and a corresponding log scanning rule sample.

[0293] The model input module 806 is configured to input at least a portion of the analysis task data set as prompt words into the error analysis model, and the error analysis model generates log scanning rules.

[0294] The error analysis model is used to perform context learning based on the first error code example and the corresponding log scanning rule example, learn the first correlation between the first error code example and the corresponding log scanning rule example, and use the first correlation to generate corresponding log scanning rules for the program code to be analyzed, wherein the log scanning rules are used to perform error scanning on the program log.

[0295] The above is an illustrative scheme of a log scanning rule generation device for code error analysis according to this embodiment. It should be noted that the technical solution of this log scanning rule generation device for code error analysis belongs to the same concept as the technical solution of the log scanning rule generation method for code error analysis described above. Details not described in detail in the technical solution of the log scanning rule generation device for code error analysis can be found in the description of the technical solution of the log scanning rule generation method for code error analysis described above.

[0296] Corresponding to the above method embodiments, this specification also provides another embodiment of a code error analysis device. Figure 9 shows a schematic diagram of the structure of a code error analysis device provided in another embodiment of this specification. As shown in Figure 9, the device includes:

[0297] The scanning rule acquisition module 902 is configured to acquire log scanning rules, which are generated by an error analysis model. The error analysis model is used to perform context learning based on the input first error code sample and the corresponding log scanning rule sample, learn the first correlation between the first error code sample and the corresponding log scanning rule sample, and use the first correlation to generate corresponding log scanning rules for the input program code to be analyzed.

[0298] The program log acquisition module 904 is configured to acquire program logs, which are logs generated during program code execution.

[0299] Error scanning module 906 is configured to perform error scanning on the program log using the log scanning rules to obtain error scanning results.

[0300] In one or more embodiments, the apparatus further includes: a policy acquisition module, configured to obtain an error resolution policy corresponding to the error scan result based on the error resolution policy corresponding to the log scanning rule.

[0301] In one or more embodiments, the error resolution strategy includes a parameter adjustment strategy for the program code. The apparatus further includes a result sending module configured to send the error scan results and the parameter adjustment strategy to a client device of the user corresponding to the program log, causing the client device to perform parameter tuning on the program code corresponding to the program log based on the parameter adjustment strategy, thereby obtaining the tuned program code.

[0302] The above is a schematic scheme of a code error analysis device according to this embodiment. It should be noted that the technical solution of this code error analysis device and the technical solution of the above-described code error analysis method belong to the same concept. For details not described in detail in the technical solution of the code error analysis device, please refer to the description of the technical solution of the above-described code error analysis method.

[0303] Corresponding to the above method embodiments, this specification also provides an embodiment of a code error analysis device configured on a client device. Figure 10 shows a schematic diagram of the structure of a code error analysis device provided in another embodiment of this specification. As shown in Figure 10, the device includes:

[0304] The request sending module 1002 is configured to send a code error analysis request to the server, so that the server obtains the log scanning rules and the program log corresponding to the code error analysis request, and uses the log scanning rules to perform error scanning on the program log to obtain the error scanning result.

[0305] The log scanning rules are generated by an error analysis model. The error analysis model is used to perform context learning based on the input first error code sample and the corresponding log scanning rule sample, learn the first correlation between the first error code sample and the corresponding log scanning rule sample, and use the first correlation to generate corresponding log scanning rules for the input program code to be analyzed.

[0306] The result receiving module 1004 is configured to receive the error scan results returned by the server.

[0307] The above is a schematic scheme of a code error analysis device according to this embodiment. It should be noted that the technical solution of this code error analysis device and the technical solution of the above-described code error analysis method belong to the same concept. For details not described in detail in the technical solution of the code error analysis device, please refer to the description of the technical solution of the above-described code error analysis method.

[0308] Figure 11 shows a structural block diagram of a computing device 1100 according to an embodiment of this specification. The components of the computing device 1100 include, but are not limited to, a memory 1110 and a processor 1120. The processor 1120 is connected to the memory 1110 via a bus 1130, and a database 1150 is used to store data.

[0309] The computing device 1100 also includes an access device 1140, which enables the computing device 1100 to communicate via one or more networks 1160. Examples of these networks include Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or combinations of communication networks such as the Internet. The access device 1140 may include one or more of any type of wired or wireless network interface (e.g., a network interface controller (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) wireless interface, a Wi-MAX (Worldwide Interoperability for Microwave Access) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, or a Near Field Communication (NFC) interface.

[0310] In one embodiment of this specification, the aforementioned components of the computing device 1100, as well as other components not shown in FIG11, may be interconnected, for example, via a bus. It should be understood that the block diagram of the computing device shown in FIG11 is merely for illustrative purposes and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.

[0311] The computing device 1100 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or personal computers (PCs). The computing device 1100 can also be a mobile or stationary server.

[0312] The memory 1110 is used to store computer programs / instructions, and the processor 1120 is used to execute the computer programs / instructions stored in the memory 1110. When the computer programs / instructions are executed by the processor, they implement the steps of the log scanning rule generation method or code error analysis method described above for code error analysis.

[0313] The above is an illustrative scheme of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the code error analysis method described above belong to the same concept. For details not described in detail in the technical solution of the computing device, please refer to the description of the log scanning rule generation method or the technical solution of the code error analysis method used for code error analysis described above.

[0314] An embodiment of this specification also provides a computer-readable storage medium storing a computer program / instructions that, when executed by a processor, implement the steps of the log scanning rule generation method or code error analysis method described above for code error analysis.

[0315] The above is an illustrative scheme of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium belongs to the same concept as the technical solution of the log scanning rule generation method or code error analysis method for code error analysis described above. Details not described in detail in the technical solution of the storage medium can be found in the description of the technical solution of the log scanning rule generation method or code error analysis method for code error analysis described above.

[0316] An embodiment of this specification also provides a computer program product, including a computer program / instruction that, when executed by a processor, implements the steps of the log scanning rule generation method or code error analysis method described above for code error analysis.

[0317] The above is an illustrative scheme of a computer program product according to this embodiment. It should be noted that the technical solution of this computer program product belongs to the same concept as the technical solution of the log scanning rule generation method or code error analysis method for code error analysis described above. For details not described in detail in the technical solution of the computer program product, please refer to the description of the technical solution of the log scanning rule generation method or code error analysis method for code error analysis described above.

[0318] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.

[0319] The computer program / instructions include computer program code, which may be in the form of source code, object code, executable file, or certain intermediate forms. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately added or removed according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.

[0320] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments in this specification are not limited to the described order of actions, because according to the embodiments in this specification, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments in this specification.

[0321] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0322] The preferred embodiments disclosed above are merely illustrative of this specification. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the embodiments described herein. These embodiments are selected and specifically described in this specification to better explain the principles and practical applications of the embodiments, thereby enabling those skilled in the art to better understand and utilize this specification. This specification is limited only by the claims and their full scope and equivalents.

Claims

1. A method for generating log scanning rules for code error analysis, comprising: In response to receiving a code error analysis task, the program code to be analyzed corresponding to the code error analysis task is obtained; Based on the program code to be analyzed, an analysis task data group is determined, wherein the analysis task data group includes: the program code to be analyzed, a first error code sample, and a corresponding log scanning rule sample; The analysis task data set is used as at least part of the prompt words and input into the error analysis model, which then generates log scanning rules. The error analysis model is used to perform context learning based on the first error code example and the corresponding log scanning rule example, learn the first correlation between the first error code example and the corresponding log scanning rule example, and use the first correlation to generate corresponding log scanning rules for the program code to be analyzed, wherein the log scanning rules are used to perform error scanning on the program log.

2. The method according to claim 1, wherein the analysis task data set further comprises: Second error code example and corresponding error reason example; The error analysis model is used to perform context learning based on the second error code example and the corresponding error cause example, learn the second correlation between the second error code example and the corresponding error cause example, use the second correlation to identify the error code and the error cause corresponding to the error code in the program code to be analyzed, and perform context learning based on the first error code example and the corresponding log scanning rule example to generate a corresponding log scanning rule for the error code.

3. The method according to claim 1 or 2, wherein the analysis task data set further comprises: Pay attention to the error reason information; The error analysis model is used to identify the error codes and their corresponding error causes in the program code to be analyzed, and then output the error codes of interest and their corresponding error causes based on the error cause interest information.

4. The method according to any one of claims 1 to 3, wherein the analysis task data set comprises: The data sets are: a cause analysis task data set and a rule analysis task data set; wherein, the cause analysis task data set includes: the program code to be analyzed, a second error code example related to the error code, and a corresponding error cause example; the rule analysis task data set includes: a first error code example related to the error code and a corresponding log scanning rule example; The analysis task data set is input as at least a portion of the prompt words into the error analysis model, which then generates log scanning rules, including: The cause analysis task data set is input into the error analysis model as at least part of the prompt words. The error analysis model generates an error code and the error cause corresponding to the error code. The error analysis model is used to perform context learning based on the second error code example and the corresponding error cause example to identify the error code and the error cause corresponding to the error code in the program code to be analyzed. The rule analysis task data set is input into the error analysis model as at least part of the prompt words. The error analysis model generates log scanning rules for the error code. The error analysis model is used to perform context learning based on the first error code example and the corresponding log scanning rule example to generate corresponding log scanning rules for the error code.

5. The method according to any one of claims 1 to 4, wherein the analysis task data set further comprises: The example of the third error code related to the error code and the corresponding error resolution example; The error analysis model is further used to, after identifying the error code and the error cause corresponding to the error code in the program code to be analyzed, perform context learning based on the third error code example and the corresponding error resolution example, learn the third correlation between the third error code example and the corresponding error resolution example, and use the third correlation to generate a corresponding error resolution strategy for the error code.

6. The method according to any one of claims 1 to 5, further comprising: If no error resolution strategy is generated for any error code, then reference data related to the error code is searched, wherein the reference data includes: reference error code examples and corresponding error resolution examples; the error code and the reference data are input into the error analysis model as at least part of the prompt words, and the error analysis model generates an error resolution strategy for the error code. The error analysis model is used to perform context learning based on the reference error code example and the corresponding error resolution example, learn the fourth correlation between the reference error code example and the corresponding error resolution example, and use the fourth correlation to generate a corresponding error resolution strategy for any error code.

7. The method according to any one of claims 1 to 6, wherein the analysis task data set is input as at least a portion of the prompt words into an error analysis model, and the error analysis model generates log scanning rules, comprising: The cause analysis task data set is input into the error analysis model as at least part of the prompt words, and the error analysis model generates an error code and the error cause corresponding to the error code. The cause analysis task data set includes: the program code to be analyzed, a second error code example related to the error code, and a corresponding error cause example. The task data set is input into the error analysis model as at least part of the prompt words, and the error analysis model generates an error resolution strategy for the error code. The task data set includes: a third error code example related to the error code and a corresponding error resolution example. The rule analysis task data set is input into the error analysis model as at least part of the prompt words, and the error analysis model generates log scanning rules for the error code. The rule analysis task data set includes: a first error code sample related to the error code and a corresponding log scanning rule sample.

8. The method according to claim 7, wherein the error analysis model is a large model for performing tasks based on prompt words; The cause analysis task data set consists of at least a portion of the cause analysis task prompts described in natural language, wherein... The cause analysis task prompt is used to instruct the error analysis model to perform context learning based on the second error code example and the corresponding error cause example, and to identify the error code and the error cause corresponding to the error code in the program code to be analyzed; The task resolution data set comprises at least a portion of task resolution prompts described in natural language. The task resolution prompts are used to instruct the error analysis model to perform contextual learning based on the third error code example and the corresponding error resolution example, and to generate a corresponding error resolution strategy for the error code. The rule analysis task data set consists of at least a portion of rule analysis task prompts described in natural language. These prompts instruct the error analysis model to perform contextual learning based on the first error code example and the corresponding log scanning rule example, and to generate corresponding log scanning rules for the error code.

9. The method according to any one of claims 1 to 8, further comprising: Update the generated log scanning rules to the log scanning rule database.

10. A code error analysis method, comprising: Obtain log scanning rules, which are generated by an error analysis model. The error analysis model is used to perform context learning based on the input first error code sample and the corresponding log scanning rule sample, learn the first correlation between the first error code sample and the corresponding log scanning rule sample, and use the first correlation to generate corresponding log scanning rules for the input program code to be analyzed. Obtain the program log, which is the log generated during program code execution; Using the aforementioned log scanning rules, an error scan is performed on the program log to obtain the error scan results.

11. The method of claim 10, further comprising: Based on the log scanning rules corresponding to the error scanning results and the error resolution strategies corresponding to the log scanning rules, the error resolution strategy corresponding to the error scanning results is obtained.

12. The method according to claim 10 or 11, wherein the error resolution strategy includes a parameter adjustment strategy for the program code; The method further includes: The error scan results and the parameter adjustment strategy are sent to the client device of the user corresponding to the program log, so that the client device can perform parameter tuning on the program code corresponding to the program log based on the parameter adjustment strategy to obtain the tuned program code.

13. A code error analysis method, applied to a client device, comprising: Send a code error analysis request to the server, so that the server can obtain the log scanning rules and the program log corresponding to the code error analysis request, and use the log scanning rules to perform error scanning on the program log to obtain the error scanning results; The log scanning rules are generated by an error analysis model. The error analysis model is used to perform context learning based on the input first error code sample and the corresponding log scanning rule sample, learn the first correlation between the first error code sample and the corresponding log scanning rule sample, and use the first correlation to generate corresponding log scanning rules for the input program code to be analyzed. Receive the error scan results returned by the server.

14. A log scanning rule generation device for code error analysis, comprising: The code acquisition module is configured to acquire the program code to be analyzed corresponding to the code error analysis task in response to receiving the code error analysis task. The task data determination module is configured to determine an analysis task data group based on the program code to be analyzed, wherein the analysis task data group includes: the program code to be analyzed, a first error code sample, and a corresponding log scanning rule sample; The model input module is configured to input at least a portion of the analysis task data set as prompt words into the error analysis model, and the error analysis model generates log scanning rules. The error analysis model is used to perform context learning based on the first error code example and the corresponding log scanning rule example, learn the first correlation between the first error code example and the corresponding log scanning rule example, and use the first correlation to generate corresponding log scanning rules for the program code to be analyzed, wherein the log scanning rules are used to perform error scanning on the program log.

15. A code error analysis device, comprising: The scanning rule acquisition module is configured to acquire log scanning rules, which are generated by an error analysis model. The error analysis model is used to perform context learning based on the input first error code sample and the corresponding log scanning rule sample, learn the first correlation between the first error code sample and the corresponding log scanning rule sample, and use the first correlation to generate corresponding log scanning rules for the input program code to be analyzed. The program log acquisition module is configured to acquire program logs, which are logs generated during program code execution. The error scanning module is configured to perform error scanning on the program log using the log scanning rules to obtain error scanning results.

16. A code error analysis device, configured on a client device, comprising: The request sending module is configured to send a code error analysis request to the server, so that the server obtains the log scanning rules and the program log corresponding to the code error analysis request, and uses the log scanning rules to perform error scanning on the program log to obtain the error scanning result. The log scanning rules are generated by an error analysis model. The error analysis model is used to perform context learning based on the input first error code sample and the corresponding log scanning rule sample, learn the first correlation between the first error code sample and the corresponding log scanning rule sample, and use the first correlation to generate corresponding log scanning rules for the input program code to be analyzed. The result receiving module is configured to receive the error scan results returned by the server.

17. A computing device, comprising: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions, which, when executed by the processor, implement the steps of the method according to any one of claims 1 to 13.

18. A computer-readable storage medium storing a computer program / instructions that, when executed by a processor, implement the steps of the method according to any one of claims 1 to 13.

19. A computer program product comprising a computer program / instructions that, when executed by a processor, implement the steps of the method according to any one of claims 1 to 13.

Citation Information

Patent Citations

  • Method, apparatus, computer device and storage medium for scanning static code

    CN109144852A

  • Log recording and error analysis tool based on target model

    CN111258792A

  • Information processing method and device, electronic equipment, medium and program product

    CN114675827A

  • Error log processing method and device, electronic equipment and readable storage medium

    CN117874236A

  • Log file generation method and device and log file processing method and device

    CN118069139A

Cited By

  • Program analysis agent illusion suppression method and system based on structured cue word

    CN122331952A