CN-121996466-A - Software exception handling method, exception handling system and storage medium
Abstract
The embodiment of the application relates to the technical field of software engineering, in particular to a software exception handling method, an exception handling system and a storage medium. According to the embodiment of the application, the reference abnormality is captured according to the detection rules in the project rule base of the target project, the abnormal snapshot information is extracted according to the abnormal log of the reference abnormality, and the target information related to the abnormal snapshot information is acquired, so that the large language model is called to perform the abnormality diagnosis operation according to the abnormal snapshot information and the target information to obtain the abnormality diagnosis result of the reference abnormality, thus, a defect work order and a regression test case are generated according to the abnormality diagnosis result, so that a developer develops corresponding codes according to the defect work order to repair the reference abnormality, and automatically executes the regression test case to determine the condition of repairing the reference abnormality.
Inventors
- MA HUI
- YANG JIAJUN
- ZHANG YONGWEI
- WANG JIE
- ZHANG HUAMING
Assignees
- 深圳市德兰明海新能源股份有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20260410
Claims (11)
- 1. A method for processing software exceptions, comprising: Responding to the creation of a target item, configuring an item rule base for the target item, wherein the item rule base comprises at least one first detection rule inherited from a public rule base and at least one second detection rule preset based on the target item; acquiring an anomaly log corresponding to a reference anomaly of an application program in response to the first detection rule and the second detection rule capturing the reference anomaly of the application program; Based on the exception log, obtaining exception snapshot information corresponding to the reference exception, wherein the exception snapshot information comprises an exception stack, a uniform resource locator of an error interface and a unique identifier of a user request; Invoking a preset large language model to perform abnormality diagnosis operation based on the abnormality snapshot information and target information related to the abnormality snapshot information to obtain an abnormality diagnosis result of the reference abnormality, wherein the target information represents information related to the reference abnormality in the target item; Generating a defect work order and a regression test case based on the abnormal diagnosis result; Executing the regression test case in response to the application program receiving an object code, wherein the object code is a code developed for repairing the reference abnormality based on the defective work order; Updating the weight of a target rule based on feedback information input by a user and related to the reference abnormality, wherein the feedback information is used for representing the capturing accuracy degree of the reference abnormality, and the target rule is a detection rule matched with the reference abnormality in at least one first detection rule and at least one second detection rule; and responding to the regression test case execution pass and the weight updating of the target rule is completed, and determining that the reference abnormal repair is completed.
- 2. The software exception handling method according to claim 1, wherein the calling a preset large language model to perform an exception diagnosis operation based on the exception snapshot information and target information associated with the exception snapshot information, to obtain an exception diagnosis result of the reference exception, comprises: Acquiring the target information according to the abnormal snapshot information, wherein the target information comprises a service call log requested by the user, call information of the error interface, context code data corresponding to the reference abnormality, required content, table structure information and code submission data; and calling the large language model to execute an abnormality diagnosis operation according to the abnormal snapshot information and the target information to obtain the abnormality diagnosis result.
- 3. The method for processing a software exception according to claim 2, wherein said obtaining the target information from the exception snapshot information includes: acquiring a service call log of the user request according to the unique identifier; Acquiring call information of the error interface according to the uniform resource locator of the error interface; acquiring a context code associated with the error reporting code, metadata of the error reporting code and submitted record information as the context code data according to the error reporting code in the exception stack; The demand numbers in the submitted record information are extracted, and demand content associated with the demand numbers is acquired; acquiring the table structure information according to the metadata of the error reporting code; And acquiring code submission data corresponding to the demand number according to the demand number.
- 4. The software exception handling method according to claim 2, wherein said calling the large language model to perform an exception diagnosis operation according to the exception snapshot information and the target information to obtain the exception diagnosis result comprises: constructing an abnormal diagnosis prompt word, wherein the abnormal diagnosis prompt word comprises a first prompt word for defining a model role as an abnormal diagnosis expert and a second prompt word for diagnosis analysis requirements; and inputting the abnormal diagnosis prompt word, the abnormal snapshot information and the target information into the large language model, so that the large language model analyzes and diagnoses the abnormal snapshot information and the target information according to the abnormal diagnosis prompt word to obtain the abnormal diagnosis result.
- 5. The method according to any one of claims 1 to 4, wherein the abnormality diagnosis result includes root cause analysis, an influence range, repair advice, and recommended responsible persons, the defect work orders include the root cause analysis, the influence range, the repair advice, repair persons, belonging projects, and influence versions, and the generating of the defect work orders based on the abnormality diagnosis result includes: creating an initial worksheet, wherein the initial worksheet comprises a first field about the repair person, a second field about the affiliated item, a third field about the affected version, a fourth field about the root cause analysis, a fifth field about the affected scope, and a sixth field about the repair suggestion; Filling the recommended responsible person as the repairman into the first field; Filling the item name corresponding to the target rule as the belonging item into the second field; Filling a preset default value as the influence version into the third field; and filling the root cause analysis, the influence range and the repair suggestion into the fourth field, the fifth field and the sixth field respectively to obtain the defect work order.
- 6. The software exception handling method according to claim 1, wherein the generating a regression test case based on the exception diagnosis result includes: Acquiring reference information, wherein the reference information comprises calling information of the error interface, context code data corresponding to the reference abnormality, required content, table structure information and code submission data; and calling the large language model to execute a case generation operation according to the reference information, the abnormal diagnosis result and the abnormal snapshot information to obtain the regression test case.
- 7. The software exception handling method according to claim 6, wherein said calling the large language model to perform a case generation operation according to the reference information, the exception diagnosis result, and the exception snapshot information, to obtain the regression test case comprises: Constructing a case generation prompt word, wherein the case generation prompt word comprises a third prompt word for defining a model role as a test case generation expert and a fourth prompt word for generating requirements of the test case; And inputting the use case generation prompt word, the reference information, the abnormal diagnosis result and the abnormal snapshot information into the large language model, so that the large language model performs use case analysis generation on the reference information, the abnormal diagnosis result and the abnormal snapshot information according to the use case generation prompt word to obtain the regression test case.
- 8. The method according to any one of claims 1 to 4, wherein after the obtaining of the abnormality log corresponding to the reference abnormality, the method further comprises: obtaining an error log with generation time within a preset period, wherein the error log is a log with the level of error grade in the abnormal log; analyzing the error log and extracting a log template corresponding to the error log; Clustering all the log templates to obtain a log clustering result; Generating a new detection rule based on the log clustering result in response to the log clustering result being not covered by the candidate rule and being a dense and regular log cluster, wherein the candidate rule is any one of at least one first detection rule and at least one second detection rule, the state of the new detection rule is forbidden, and the weight is a standard weight value; and adding the new detection rule to the item rule base as a second detection rule.
- 9. The method according to any one of claims 1 to 4, wherein updating the weight of the target rule based on the feedback information includes: Responding the feedback information as positive feedback information, adding the current weight of the target rule with a first weight change value to obtain an initial updated weight of the target rule, wherein the positive feedback information is used for representing the existence of the reference abnormality, the first weight change value is the product of a preset learning rate and a weight difference value, and the weight difference value is the difference value between a preset weight upper limit threshold value and the current weight, or Responding the feedback information as weak negative feedback information, adding a second weight change value to the current weight of the target rule to obtain an initial updated weight of the target rule, wherein the weak negative feedback information is used for representing that the reference abnormality is negligible, the second weight change value is the product of a reference ratio and the current weight, and the reference ratio is the ratio of the opposite number of the preset learning rate to a first preset value, or Responding the feedback information to be strong negative feedback information, and adding a third weight change value to the current weight of the target rule to obtain an initial update weight of the target rule, wherein the weak negative feedback information is used for representing that the reference abnormality does not exist, and the third weight change value is the product of the inverse number of the preset learning rate and the current weight; and determining the maximum value of a preset weight lower limit threshold value and a reference weight value as the weight of the updated target rule, wherein the reference weight value is the minimum value of the weight upper limit threshold value and the initial updating weight.
- 10. An exception handling system, comprising a processor and a memory, the processor being communicatively coupled to the memory, the memory storing computer program instructions executable by the processor, which when executed by the processor, cause the exception handling system to perform the software exception handling method of any one of claims 1 to 9.
- 11. A computer readable storage medium storing computer program instructions executable by a processor, which when executed by the processor, cause the processor to perform the software exception handling method according to any one of claims 1 to 9.
Description
Software exception handling method, exception handling system and storage medium Technical Field The embodiment of the application relates to the technical field of software engineering, in particular to a software exception handling method, an exception handling system and a storage medium. Background In the current software development and operation and maintenance process, with the increasing complexity of system architecture and the popularization of distributed microservices, the stability and fault quick recovery capability of a software system become critical. Traditional exception handling processes employ a combined tool chain that uses a monitoring system (e.g., prometheus, zabbix) for index collection and threshold alerting, log aggregation via a log analysis platform (e.g., ELK stack), manual review of logs by developers, analysis of codes to locate causes, manual creation and assignment of work orders in defect management systems (e.g., buddhist, jira). After the repair is finished, the tester also needs to write the regression test case manually according to experience to verify. In the related technology, the whole exception handling process involves a plurality of independent systems, personnel are required to frequently switch between monitoring, code libraries, project management and communication tools for use, and the exception handling efficiency is low and error and leakage are easy to occur due to failure in automatic and intelligent handling of the exception. Disclosure of Invention An object of the embodiments of the present application is to provide a software exception handling method, an exception handling system, and a storage medium, so as to improve the situation that the exception handling efficiency is low and error is easy to occur due to frequent switching and use of multiple independent systems in the related art. The embodiment of the application provides a software exception handling method, which comprises the steps of responding to creation of a target item, configuring a item rule base for the target item, wherein the item rule base comprises at least one first detection rule inherited from a public rule base and at least one second detection rule preset based on the target item, responding to the first detection rule and the second detection rule to capture that an application program generates a reference exception, acquiring an exception log corresponding to the reference exception, acquiring exception snapshot information corresponding to the reference exception based on the exception log, acquiring a unified resource locator of an exception stack and an error interface and a unique identifier of a user request, calling a preset large language model to perform exception diagnosis operation based on the exception snapshot information and target information related to the exception snapshot information, obtaining an exception diagnosis result of the reference exception, wherein the target information represents information related to the reference exception in the target item, generating a defect work order and a regression test case based on the exception diagnosis result, responding to an application program, executing the regression test case, wherein the target code is developed based on the defect work order, responding to the user input feedback information about the reference exception, updating weight information based on the reference work order, updating the update weight information, and updating the target weight information based on the feedback weight information, and the update weight information, at least one feedback rule is used for updating the reference rule, and updating the reference rule is completed by at least one step, and the first rule is used for updating the reference rule, and the regression rule is completed. In a second aspect, an embodiment of the present application provides an exception handling system, including a processor and a memory, where the processor is communicatively connected to the memory, and the memory stores computer program instructions executable by the processor, where the computer program instructions, when executed by the processor, cause the exception handling system to perform the software exception handling method provided in the first aspect. In a third aspect, embodiments of the present application provide a computer readable storage medium having stored thereon computer program instructions executable by a processor, which when executed by the processor, cause the processor to perform the software exception handling method provided in the first aspect. The embodiment of the application has the advantages that the embodiment of the application captures the reference abnormality according to the detection rule in the item rule base of the target item, extracts the abnormal snapshot information according to the abnormal log of the reference abnormality, and acquires the target information related to the abn