An automated alerting method, medium, and apparatus

By constructing an error pattern recognition model using automated alarm methods and machine learning algorithms, the accuracy and intelligent alarm issues of JavaScript code exceptions were solved. This achieved high-precision error pattern recognition and dynamic threshold adjustment, improving the sensitivity and accuracy of alarms.

CN123178198APending Publication Date: 2026-11-27SICHUAN LAN-BRIDGE INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611328728.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-31
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

In existing technologies, JavaScript code errors are not detected and handled in a timely manner, resulting in low alarm accuracy, rigid alarm strategies, inability to automatically identify error patterns, and third-party error monitoring services being unable to distinguish error patterns and decide whether to notify developers.

Method used

An automated alerting method is adopted, which combines JS error boundaries, global exception listeners and Promise exception capture to capture errors, uses Sentry service to report errors, and builds an error pattern recognition model through machine learning algorithms to generate stable error signatures. The ML model is used to judge the similarity between new errors and historical patterns, and the alert threshold is dynamically adjusted to perform intelligent alerting.

Benefits of technology

It achieves high-precision error pattern recognition, reduces duplicate alarms, improves alarm sensitivity and accuracy, and dynamic threshold adjustment avoids false alarms and missed alarms, thus improving alarm adaptability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123178198A_ABST
    Figure CN123178198A_ABST
Patent Text Reader

Abstract

The application discloses an automatic alarm method, medium and device, and belongs to the technical field of computer software monitoring and alarm, and the method comprises the following steps: collecting front-end errors by using error boundaries, global exception monitoring and Promise exception capture, and reporting the errors to a Sentry service after standardization; constructing an error mode recognition model by using a machine learning algorithm, generating an error signature by extracting stable structure information in a stack trace to remove noise; calculating the similarity of a new error with historical modes, comparing the similarity with a dynamic alarm threshold, determining that the new error is a new error mode and triggering an alarm if the similarity is lower than the threshold, otherwise, deciding according to a known mode strategy; and sending a notification and continuously optimizing the model when the alarm is triggered. Through the stable error signature and the dynamic threshold, the application effectively reduces repeated alarms and false positive rates, and improves alarm accuracy and timeliness.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer software monitoring and alarm technology, specifically, it relates to an automated alarm method, medium and device. Background Technology

[0002] In modern front-end application development, JavaScript code errors that are not detected and handled in a timely manner can severely impact user experience and even lead to business interruptions. Traditional error monitoring solutions typically rely on developers manually reviewing logs or using alarm systems based on fixed rules. These solutions have the following shortcomings: First, alarm accuracy is low; a large number of repetitive and noisy errors (such as those caused by browser extensions or third-party scripts) can create an alarm storm, overwhelming the development team. Second, alarm strategies are rigid and cannot be adaptively adjusted based on the actual severity, scope of impact, and novelty of the error, easily missing new critical errors. Third, error identification mainly relies on manual analysis and cannot automatically discover error patterns or determine the similarity between new errors and known errors. In recent years, third-party error monitoring services such as Sentry have emerged, but these services mainly provide error collection and aggregation functions, and their alarm rules are relatively simple, unable to distinguish error patterns and decide whether to notify developers based on the situation. Summary of the Invention

[0003] The purpose of this invention is to provide an automated alarm method to solve the technical problems existing in the prior art.

[0004] To achieve the above objectives, the technical solution adopted by the present invention is as follows: An automated alarm method includes the following steps: Step S1: Error capture and logging: Use a combination of JS error boundaries, global exception listeners, and Promise exception handling to capture and log front-end errors; Step S2: Report the error to the Sentry service: Automatically report the front-end error to the Sentry service by calling the SentrySDK's captureException interface; Step S3: Construct an error pattern recognition model: Analyze error data using machine learning algorithms, extract key features, and train an ML model that can recognize error patterns; Step S4: Based on the ML model, capture new errors, calculate the similarity between the new errors and each historical error pattern, and compare the similarity with the dynamic alarm threshold. The system compares the similarity to the dynamic alarm threshold. If the similarity is lower than the threshold, it is determined to be a new error pattern and an alarm is triggered. If the similarity exceeds the threshold, it is determined to be a match for a known pattern, and an alarm is triggered based on the alarm policy of the known pattern. Step S5: When an alarm is triggered, send an alarm notification and perform model optimization.

[0005] Furthermore, in step S2, the error data undergoes standardization and serialization before being reported. The standardization includes converting the error object into a structured data format that includes the error type, error message, stack trace, occurrence time, user browser information, and current URL. The serialization includes converting the structured data into JSON format for transmission.

[0006] Furthermore, the construction of the error pattern recognition model in step S3 also includes: extracting features from error events and storing them to build an error feature library, and generating a unique signature for each error feature; the signature generation method is as follows: preprocessing the stack trace information of the error event, filtering out dynamic noise information such as row numbers, column numbers, memory addresses, and temporary variable values, and retaining only stable structural information such as exception type, class name / method name / file name in the call chain, concatenating the preprocessed stable structural information into a string, and applying the SHA-256 or MD5 hash algorithm to the string to generate a fixed-length hash value as the unique signature of the error.

[0007] Furthermore, the extracted features include error type, browser information, user behavior trajectory, and timestamp.

[0008] Furthermore, the construction of the error pattern recognition model in step S3 specifically includes: Step S3.1: Preprocess the error data, including removing duplicate error records, filtering noise errors caused by third-party libraries and browser extensions, and filling missing fields with default values; Step S3.2: Extract features from the error data to form a feature vector, including: performing one-hot encoding on the error type, converting the stack trace information into hash value features through the signature generation algorithm, converting browser information into category features, converting timestamps into periodic time features, and concatenating all features to form a feature vector; Step S3.3: Model Training: Train the classification model or clustering model. For the classification model, supervised training is performed using the Random Forest or XGBoost algorithm, with the F1 score as the model evaluation metric. For the clustering model, unsupervised clustering is performed using the DBSCAN algorithm, with the silhouette coefficient as the clustering performance evaluation metric. Step S3.4: Implement pattern recognition: Input the new error event into the trained model and use the trained model to identify whether the new error event conforms to the known error pattern.

[0009] Furthermore, step S3.2 also includes: analyzing the text information in the error log using natural language processing algorithms, using the importance of TF-IDF statistical features, and the vectorized representation of the stack trace.

[0010] Furthermore, in step S4, the dynamic alarm threshold... The calculation method is as follows: ; In the formula, Basic threshold; This is the severity weighting coefficient, which is a preset normalized value based on the error type; The impact range coefficient is determined and normalized based on the ratio of the number of unique users affected by the error event to the total number of active users; The novelty coefficient is determined and normalized based on the time elapsed since the first appearance of the error pattern in the historical error feature database.

[0011] Furthermore, in step S5, model optimization includes at least one of the following: Continuous learning: Employing online learning or incremental learning methods to achieve continuous learning of the model; Model fine-tuning: After accumulating a certain amount of new labeled data, a fine-tuning dataset is constructed with the new labeled data as the main component and historical data as the supplement. Several rounds of training are performed on the basis of the original model parameters with a learning rate lower than the original learning rate. Anomaly detection optimization: By combining supervised and unsupervised learning, the performance of anomaly detection algorithms is improved and the false positive rate is reduced; Rule engine optimization: Optimize and maintain the rule base using genetic algorithms or simulated annealing optimization algorithms.

[0012] To achieve the above objectives, the present invention also provides a computer-readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the automated alarm method as described in any of the preceding claims.

[0013] To achieve the above objectives, the present invention also provides an automated alarm device, comprising: a processor and a memory; the memory for storing a computer program; the processor being connected to the memory for executing the computer program stored in the memory, such that the automated alarm device performs the method described in any of the preceding claims.

[0014] Compared with the prior art, the beneficial effects of the present invention are: (1) This invention generates error signatures by extracting stable structure information from stack traces, effectively removing dynamic noise such as row and column numbers, so that errors with the same root cause can be accurately aggregated and classified into the same pattern, greatly reducing duplicate alarms.

[0015] (2) This invention uses machine learning models to intelligently identify error patterns and combines them with measurement methods such as cosine similarity to automatically determine whether a new error belongs to a known pattern or a completely new pattern, thereby maintaining high sensitivity to unknown errors.

[0016] (3) In this invention, the dynamic alarm threshold takes into account the severity of the error, the scope of users affected, and the novelty, and uses normalized multiplicative coefficients for fusion, which avoids false alarms and false alarms caused by fixed thresholds, and makes the alarm accuracy adaptively adjusted with the system state. Attached Figure Description

[0017] Figure 1 This is the overall flowchart of the present invention; Figure 2 This is a schematic diagram of the error signature generation process in Embodiment 1 of the present invention; Figure 3 This is a flowchart of constructing the error pattern recognition model in Embodiment 1 of the present invention. Detailed Implementation

[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention. Example

[0019] like Figure 1 As shown, this embodiment provides an automated alarm method, which is applied to a front-end error monitoring scenario. The front-end application runs in a browser, and its specific steps are as follows: 1. Step S1: Error capture and logging This step is performed in the browser frontend. To comprehensively capture various frontend exceptions, this step uses three capture methods: (1) JS error boundary: In component-based frameworks such as React, by defining error boundary components, rendering errors thrown in the child component tree can be captured to prevent the entire application from crashing; (2) Global exception listener: Register the onerror event handler function on the global window object to capture JavaScript runtime errors that are not caught elsewhere; (3) Promise exception capture: Listen to the global unhandledrejection event to capture Promise rejection errors that are not handled by .catch().

[0020] When an error is captured by either method, an event object containing the original error information is generated and passed to step S2.

[0021] 2. Step S2: Error Reporting and Standardization This step is responsible for reporting the captured error events to the Sentry service. First, the error objects are standardized and converted into the following structured data format (JSON string): { "type": "TypeError", "message": "Cannot read property 'foo' of undefined", "stacktrace": "TypeError: ...\n at Object. <anonymous>(app.js:10:15)", "timestamp": 1623924000000, "browser": "Chrome / 91.0.4472.124", "url": "https: / / example.com / page" } Then, serialization is performed by calling the JSON.stringify method to convert the structured data into a JSON string. Finally, the JSON string is sent as a parameter to the Sentry backend service through the captureException interface provided by the Sentry SDK. The Sentry service will persist the error and provide a real-time error stream for subsequent steps.

[0022] 3. Step S3: Construct an error pattern recognition model This step includes two stages: error signature generation and model training, as detailed below: I. Error Signature Generation like Figure 2 As shown, in order to group errors with the same root cause into the same pattern, a unique and stable signature needs to be generated for each error event. The specific process is as follows: (1) Obtain the stack trace field from the error structured data reported in step S2; (2) Preprocess the stack trace information by filtering out dynamically changing parts such as row numbers, column numbers, memory addresses, and temporary variable values ​​using regular expressions; for example, filter out the at Object. <anonymous>(app.js:10:15) is simplified to atObject. <anonymous>(app.js); (3) Extract stable structure information, including exception type (such as TypeError), class name, method name and file name appearing in the call chain, and concatenate this information into a long string in the order of call, for example: TypeError|Object. <anonymous>|app.js|....

[0023] (4) Apply the SHA-256 hash algorithm to the string to generate a 64-bit hexadecimal hash value as the unique signature of the error, for example: a3c8e....

[0024] After all error events have undergone the above processing, their signatures and characteristics are stored together in the error characteristic database.

[0025] II. Model Training Collect a certain amount of historical error data as a training set. For supervised learning, developers need to label the historical error events and provide error pattern labels (such as common Null Pointer errors, failure to load specific resources, etc.). For unsupervised learning, no labels are required.

[0026] like Figure 3 As shown, the specific training steps are as follows: S3.1 Data Preprocessing: Read the historical error events stored in Sentry, perform deduplication (only one event with the same signature is kept), filter out noise errors caused by known browser extensions and third-party scripts (such as Google Analytics), and fill missing fields (such as individual events without user behavior traces) with default values ​​(such as empty arrays or 0).

[0027] S3.2 Feature Extraction and Vectorization: Error types, such as TypeError and ReferenceError, are converted into binary vectors using one-hot encoding. Assuming there are 5 error types, the encoding dimension for each error type is 5.

[0028] Stack signature: The generated hash signature is directly used as a high cardinality category feature, and is used as one of the feature values.

[0029] Browser information: Use the browser name and major version number (such as Chrome 91) as category features, and employ tag encoding or one-hot encoding.

[0030] Timestamp: Extract the hour and day of the week when the event occurred. For example, if the event occurred on a Tuesday at 14:30, the feature [14, 2] will be generated to reflect the possible time periodicity of the error (e.g., certain errors are more frequent during specific periods).

[0031] User behavior trajectory: If a user operation sequence exists, features can be formed by sequence encoding or counting the number of operations.

[0032] For error message text, the TF-IDF algorithm is used to calculate word importance vectors; word embedding or TF-IDF vectorization can also be performed on stack trace text.

[0033] Finally, all feature vectors are concatenated horizontally to form a high-dimensional feature vector for each error event.

[0034] S3.3 Model Training: (a) For the classification model, the random forest algorithm is used, with the number of trees set to 100 and the maximum depth to 10. Five-fold cross-validation is used for tuning, and the combination of hyperparameters that maximizes the macro average F1 score is selected. (b) For the clustering model, the DBSCAN algorithm is used, and the neighborhood radius is set according to the data density. and minimum sample size The parameters are adjusted with the goal of maximizing the silhouette coefficient. Each cluster after clustering represents an error pattern, and the cluster label is the pattern identifier.

[0035] For the trained classification model, extract the class center vector of each known error pattern category (take the mean of the feature vectors of all training samples belonging to that class); for the clustering model, use the centroid or core sample mean of each cluster as the representative vector of that pattern, and store the unique signature, label and corresponding center vector of each pattern in the error feature library for use in step S4 similarity calculation.

[0036] S3.4 Pattern Recognition Implementation: After training is completed, when a new error event occurs, the same preprocessing and feature extraction process as the training data is used to obtain the feature vector, which is then input into the trained classification model to obtain the predicted pattern label, or input into the clustering model to obtain the cluster to which it belongs, thereby determining whether the new error belongs to a known pattern.

[0037] 4. Step S4: Intelligent matching and dynamic alarm decision-making This step connects to the real-time error stream of the Sentry service. When a new error event occurs: the new error event is input into the ML model trained in step S3 to obtain its feature vector; then, the similarity between this feature vector and the center vector (or representative vector) of each historical error pattern in the error feature database is calculated. The similarity calculation can use the cosine similarity algorithm. .

[0038] Obtain the current dynamic alarm threshold T. The calculation method for T is as follows:

[0039] In the formula, Based on the threshold, in this embodiment, The default value is 0.5 (this can be adjusted based on experience). is the severity weight coefficient, which is a normalized value preset according to the error type (e.g., TypeError=0.9, SyntaxError=0.3, PromiseRejection=0.7, etc., normalized to the interval [0, 1]); is the impact range coefficient, which is determined and normalized according to the ratio of the number of independent users affected by the error event to the total number of active users; is the novelty coefficient, which is determined and normalized according to the time elapsed since the first occurrence of this error pattern in the historical error feature database. For example: query the millisecond timestamp of the first occurrence of this error signature in the error feature database, and calculate the elapsed time , set the maximum novelty duration (e.g., 7 days = 604800000 ms), then the longer the first occurrence, the lower the novelty, and the novelty coefficient approaches 0.

[0040] Judgment is performed based on the similarity and the dynamic alarm threshold T: (1) If the similarity < T, it indicates that the error is quite different from the historical patterns, so it is determined as a new error pattern and an alarm is triggered immediately; (2) If the similarity ≥ T, it matches a known pattern, and whether to alarm is determined according to the alarm policy of this known pattern. For example: even if a known pattern is matched, if the severity level of this pattern is high and the occurrence frequency exceeds 10 times in the latest 1 hour, an alarm is still triggered and the priority is set to high; if this pattern has been marked as ignorable or the occurrence frequency is very low, no alarm is triggered.

[0041] If it is determined to trigger an alarm, the alarm event is pushed to step S5.

[0042] 5. Step S5: Alarm notification and model optimization After the alarm is triggered in step S4, the system sends an alarm notification to relevant developers via email, instant messaging, SMS, or other methods. The notification content may include detailed information such as the error type, message, pattern signature, similarity, and number of affected users, and may embed feedback buttons for false positives and false negatives.

[0043] Meanwhile, the system continuously performs model optimization in the background, including one or more of the following methods: Continuous learning: When the accumulation of new labeled samples reaches a set batch, incremental update is implemented by retaining the original model parameters and only using the new samples to perform supplementary training on the random forest (e.g., by increasing the number of trees or replacing some weak trees); alternatively, when the model is a clustering model (DBSCAN), the new samples are mapped to existing clusters or local re-clustering is triggered.

[0044] Model fine-tuning: Once more than 1,000 new labeled data entries have been accumulated, a fine-tuning dataset is constructed using these new data entries as the main component (80%) and historical data entries as the secondary component (20%). The original model parameters are loaded, the learning rate is set to 1 / 10 of the initial value, and the model is trained for 5-10 epochs to adapt the model to recent changes in the error distribution.

[0045] Anomaly detection optimization: Simultaneously run an unsupervised anomaly detector based on isolated forest as an auxiliary. When the supervised model determines that it is a new pattern and the anomaly detector also gives a high anomaly score, further confirm the alarm; the combination of the two can reduce the false positive rate.

[0046] Rule engine optimization: The basic threshold and weight allocation of each coefficient in the dynamic threshold are regarded as rule parameters and optimized using a genetic algorithm: a set of parameters are encoded as chromosomes, and the fitness function is used to maximize the F1 score and minimize the false alarm rate. After selection, crossover and mutation iteration, the optimal parameter combination is found; the optimized parameters are automatically updated to the rule engine. Example

[0047] This embodiment provides a computer-readable storage medium on which a computer program is stored. The computer program is executed by a processor to implement the automated alarm method provided in Embodiment 1. Those skilled in the art will understand that all or part of the steps of the method provided in Embodiment 1 can be implemented by hardware related to the computer program. The aforementioned computer program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the method provided in Embodiment 1. The aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks. Example

[0048] This embodiment provides an automated alarm device, including: a processor and a memory; the memory is used to store a computer program; the processor is connected to the memory and is used to execute the computer program stored in the memory, so that the automated alarm device performs the automated alarm method provided in Embodiment 1.

[0049] Specifically, memory includes various media that can store program code, such as ROM, RAM, magnetic disks, USB flash drives, memory cards, or optical discs.

[0050] Preferably, the processor can be a general-purpose processor, including a central processing unit, a network processor, etc.; it can also be a digital signal processor, an application-specific integrated circuit, a field-programmable gate array or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component.

[0051] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, these embodiments should be considered exemplary rather than restrictive. The scope of the invention is defined by the appended claims rather than the foregoing description, and thus all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the invention. No reference numerals in the claims should be construed as limiting the scope of the claims.< / anonymous> < / anonymous> < / anonymous> < / anonymous>

Claims

1. An automated alarm method, characterized in that, Includes the following steps: Step S1: Error capture and logging: Use a combination of JS error boundaries, global exception listeners, and Promise exception handling to capture and log front-end errors; Step S2: Report the error to the Sentry service: Automatically report the front-end error to the Sentry service by calling the SentrySDK's captureException interface; Step S3: Construct an error pattern recognition model: Analyze error data using machine learning algorithms, extract key features, and train an ML model that can recognize error patterns; Step S4: Based on the ML model, capture new errors, calculate the similarity between the new errors and each historical error pattern, compare the similarity with the dynamic alarm threshold T, when the similarity is lower than the dynamic alarm threshold, determine it as a new error pattern and trigger an alarm; when the similarity exceeds the dynamic alarm threshold, determine it as a match of a known pattern, and decide whether to trigger an alarm according to the alarm strategy of the known pattern. Step S5: When an alarm is triggered, send an alarm notification and perform model optimization.

2. The automated alarm method according to claim 1, characterized in that, In step S2, the error data undergoes standardization and serialization before being reported. The standardization includes converting the error object into a structured data format that includes the error type, error message, stack trace, occurrence time, user browser information, and current URL. The serialization includes converting the structured data into JSON format for transmission.

3. The automated alarm method according to claim 1, characterized in that, The step S3 of constructing the error pattern recognition model further includes: extracting features from error events and storing them to construct an error feature library, and generating a unique signature for each error feature; the signature generation method is as follows: preprocessing the stack trace information of the error event, retaining the exception type and stable structure information in the call chain, concatenating the stable structure information into a string, and applying a hash algorithm to the string to generate a fixed-length hash value as the unique signature of the error.

4. The automated alarm method according to claim 3, characterized in that, The extracted features include error type, browser information, user behavior trajectory, and timestamp.

5. The automated alarm method according to claim 4, characterized in that, The construction of the error pattern recognition model in step S3 specifically includes: Step S3.1: Preprocess the error data, including removing duplicate error records, filtering noise errors caused by third-party libraries and browser extensions, and filling missing fields with default values; Step S3.2: Extract features from the error data to form a feature vector, including: performing one-hot encoding on the error type, converting the stack trace information into hash value features through the signature generation algorithm, converting browser information into category features, converting timestamps into periodic time features, and concatenating all features to form a feature vector; Step S3.3: Model Training: Train the classification model or clustering model. For the classification model, supervised training is performed using the Random Forest or XGBoost algorithm, with the F1 score as the model evaluation metric. For the clustering model, unsupervised clustering is performed using the DBSCAN algorithm, with the silhouette coefficient as the clustering performance evaluation metric. Step S3.4: Implement pattern recognition: Input the new error event into the trained model and use the trained model to identify whether the new error event conforms to the known error pattern.

6. The automated alarm method according to claim 5, characterized in that, Step S3.2 further includes: analyzing the text information in the error log using natural language processing algorithms, using the importance of TF-IDF statistical features, and the vectorized representation of the stack trace.

7. The automated alarm method according to claim 1, characterized in that, In step S4, the dynamic alarm threshold T is calculated as follows: ; In the formula, Basic threshold; This is the severity weighting coefficient, which is a preset normalized value based on the error type; The impact range coefficient is determined and normalized based on the ratio of the number of unique users affected by the error event to the total number of active users; The novelty coefficient is determined and normalized based on the time elapsed since the first appearance of the error pattern in the historical error feature database.

8. The automated alarm method according to claim 1, characterized in that, In step S5, model optimization includes at least one of the following: Continuous learning: Employing online learning or incremental learning methods to achieve continuous learning of the model; Model fine-tuning: After accumulating a certain amount of new labeled data, a fine-tuning dataset is constructed with the new labeled data as the main component and historical data as the supplement. Several rounds of training are performed on the basis of the original model parameters with a learning rate lower than the original learning rate. Anomaly detection optimization: By combining supervised and unsupervised learning, the performance of anomaly detection algorithms is improved and the false positive rate is reduced; Rule engine optimization: Optimize and maintain the rule base using genetic algorithms or simulated annealing optimization algorithms.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, The computer program is executed by a processor to implement the automated alarm method as described in any one of claims 1 to 8.

10. An automated alarm device, characterized in that, include: Processor and memory; The memory is used to store computer programs; The processor is connected to the memory and is used to execute the computer program stored in the memory, so that the automated alarm device performs the automated alarm method as described in any one of claims 1 to 8.