Index system early warning method and device, equipment, storage medium and program product
By parsing and recursively processing the logical expressions input by users, an abstract syntax tree is generated and scheduled according to priority. This solves the problem of low response efficiency of traditional hard-coded rules in complex business scenarios and realizes flexible and efficient indicator early warning.
Patent Information
- Application Number
- CN202511257903.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-04
- Publication Date
- 2025-12-05
AI Technical Summary
Traditional hard-coded rules lack the ability to dynamically adjust when faced with complex business scenarios and ever-increasing business metrics, resulting in low efficiency in metric maintenance and response.
By parsing the logical expressions input by users in a form similar to natural language, an abstract syntax tree is generated. A recursive descent interpreter is then used for recursive processing, and the rules are scheduled according to preset priority weights to generate executable rule objects. Finally, an alert is triggered in the overall scheduling result.
It improves the flexibility and maintainability of indicator early warning and enhances the efficiency of indicator operation and maintenance response.
Smart Images

Figure CN121070375A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of operation and maintenance technology, and in particular to an indicator system early warning method, device, equipment, storage medium and program product. Background Technology
[0002] In the field of monitoring metric maintenance, traditional hard-coded rules have long been the primary method for metric alerts. Hard-coded rules typically involve developers directly writing specific judgment conditions into the monitoring system's code based on predefined business logic and thresholds. For example, for monitoring server CPU utilization, a fixed threshold might be set, such as triggering an alert when CPU utilization exceeds 80%. This approach was a simple and effective solution in early monitoring systems, suitable for relatively stable and small-scale monitoring scenarios.
[0003] However, as businesses grow, the number of business metrics increases exponentially. For example, e-commerce companies, in addition to traditional server performance metrics (such as CPU, memory, and disk I / O), need to monitor numerous business-related metrics, such as daily order volume, user registrations, and inventory turnover. Similarly, in financial transaction systems, multiple metrics such as transaction amount, transaction frequency, and user credit rating need to be considered to determine the presence of abnormal transaction risks. Hard-coded rules require writing separate code to define warning rules for each newly added metric, and in complex business scenarios, multi-metric joint analysis is necessary, resulting in high development and maintenance costs.
[0004] Therefore, when faced with increasing business metrics and increasingly complex monitoring scenarios, traditional metric alerts that rely on hard-coded rules have poor scalability and lack the ability to dynamically adjust, resulting in low efficiency in metric operation and maintenance response. Summary of the Invention
[0005] The main purpose of this application is to provide an indicator system early warning method, device, equipment, storage medium and program product, which aims to solve the technical problem that traditional indicator early warning that relies on hard-coded rules lacks dynamic adjustment capabilities, resulting in low indicator operation and maintenance response efficiency.
[0006] To achieve the above objectives, this application proposes an indicator system early warning method, the method comprising:
[0007] The system parses logical expressions input by users in a form similar to natural language and generates an abstract syntax tree.
[0008] The abstract syntax tree is recursively processed by a recursive descent interpreter to obtain executable rule objects;
[0009] The executable rule objects are scheduled according to preset priority weights to obtain the overall scheduling result. The preset priority weights are the weights assigned to the priority of each warning rule.
[0010] If the overall scheduling result contains a situation that triggers the warning rule, an warning is issued for the abnormal indicators in the logical expression.
[0011] In one embodiment, the step of parsing the logical expression input by the user in a natural language-like form to generate an abstract syntax tree includes:
[0012] Receive logical expressions input by the user in a form similar to natural language;
[0013] The logical expression is split into elements to obtain the corresponding element stream data;
[0014] The element stream data is combined into multiple syntax tree nodes according to preset syntax rules, wherein the preset syntax rules include at least one of operator precedence and bracket hierarchy.
[0015] An abstract syntax tree is constructed based on the relationships between the multiple syntax tree nodes.
[0016] In one embodiment, after the step of constructing an abstract syntax tree based on the associations between the plurality of syntax tree nodes, the method further includes:
[0017] The abstract syntax tree is subjected to semantic verification to obtain the verification result. The semantic verification includes at least one of the following: the completeness of brackets, the existence of indicator fields, and whether the data type and operator match.
[0018] If the verification result is successful, the verification result is returned to the abstract syntax tree;
[0019] If the verification result is that the verification fails, the set of error codes generated during the verification process is extracted and the set of error codes is fed back to the user so that the user can correct the logical expression.
[0020] In one embodiment, before the step of scheduling the executable rule objects according to preset priority weights to obtain the overall scheduling result, the method further includes:
[0021] Obtain the management role information, warning processing identifier, and core indicator identifier corresponding to each warning rule;
[0022] According to the preset weight table, the management role information is assigned a weight, the early warning processing identifier is assigned an early warning processing weight, and the core indicator identifier is assigned a core indicator weight.
[0023] Based on the management role information weight, the early warning processing weight, and the core indicator weight, a preset priority weight is determined for each early warning rule.
[0024] In one embodiment, the step of scheduling the executable rule objects according to preset priority weights to obtain a total scheduling result includes:
[0025] When the preset priority weight is not lower than the first threshold, real-time triggering is performed on the executable rule object to obtain the first scheduling result;
[0026] When the preset priority weight is between the first threshold and the second threshold, the executable rule object is executed within the preset first time window to obtain the second scheduling result;
[0027] When the preset priority weight is less than the second threshold, the executable rule object is executed in a polling manner within a preset second time window to obtain a third scheduling result;
[0028] The first scheduling result, the second scheduling result, and the third scheduling result are taken as the total scheduling result.
[0029] In one embodiment, the step of recursively processing the abstract syntax tree using a recursive descent interpreter to obtain an executable rule object includes:
[0030] Initialize the recursive descent interpreter and the context information of the element stream data;
[0031] Starting from the root node of the abstract syntax tree, the recursive descent interpreter recursively processes each child node of the abstract syntax tree according to the depth-first principle.
[0032] During the process of accessing each child node, determine the node type corresponding to each child node;
[0033] Each child node is parsed according to its node type to obtain the parsing result;
[0034] During the recursive process, the context information is updated based on the parsing result until the leaf node of the abstract syntax tree is reached, and the executable rule object is determined.
[0035] Furthermore, to achieve the above objectives, this application also proposes an indicator system early warning device, the device comprising:
[0036] The syntax tree module is used to parse logical expressions input by users in a natural language-like form and generate abstract syntax trees;
[0037] The interpreter module is used to recursively process the abstract syntax tree through a recursive descent interpreter to obtain executable rule objects;
[0038] The object scheduling module is used to schedule the executable rule objects according to preset priority weights to obtain the overall scheduling result. The preset priority weights are the weights assigned to the priority of each warning rule.
[0039] The indicator early warning module is used to issue an early warning for abnormal indicators in the logical expression when there is a situation in the overall scheduling result that triggers the early warning rule.
[0040] In addition, to achieve the above objectives, this application also proposes an indicator system early warning device, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the indicator system early warning method as described above.
[0041] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the indicator system early warning method described above.
[0042] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the indicator system early warning method described above.
[0043] One or more technical solutions proposed in this application have at least the following technical effects: The indicator system early warning method of this application includes: parsing a logical expression input by a user in a natural language-like form to generate an abstract syntax tree; recursively processing the abstract syntax tree through a recursive descent interpreter to obtain executable rule objects; scheduling the executable rule objects according to a preset priority weight to obtain a total scheduling result, wherein the preset priority weight is the weight assigned to the priority of each early warning rule; and issuing an early warning for abnormal indicators in the logical expression when there is a situation that triggers the early warning rule in the total scheduling result.
[0044] This application introduces logical expressions to dynamically define metrics, then parses the logical expressions into abstract syntax trees, and uses a recursive descent interpreter to dynamically compile the abstract syntax trees. When facing an increasing number of business metrics and increasingly complex monitoring scenarios, the introduced logical expressions can improve the flexibility and maintainability of metric alerts, thereby improving the efficiency of metric operation and maintenance response. Attached Figure Description
[0045] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0046] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0047] Figure 1 This is a flowchart illustrating the first embodiment of the early warning method for the indicator system in this application.
[0048] Figure 2 This is a schematic diagram of the process for generating an abstract syntax tree as provided in Embodiment 1 of this application;
[0049] Figure 3 The scheduling flowchart provided in Embodiment 1 of this application;
[0050] Figure 4 This is a flowchart illustrating the second embodiment of the early warning method for the indicator system in this application.
[0051] Figure 5 This is a schematic diagram of the module structure of the indicator system early warning device according to an embodiment of this application;
[0052] Figure 6 This is a schematic diagram of the hardware operating environment involved in the indicator system early warning method in this application embodiment.
[0053] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0054] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.
[0055] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.
[0056] It should be noted that the executing entity in this embodiment can be a computing service device with syntax tree construction, recursive processing, and indicator early warning functions, such as a personal computer or server, or an electronic device capable of implementing the above functions, or an indicator system early warning device (hereinafter referred to as early warning device) executing the indicator system early warning method of this application. This embodiment does not limit this. The following uses an early warning device as an example to describe this embodiment and the following embodiments.
[0057] This application presents Embodiment 1. Embodiment 1 of this application provides an indicator system early warning method, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the early warning method for the indicator system in this application.
[0058] In this embodiment, the indicator system early warning method includes steps S10 to S40:
[0059] Step S10: Parse the logical expression input by the user in a natural language-like form and generate an abstract syntax tree.
[0060] It's important to note that a logical expression is an expression that combines various conditions using logical operators (such as AND, OR, NOT, etc.). For example, in operational metrics, "(A>10)AND(B>60%), A = number of defects, B = defect rate" is a simple logical expression. Here, A>10 and B>60% are sub-conditions, and AND is a logical operator that means the entire logical expression is true only when both sub-conditions—the number of defects is greater than 10 and the defect rate is greater than 60%—are met simultaneously.
[0061] In scenarios involving inputting logical expressions, users can express complex logical relationships in a more intuitive and easily understandable way, similar to natural language (a way of expression that is close to natural language but not entirely the same), without having to follow the precise syntax of programming languages like writing program code. For example, when expressing logical relationships, users can use statements like "If the number of defects is greater than 10 and the defect rate is greater than 60%, then issue an alarm" to construct logical expressions. This lowers the barrier to entry for users and improves the ease of use of the system.
[0062] Understandably, an abstract syntax tree (AST) is an abstract syntactic structure representation of a logical expression. A logical expression can be decomposed into a tree structure according to syntactic rules, where each node represents an element of the logical expression, such as an operator or operand. For example, in the logical expression "(A>10)AND(B>60%), A = number of defects, B = defect rate", the root node of the AST might be the AND operator, and its two child nodes would represent subtrees representing "A>10" and "B>60%". By constructing an AST, subsequent analysis of logical expressions becomes much easier.
[0063] In its implementation, after receiving a logical expression input by a user in a form similar to natural language, the early warning device performs lexical analysis on the logical expression, identifies the elements in the logical expression, and determines the hierarchical structure according to the rules of logical operation priority in order to construct an abstract syntax tree.
[0064] In one feasible implementation, step S10 of this embodiment may include the following steps: receiving a logical expression input by a user in a form similar to natural language; splitting the logical expression into elements to obtain corresponding element stream data; combining the element stream data into multiple syntax tree nodes according to preset syntax rules, wherein the preset syntax rules include at least one of operator precedence and bracket hierarchy; and constructing an abstract syntax tree based on the correlation between the multiple syntax tree nodes.
[0065] It should be noted that when a logical expression is split into its elements, the result is a data format in which the elements are arranged in a certain order (i.e., element stream data).
[0066] For example, element stream data may include at least one of the following: indicator fields, indicator values, operators, and parentheses. The indicator fields support character, number, date, and enumeration types; the indicator value is a threshold input by the user. Operators may include relational operators (e.g., >, >=, <, <=, =, !=, IS NULL, IS NOT NULL, etc.), set operators (e.g., IN, NOT IN), and logical operators (e.g., AND, OR). Parentheses can be used in expression structures and support nesting, such as: ((Indicator A>100 AND Indicator B<200) OR Indicator C!=150).
[0067] For example, for the logical expression "(A or B) AND C", the decomposed element stream data might be "(", "A", "OR", "B", ")", "AND", and "C". These elements are arranged sequentially according to their order in the original logical expression, and each element has a specific meaning. The element stream data is the foundation for building a syntax tree, which decomposes the original logical expression from a whole into processable basic units.
[0068] Understandably, operator precedence refers to the order in which different operators are performed in logical operations. For example, in logical operations, the "NOT" operator usually has higher precedence than the "AND" and "OR" operators. Parentheses hierarchy is a means of changing the order of operations; expressions within parentheses are evaluated first. For example, "(A AND B) OR C" will first evaluate "A AND B," and then perform the "OR" operation with C. These predefined syntax rules are important bases for determining the order of node combinations when constructing a syntax tree.
[0069] It should be understood that syntax tree nodes are the basic building blocks for constructing an abstract syntax tree. When combining element stream data according to predefined syntax rules, each element or combination of elements can become a syntax tree node. For example, variable A can be a node, and the logical operator "AND" can also be a node. For complex expressions, such as "(A or B) AND C", the subexpression "(A or B)" can also be a node. Syntax tree nodes are connected through specific relationships, such as parent-child relationships, and together they construct the abstract syntax tree, which represents the structure and logical relationships of logical expressions.
[0070] In this embodiment, by converting logical expressions in the form of natural language into abstract syntax trees, the structure and logical relationships of logical expressions become clearer and more intuitive. This not only facilitates the computer system's accurate understanding and processing of logical expressions, but also helps to standardize the processing of logical expressions in different application scenarios.
[0071] In one feasible implementation, after the step of constructing an abstract syntax tree based on the correlation between the multiple syntax tree nodes, this embodiment further includes: performing semantic verification on the abstract syntax tree to obtain a verification result, wherein the semantic verification includes at least one of the following: completeness of brackets, existence of indicator fields, and matching of data types and operators; if the verification result is a pass, returning the verification result to the abstract syntax tree; if the verification result is a fail, extracting the set of error codes generated during the verification process and feeding back the set of error codes to the user so that the user can correct the logical expression.
[0072] It should be noted that semantic validation is a check performed on the logical expression represented by the abstract syntax tree at the semantic level. It not only focuses on whether the syntax structure of the expression is correct, but also checks more deeply whether the semantics of the combination of elements in the expression are reasonable (e.g., whether the numeric type needs to use ">", the completeness of parentheses, the existence of indicators, the validity of function parameters, etc.).
[0073] In logical expressions, parentheses are used to change the order of operations. The integrity of parentheses means that each left parenthesis has a corresponding right parenthesis, and the nesting order of the parentheses is correct.
[0074] Indicator fields represent variables in logical expressions. For example, in the logical expression "(A>10)AND(B>60%), A = number of defects, B = defect rate", "number of defects" and "defect rate" are indicator fields. Checking the existence of indicator fields avoids referencing non-existent indicator fields, which would render the logical expression meaningless.
[0075] Furthermore, in logical expressions, different data types have specific matching relationships with operators. For example, for the logical operators "AND" and "OR," the data type of their operands might be Boolean (representing true or false values). If the operands are numeric or string data, mismatches may occur. Ensuring that the data type matches the operator is crucial to guaranteeing the semantic correctness of the logical expression.
[0076] It should be understood that the error code set is a set of code identifiers generated during the verification process for different error types when semantic verification fails. These codes can be used to locate and correct errors in logical expressions.
[0077] For example, to facilitate understanding of the construction and validation process of the abstract syntax tree described above, refer to... Figure 2 , Figure 2 This is a schematic diagram illustrating the process of generating an abstract syntax tree (AST) according to Embodiment 1 of this application. After receiving a logical expression input by the user in a natural language-like format, the warning device first breaks down the logical expression into basic elements (Tokens), such as indicator fields, relational operators, parentheses, etc., to obtain an element data stream. Then, it performs syntactic analysis on this element data stream, combining each Token into a syntax tree node according to preset syntactic rules to construct an abstract syntax tree. Next, it performs semantic checks on the constructed abstract syntax tree (e.g., requiring the use of ">" for numeric types, ensuring the completeness of parentheses, verifying the existence of indicators, and confirming the validity of function parameters). If the verification passes, it returns to the abstract syntax tree to display the parsed content. If the verification fails, it extracts the set of error codes generated during the verification process and returns detailed information about the error code set to the user, facilitating the user's tracking and correction of the logical expression.
[0078] In this implementation, semantic verification of the abstract syntax tree ensures that the logical expression is not only syntactically correct but also semantically sound. When verification fails, the error code set is fed back to the user, helping them quickly locate and correct errors in the logical expression, improving its accuracy and effectiveness, and ultimately enhancing the reliability and stability of the entire logic processing system.
[0079] Step S20: Recursively process the abstract syntax tree using a recursive descent interpreter to obtain an executable rule object.
[0080] It should be noted that a recursive descent interpreter is a parser built upon a recursive definition of syntax. For a logical expression, a recursive descent interpreter can start from the root node of the abstract syntax tree and recursively process each child node downwards according to the grammatical rules, effectively converting the abstract syntax tree into executable operations.
[0081] Understandably, an executable rule object is an object form that can be directly executed by the warning device after processing the abstract syntax tree. It contains logical rules parsed from logical expressions. For example, the logical expression defines the warning conditions. After the previous parsing and transformation steps, the executable rule object is a pre-compiled instruction set. The warning device can directly check whether the indicators meet the warning conditions based on the executable rule object.
[0082] In practical implementation, the early warning device can use a recursive descent interpreter to recursively perform parsing according to the node type of the syntax tree node, generating executable rule objects.
[0083] Furthermore, during the above parsing and conversion process, cache expiration times can be set for frequently accessed metrics to improve operational efficiency. Alternatively, custom functions can be used for extension (e.g., MAX calculates the maximum value of the metric; MIN calculates the minimum value of the metric; AVG calculates the average value of the metric; COUNT counts the statistical metrics), but this embodiment does not impose any restrictions on this.
[0084] Step S30: Schedule the executable rule objects according to the preset priority weights to obtain the overall scheduling result. The preset priority weights are the weights assigned to the priority of each warning rule.
[0085] It should be noted that the preset priority weight is an importance metric pre-set for each warning rule. The warning device contains multiple warning rules to determine whether to trigger a warning under specific circumstances; different rules have different levels of importance.
[0086] Specifically, in order to determine the preset priority weight, this embodiment includes the following steps before step S30: obtaining the management role information, warning processing identifier, and core indicator identifier corresponding to each warning rule; assigning management role information weight to the management role information, warning processing weight to the warning processing identifier, and core indicator weight to the core indicator identifier according to the preset weight table; and determining the preset priority weight corresponding to each warning rule according to the management role information weight, the warning processing weight, and the core indicator weight.
[0087] It should be noted that management role information refers to information related to the roles responsible for handling early warning matters and associated with the early warning rules. This could include different personnel or departments, and may include role names, scope of responsibilities, and the role's hierarchy within the organizational structure. The management role information weight is a numerical value assigned to management role information to indicate its importance; it reflects the proportion of weight this factor carries when determining the priority of early warning rules.
[0088] For example, to facilitate understanding of the weighting of management role information, refer to Table 1, which is the management role table.
[0089] Management Role weight value Management Personnel 20 Product Manager 10 Test class leader 5
[0090] Table 1
[0091] Understandably, the warning processing identifier is a marker used to distinguish different warning processing methods. For example, it can indicate whether a warning requires immediate action or not. The warning processing weight is a numerical value assigned to the warning processing identifier to indicate its importance, reflecting the importance of the processing method represented by the warning processing identifier when determining the priority of warning rules.
[0092] For example, to facilitate understanding of the weight allocation of the warning processing identifier, refer to Table 2, which is the warning processing table.
[0093] Early warning processing weight value Needs to be processed 10 No processing required 5
[0094] Table 2
[0095] It should be understood that core indicator identifiers are used to identify the key indicators on which the early warning rules are based. Core indicator weights are numerical values assigned to core indicator identifiers that represent their degree of importance, indicating the importance of the key indicator corresponding to the core indicator identifier when determining the priority of early warning rules.
[0096] For example, to facilitate understanding of the weight allocation of the core indicator identifiers, please refer to Table 3, which is the core table.
[0097] Is it a core indicator? weight value yes 10 no 5
[0098] Table 3
[0099] It should be noted that the preset weight table pre-defines the total weight of different factors (such as management role information, early warning processing indicators, core indicator indicators, etc.) in determining the priority of early warning rules. Preset priority weight = management role information weight + early warning processing weight + core indicator weight.
[0100] For example, refer to Table 4, which is a priority weight table.
[0101] Priority Weight high [35~40] middle [25~30] Low [15~20]
[0102] Table 4
[0103] By comprehensively considering multiple factors related to the early warning rules (management role information, early warning processing identifiers, and core indicator identifiers) and assigning them weights, the preset priority weights of the early warning rules can be determined. This helps to rationally arrange the order of early warning processing according to actual needs in complex business environments, thereby improving the efficiency and effectiveness of early warning processing.
[0104] Understandably, the overall scheduling result is the result obtained after scheduling and executing all executable rule objects by taking into account the preset priority weights. It reflects the overall state or decision of the early warning device after processing the logical expression according to the rules and weights.
[0105] In practice, based on a pre-defined priority weight calculated comprehensively, the early warning device sorts the executable rule objects, with those having higher weights listed first. Then, the rule object operations are executed in this order, and the results are recorded to obtain the overall scheduling result.
[0106] In another feasible implementation, step S30 of this embodiment may include the following steps: when the preset priority weight is not lower than the first threshold, perform real-time triggering on the executable rule object to obtain a first scheduling result; when the preset priority weight is between the first threshold and the second threshold, execute the executable rule object within a preset first time window to obtain a second scheduling result; when the preset priority weight is less than the second threshold, execute the executable rule object in a polling manner within a preset second time window to obtain a third scheduling result; and use the first scheduling result, the second scheduling result, and the third scheduling result as the total scheduling result.
[0107] It should be noted that the first, second, and third thresholds are critical values used to distinguish different scheduling methods, with the second threshold being lower than the first threshold. The first threshold (e.g., 0.5) indicates that the executable rule object has the highest priority when its preset priority weight reaches or exceeds this value. When the preset priority weight of the executable rule object is between the first and second thresholds, it indicates that the rule object has a medium priority. When the preset priority weight of the executable rule object is lower than the second threshold (e.g., 0.2), it indicates that the rule object has the lowest priority.
[0108] For example, to facilitate understanding of the scheduling process in this embodiment, please refer to Table 5, which is a scheduling priority table.
[0109] Priority Rules and Regulations Scheduling strategy high Key Indicators Real-time triggering, prioritizing resource acquisition middle Indicators that need to be processed Response within 100ms Low Non-core indicators or not processed Rotational training execution (interval 500ms)
[0110] Table 5
[0111] It is understandable that the preset first time window (e.g., 100ms in the table) is a specific time period during which the executable rule object is executed when its preset priority weight is between the first and second thresholds. The preset second time window (e.g., 500ms in the table) is a specific time period during which the executable rule object is executed when its preset priority weight is less than the second threshold. The terms "first" and "second" do not represent a superior-inferior relationship, but are merely used for distinction.
[0112] Understandably, the first scheduling result is obtained by triggering the executable rule object in real time when the preset priority weight of the executable rule object is not lower than the first threshold. The second scheduling result is obtained by executing the executable rule object within a preset first time window when the preset priority weight of the executable rule object is between the first and second thresholds. The third scheduling result is obtained by executing the executable rule object in a round-robin manner within a preset second time window when the preset priority weight of the executable rule object is less than the second threshold.
[0113] The above results reflect the impact of each priority rule object on various aspects of the early warning equipment during execution and are part of the overall scheduling results.
[0114] In this implementation, by triggering high-priority executable rule objects in real time, rapid response to urgent and important tasks can be ensured. For medium-priority rule objects, execution within a preset first time window provides a certain degree of timeliness while avoiding resource contention with high-priority tasks. Low-priority rule objects are executed using a polling method within a preset second time window, enabling orderly processing of these tasks when system resources are idle, thus improving the overall utilization of system resources.
[0115] Step S40: When there is a situation in the overall scheduling result that triggers the early warning rule, issue an early warning for the abnormal indicators in the logical expression.
[0116] It should be noted that abnormal indicators are those that are not in a normal state or deviate from the normal state in the logical expression when the aforementioned warning rule is triggered.
[0117] For example, to facilitate understanding of the above early warning process, refer to Figure 3 , Figure 3This is a scheduling flowchart provided in Embodiment 1 of this application. The process schedules according to priority. Once a suspected abnormal indicator is detected, it is immediately parsed according to the warning rule. If the rule is successfully executed, it means that the warning rule has been successfully triggered, confirming the existence of an abnormal indicator. At this time, a warning notification is sent to the operations and maintenance personnel. If it is not triggered, a retry mechanism is initiated, and the above rule parsing process is repeated. If the retry count is reached, it is determined whether the suspected abnormal indicator is a high priority. If it is not a high priority, it is marked as an abnormal rule, and the operations and maintenance personnel will handle it subsequently. If it is a high priority, the operations and maintenance personnel are notified to confirm. If it is confirmed to be normal, the suspected abnormal indicator is rescheduled for processing.
[0118] In the technical solution provided in this embodiment, after receiving a logical expression input by a user in a natural language-like format, the early warning device performs lexical analysis on the logical expression, identifies the elements in the logical expression, and determines the hierarchical structure according to the logical operation priority rules to construct an abstract syntax tree. Then, a recursive descent interpreter is used to recursively parse the syntax tree nodes according to their node types, generating executable rule objects. Next, based on a preset priority weight calculated comprehensively, the executable rule objects are sorted, with those having higher weights appearing first, and the rule object operations are executed in this order, with the results recorded to obtain the overall scheduling result. When an early warning rule is triggered during the scheduling process, an early warning is issued for abnormal indicators in the logical expression. This embodiment introduces dynamically configurable indicators for logical expressions, supporting rule configuration in a natural language-like manner, greatly reducing the barrier to entry. At the same time, by parsing the logical expression into an abstract syntax tree and using a recursive descent interpreter to achieve dynamic compilation, the flexibility and maintainability of indicator early warning are improved.
[0119] Based on the first embodiment of this application described above, a second embodiment of this application is proposed. In this second embodiment, content that is the same as or similar to that in the first embodiment can be referred to the above description and will not be repeated hereafter. Based on this, please refer to... Figure 4 , Figure 4 This is a flowchart illustrating the second embodiment of the early warning method for the indicator system in this application.
[0120] Step S20 in this example includes steps S21 to S25:
[0121] Step S21: Initialize the recursive descent interpreter and the context information of the element stream data.
[0122] It should be noted that context information is additional information related to the element stream data, describing the environment, state, or relationship with other related elements of the element stream. For example, it may include symbol tables (used to store variable information) and environment variables (external conditions that may affect execution), preparing for subsequent traversal of the abstract syntax tree.
[0123] Step S22: Starting from the root node of the abstract syntax tree, the recursive descent interpreter recursively processes each child node of the abstract syntax tree according to the depth-first principle.
[0124] It's important to note that the root node is the starting point of the entire tree structure in the abstract syntax tree. In this tree structure, all other nodes are descendants of the root node. The root node represents the highest-level concept in the entire syntax structure and is the entry point where the recursive descent interpreter begins processing the abstract syntax tree.
[0125] Understandably, the depth-first search strategy is used when traversing a tree structure. Following this principle, when traversing a tree, one first visits a branch as deeply as possible until no further depth is possible (reaching a leaf node or satisfying a termination condition), and then backtracks to the previous level to continue visiting other branches that node has not yet been visited. This helps to systematically explore the tree structure, ensuring that every node is visited.
[0126] It should be understood that a child node is a concept in the tree structure of an abstract syntax tree relative to a certain parent node.
[0127] Step S23: During the process of accessing each child node, determine the node type corresponding to each child node.
[0128] It should be noted that node type is a classification identifier for each node in the abstract syntax tree. Different node types represent different syntactic structural units.
[0129] For example, a node could be an operator node (such as addition, subtraction, etc.), an operand node (such as numbers, variables, etc.), or a control flow node (such as conditional statements, loops, etc.). Based on the determined node type, a predefined processing method for that type of node can be invoked.
[0130] For example, to facilitate understanding of the above node types, please refer to Table 6, which is a node type table.
[0131]
[0132] Table 6
[0133] Step S24: parse each child node according to the node type to obtain the parsing result.
[0134] It should be noted that the parsing result is the output obtained after parsing each child node in the abstract syntax tree, reflecting the meaning of the grammatical structure represented by the child node in a specific parsing process.
[0135] Step S25: During the recursive process, update the context information based on the parsing result until the recursion reaches the leaf node of the abstract syntax tree, and determine the executable rule object.
[0136] For example, during the update of context information, when a variable definition node is encountered, the variable name and its initial value are added to the symbol table (part of the context information); when a variable reference node is encountered, the value of the variable can be retrieved from the symbol table. This passing and updating of context information ensures the consistency and correctness of processing at different nodes, enabling the traversal and parsing of the entire abstract syntax tree to meet the logical requirements of the program.
[0137] In the technical solution provided in this embodiment, the recursive descent interpreter is first initialized, and initial context information is prepared for the interpreter. Then, recursively traversing the abstract syntax tree (API) begins from the root node, using the root node as the starting point and following a depth-first approach. When visiting each node, its type is determined. Based on the determined node type, a predefined processing method for that type of node is invoked for parsing. During the recursive traversal of the API, context information is passed and updated according to the node processing status. After the recursive descent interpreter completes the traversal of the entire API, and after the previous steps of processing each node and correctly maintaining the context information, an executable rule object is finally obtained. This executable rule object is the result of parsing the original API and contains instructions or data structures that can be directly run in the target execution environment. By processing the API using the recursive descent interpreter according to the depth-first principle, the syntax structure can be systematically and comprehensively parsed, and nested relationships within the syntax structure can be handled effectively.
[0138] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the early warning method of the indicator system of this application. Any simple modifications based on this technical concept are within the protection scope of this application.
[0139] This application also provides an indicator system early warning device, please refer to... Figure 5 , Figure 5 This is a schematic diagram of the module structure of the indicator system early warning device according to an embodiment of this application; the indicator system early warning device includes:
[0140] The syntax tree module 501 is used to parse logical expressions input by the user in a natural language-like form and generate an abstract syntax tree;
[0141] Interpreter module 502 is used to recursively process the abstract syntax tree through a recursive descent interpreter to obtain an executable rule object;
[0142] The object scheduling module 503 is used to schedule the executable rule objects according to a preset priority weight to obtain a total scheduling result. The preset priority weight is the weight assigned to the priority of each warning rule.
[0143] The indicator warning module 504 is used to issue a warning for abnormal indicators in the logical expression when there is a situation in the overall scheduling result that triggers the warning rule.
[0144] In one implementation, the syntax tree module 501 is further configured to receive a logical expression input by a user in a natural language-like form; split the logical expression into elements to obtain corresponding element stream data; combine the element stream data into multiple syntax tree nodes according to preset syntax rules, the preset syntax rules including at least one of operator precedence and bracket hierarchy; and construct an abstract syntax tree based on the correlation between the multiple syntax tree nodes.
[0145] In one implementation, the syntax tree module 501 is further configured to perform semantic verification on the abstract syntax tree and obtain a verification result. The semantic verification includes at least one of the following: completeness of parentheses, existence of indicator fields, and matching of data types and operators. If the verification result is a pass, the verification result is returned to the abstract syntax tree. If the verification result is a fail, the error code set generated during the verification process is extracted and the error code set is fed back to the user so that the user can correct the logical expression.
[0146] In one implementation, the object scheduling module 503 is further configured to obtain the management role information, early warning processing identifier, and core indicator identifier corresponding to each early warning rule; assign management role information weights to the management role information, early warning processing weights to the early warning processing identifier, and core indicator weights to the core indicator identifier according to a preset weight table; and determine the preset priority weight corresponding to each early warning rule based on the management role information weights, the early warning processing weights, and the core indicator weights.
[0147] In one implementation, the object scheduling module 503 is further configured to: execute real-time triggering on the executable rule object when the preset priority weight is not lower than a first threshold, to obtain a first scheduling result; execute the executable rule object within a preset first time window when the preset priority weight is between the first threshold and a second threshold, to obtain a second scheduling result; execute the executable rule object in a polling manner within a preset second time window when the preset priority weight is less than the second threshold, to obtain a third scheduling result; and use the first scheduling result, the second scheduling result, and the third scheduling result as the overall scheduling result.
[0148] In one implementation, the interpreter module 502 is further configured to initialize the recursive descent interpreter and the context information of the element stream data; starting from the root node of the abstract syntax tree, the recursive descent interpreter recursively processes each child node of the abstract syntax tree according to the depth-first principle; during the access of each child node, the node type corresponding to each child node is determined; each child node is parsed according to the node type to obtain the parsing result; during the recursion process, the context information is updated according to the parsing result until the leaf node of the abstract syntax tree is reached, and the executable rule object is determined.
[0149] Other embodiments or specific implementations of the indicator system early warning device of this application can be referred to the above-described method embodiments, and will not be repeated here.
[0150] The indicator system early warning device provided in this application, employing the indicator system early warning method in the above embodiments, can solve the technical problem that traditional indicator early warning methods relying on hard-coded rules lack dynamic adjustment capabilities, leading to low efficiency in indicator operation and maintenance response. Compared with the prior art, the beneficial effects of the indicator system early warning device provided in this application are the same as those of the indicator system early warning method provided in the above embodiments, and other technical features in the indicator system early warning device are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.
[0151] This application provides an indicator system early warning device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the indicator system early warning method in the above embodiment 1.
[0152] The following is for reference. Figure 6 , Figure 6 This is a schematic diagram of the hardware operating environment involved in the indicator system early warning method in the embodiments of this application, showing a structural diagram of an indicator system early warning device suitable for implementing the embodiments of this application. The indicator system early warning device in the embodiments of this application may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), vehicle terminals (e.g., vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 6The indicator system warning device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0153] like Figure 6 As shown, the indicator system early warning device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory 1002 or a program loaded from a storage device 1003 into a random access memory 1004. The random access memory 1004 also stores various programs and data required for the operation of the indicator system early warning device. The processing unit 1001, the read-only memory 1002, and the random access memory 1004 are interconnected via a bus 1005. An input / output interface 1006 is also connected to the bus. Typically, the following systems can be connected to the input / output interface 1006: input devices 1007 including, for example, a touch screen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 1003 including, for example, magnetic tape, hard disk, etc.; and communication devices 1009. Communication device 1009 allows the indicator system early warning device to communicate wirelessly or wiredly with other devices to exchange data. Although the figure shows indicator system early warning devices with various systems, it should be understood that implementation or possession of all the systems shown is not required. More or fewer systems may be implemented alternatively.
[0154] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from read-only memory 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.
[0155] The indicator system early warning device provided in this application, employing the indicator system early warning method described in the above embodiments, can solve the technical problem that traditional indicator early warning systems relying on hard-coded rules lack dynamic adjustment capabilities, leading to low efficiency in indicator operation and maintenance response. Compared with the prior art, the beneficial effects of the indicator system early warning device provided in this application are the same as those of the indicator system early warning method provided in the above embodiments, and other technical features in this indicator system early warning device are the same as those disclosed in the previous embodiment method, and will not be repeated here.
[0156] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.
[0157] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0158] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the indicator system early warning method in the above embodiments.
[0159] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.
[0160] The aforementioned computer-readable storage medium may be included in the indicator system early warning device; or it may exist independently and not be assembled into the indicator system early warning device.
[0161] The aforementioned computer-readable storage medium carries one or more programs. When these programs are executed by the indicator system early warning device, the indicator system early warning device performs the following actions: parses the logical expression input by the user in a natural language-like form to generate an abstract syntax tree; recursively processes the abstract syntax tree using a recursive descent interpreter to obtain executable rule objects; schedules the executable rule objects according to preset priority weights to obtain a total scheduling result, where the preset priority weights are weights assigned to the priority of each early warning rule; and when a situation triggering the early warning rule exists in the total scheduling result, issues an early warning for the abnormal indicators in the logical expression.
[0162] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0163] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0164] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.
[0165] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the aforementioned indicator system early warning method. This solves the technical problem that traditional indicator early warning methods relying on hard-coded rules lack dynamic adjustment capabilities, leading to low efficiency in indicator operation and maintenance. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the indicator system early warning method provided in the above embodiments, and will not be elaborated upon here.
[0166] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the indicator system early warning method described above.
[0167] The computer program product provided in this application can solve the technical problem that traditional indicator early warning systems that rely on hard-coded rules lack dynamic adjustment capabilities, resulting in low efficiency in indicator operation and maintenance response. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as those of the indicator system early warning method provided in the above embodiments, and will not be repeated here.
[0168] The above description is only a part of the embodiments of this application and does not limit the scope of protection of this application. All equivalent structural transformations made under the technical concept of this application and using the content of this application specification and drawings, or direct / indirect applications in other related technical fields, are included in the scope of protection of this application.
Claims
1. A method for early warning of an index system, characterized in that, The method comprises: parsing a logical expression input by a user in a natural language form to generate an abstract syntax tree; recursively processing the abstract syntax tree by a recursive descent interpreter to obtain an executable rule object; scheduling the executable rule object according to preset priority weights to obtain a total scheduling result, wherein the preset priority weights are weights assigned to the priority of each early warning rule; warning an abnormal index in the logical expression when a condition of triggering the early warning rule exists in the total scheduling result.
2. The method of claim 1, wherein, The step of parsing the logical expression input by the user in the natural language form to generate the abstract syntax tree comprises: receiving the logical expression input by the user in the natural language form; elementally splitting the logical expression to obtain corresponding element stream data; combining the element stream data into a plurality of syntax tree nodes according to preset syntax rules, wherein the preset syntax rules comprise at least one of operator priority and bracket level; constructing an abstract syntax tree according to the association between the plurality of syntax tree nodes.
3. The method of claim 2, wherein, After the step of constructing the abstract syntax tree according to the association between the plurality of syntax tree nodes, the method further comprises: performing semantic verification on the abstract syntax tree to obtain a verification result, wherein the semantic verification comprises at least one of the integrity of brackets, whether an index field exists, and whether a data type matches an operator; returning the verification result to the abstract syntax tree when the verification result is a verification pass; extracting an error code set generated in a verification process and feeding back the error code set to the user to enable the user to modify the logical expression when the verification result is a verification fail.
4. The method of claim 1, wherein, Before the step of scheduling the executable rule object according to preset priority weights to obtain a total scheduling result, the method further comprises: obtaining management role information, early warning processing identification, and core index identification corresponding to each early warning rule; allocating a management role information weight to the management role information, an early warning processing weight to the early warning processing identification, and a core index weight to the core index identification according to a preset weight table; determining a preset priority weight corresponding to each early warning rule according to the management role information weight, the early warning processing weight, and the core index weight.
5. The method of claim 1, wherein, The step of scheduling the executable rule object according to preset priority weights to obtain a total scheduling result comprises: performing real-time triggering on the executable rule object to obtain a first scheduling result when the preset priority weight is not lower than a first threshold value; performing the executable rule object within a preset first time window to obtain a second scheduling result when the preset priority weight is between the first threshold value and a second threshold value; performing the executable rule object in a polling manner within a preset second time window to obtain a third scheduling result when the preset priority weight is less than the second threshold value; taking the first scheduling result, the second scheduling result, and the third scheduling result as the total scheduling result.
6. The method of any one of claims 2 to 5, wherein, The step of processing the abstract syntax tree recursively by the recursive descent interpreter to obtain an executable rule object comprises: initializing a recursive descent interpreter and context information of the element stream data; starting from a root node of the abstract syntax tree, recursively processing each child node of the abstract syntax tree according to a depth-first principle by the recursive descent interpreter; during the processing of each child node, determining a node type corresponding to each child node; parsing each child node according to the node type to obtain a parsing result; updating the context information according to the parsing result during the recursion until a leaf node of the abstract syntax tree is reached to determine an executable rule object.
7. An index system early warning device, characterized by, The apparatus comprises: a syntax tree module configured to parse a logical expression input by a user in a natural language form to generate an abstract syntax tree; an interpreter module configured to process the abstract syntax tree recursively by a recursive descent interpreter to obtain an executable rule object; an object scheduling module configured to schedule the executable rule object according to a preset priority weight to obtain a total scheduling result, the preset priority weight being a weight assigned to a priority of each early warning rule; an index early warning module configured to early warn an abnormal index in the logical expression when a condition triggering the early warning rule exists in the total scheduling result.
8. An index system early warning device, characterized by, The device comprises a memory, a processor, and a computer program stored on the memory and executable on the processor, the computer program being configured to implement the steps of the index system early warning method according to any one of claims 1 to 6.
9. A storage medium, characterized by The storage medium is a computer-readable storage medium, and the storage medium stores a computer program, the computer program being executable by a processor to implement the steps of the index system early warning method according to any one of claims 1 to 6.
10. A computer program product, characterised in that, The computer program product comprises a computer program, the computer program being executable by a processor to implement the steps of the index system early warning method according to any one of claims 1 to 6.