Prometheus index management method and system, Prometheus index use method and system, medium and electronic equipment

By analyzing PromQL expressions to generate OneData information and automatically generate rule descriptions, the problem of irregular naming and description of Prometheus indicators is solved, reducing the workload of alarm configuration personnel and improving the standardization of rule descriptions, and achieving efficient management of Prometheus indicators and use.

CN119311513AActive Publication Date: 2025-01-14SHANGHAI SHUHE INFORMATION TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411347690.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-26
Publication Date
2025-01-14
Estimated Expiration
2044-09-26

AI Technical Summary

Technical Problem

When monitoring alarms using Prometheus, the alarm configurator needs to manually add a description to interpret the PromQL expression, resulting in increased workload and irregular rule descriptions.

Method used

Generate OneData information by parsing PromQL expressions, and generate indicator names according to preset naming specifications. Save the indicator names, OneData information and PromQL expressions to MySQL, and automatically generate rule descriptions, reducing the workload of alarm configurators and improving the standardization of descriptions. .

Benefits of technology

The standard naming and description of Prometheus indicators is realized, which reduces the workload of alarm configuration personnel, improves the standardization and integrity of rule descriptions, and facilitates users to understand target rules.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119311513A_ABST
    Figure CN119311513A_ABST
Patent Text Reader

Abstract

The invention provides a Prometheus index management method and system, a Prometheus index use method and system, a medium and electronic equipment. The Prometheus index management method comprises the steps that a first PromQL expression corresponding to a Prometheus index is acquired; the first PromQL expression is analyzed on the basis of the OneData and the ANTLR, and the OneData information is obtained; generating an index name based on a preset naming specification and the OneData information; the index name, the OneData information and the first PromQL expression are stored to a MySQL (Structured Query Language); according to the method and the device, the PromQL expression corresponding to the Prometheus index is analyzed, the OneData information is reversely generated, and the index name is generated through the OneData information, so that when the Prometheus index is used subsequently, the index name, the OneData information and the PromQL expression can be directly selected and used, the configuration rule can be understood in an auxiliary manner through the index name, the OneData information and the PromQL expression, and the configuration efficiency is improved. The process of manually adding description by an alarm configuration worker is omitted, and the workload of the alarm configuration worker is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of data processing technology and relates to Prometheus, and in particular to a method, system, medium, and electronic device for managing and using Prometheus indicators. Background Art

[0002] In the scenario of using Prometheus for monitoring alarms, when the alarm configurator configures the PromQL expression, because the recipient of the alarm notification may not understand the PromQL expression and the alarm rules, it is necessary to manually add a description to explain the alarm configuration rules and the meaning of the indicators, which will undoubtedly increase the workload of the alarm configurator. Summary of the invention

[0003] The purpose of this application is to provide a Prometheus indicator management and use method, system, medium, and electronic device to solve the problems pointed out in the above background technology.

[0004] In a first aspect, the present application provides a Prometheus indicator management method, which includes: obtaining a first PromQL expression corresponding to a Prometheus indicator; parsing the first PromQL expression based on OneData and ANTLR to obtain OneData information; generating an indicator name based on a preset naming specification and the OneData information; and saving the indicator name, the OneData information, and the first PromQL expression to MySQL.

[0005] In this application, by parsing the PromQL expression corresponding to the Prometheus indicator, reversely generating OneData information, and generating the indicator name through the OneData information, when using the Prometheus indicator in the future, you can directly choose to use the indicator name, OneData information and the PromQL expression, and you can use the indicator name, OneData information and the PromQL expression to assist in understanding the configuration rules, eliminating the process of manual addition of descriptions by the alarm configurator and reducing the workload of the alarm configurator.

[0006] In an implementation manner of the first aspect, the first PromQL expression is written by the indicator Owner according to the original indicator.

[0007] In an implementation of the first aspect, the preset naming convention is: [type label] statistical period_atomic indicator_statistical method_suffix [dimension label] [business limitation label]; wherein, [type label] is used to indicate the type of the Prometheus indicator; the suffix is ​​a unique code corresponding to the first PromQL expression; [dimension label] is used to indicate the dimension of the Prometheus indicator; [business limitation label] is used to indicate the business limitation of the Prometheus indicator.

[0008] In a second aspect, the present application provides a method for using a Prometheus indicator, wherein the Prometheus indicator is the above-mentioned Prometheus indicator; the method for using the Prometheus indicator includes: determining a target Prometheus indicator, a target operator, a target threshold, and a target logical symbol according to actual needs; configuring a target rule according to the target Prometheus indicator, the target operator, the target threshold, and the target logical symbol; determining a target PromQL expression corresponding to the target Prometheus indicator based on a first PromQL expression; generating a second PromQL expression corresponding to the target rule based on the target operator, the target threshold, the target logical symbol, and the target PromQL expression; and sending the second PromQL expression to Prometheus to make the target rule effective.

[0009] In the present application, a method for using Prometheus indicators is provided. In practical applications, according to actual needs, a second PromQL expression corresponding to the target rule can be generated by directly selecting and using the first PromQL expression provided in the above-mentioned Prometheus indicator management method.

[0010] In an implementation of the second aspect, the Prometheus indicator usage method further includes: generating a rule description based on the target Prometheus indicator, the target operator, the target threshold and the target logical symbol, and saving the rule description to MySQL; and / or saving the target rule to MySQL.

[0011] In this implementation, the rule description is automatically generated to ensure the standardization and completeness of the description, eliminating the need for the alarm configurator to manually add the description. In addition, by saving the rule description to MySQL, it is easier for users to understand the target rule.

[0012] In an implementation of the second aspect, the Prometheus indicator use method further includes: when the Prometheus triggers the actual demand, sending the target rule and the rule description to a recipient client.

[0013] In this implementation, the target rules and rule descriptions can assist users in understanding the target rules.

[0014] In the third aspect, the present application provides a Prometheus indicator management system, which includes: a first acquisition module, used to obtain a first PromQL expression corresponding to the Prometheus indicator; a second acquisition module, used to parse the first PromQL expression based on OneData and ANTLR to obtain OneData information; a generation module, used to generate an indicator name based on a preset naming specification and the OneData information; a saving module, used to save the indicator name, the OneData information and the first PromQL expression to MySQL.

[0015] In a fourth aspect, the present application provides a Prometheus indicator usage system, wherein the Prometheus indicator is the above-mentioned Prometheus indicator; the Prometheus indicator usage system includes: a first determination module, used to determine the target Prometheus indicator, target operator, target threshold and target logical symbol according to actual needs; a configuration module, used to configure the target rule according to the target Prometheus indicator, the target operator, the target threshold and the target logical symbol; a second determination module, used to determine the target PromQL expression corresponding to the target Prometheus indicator based on the first PromQL expression; a generation module, used to generate a second PromQL expression corresponding to the target rule based on the target operator, the target threshold, the target logical symbol and the target PromQL expression; a sending module, used to send the second PromQL expression to Prometheus to make the target rule effective.

[0016] In a fifth aspect, the present application provides an electronic device, comprising: a processor and a memory; the memory is used to store a computer program; the processor is used to execute the computer program stored in the memory, so that the electronic device executes the above-mentioned Prometheus indicator management method, and / or the above-mentioned Prometheus indicator usage method.

[0017] In a sixth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by an electronic device, implements the above-mentioned Prometheus indicator management method and / or the above-mentioned Prometheus indicator usage method.

[0018] As described above, the Prometheus indicator management and use method, system, medium, and electronic device described in this application have the following beneficial effects:

[0019] (1) Compared with the prior art, this application adopts the OneData theory to solve the problem that Prometheus indicators have no standardized naming and description. By parsing the PromQL expression, OneData information is reversely generated, which has the advantages of less workload and wider coverage.

[0020] (2) By saving the indicator name, OneData information, and the first PromQL expression, it is convenient to directly select and use the Prometheus indicator in the future, and it is helpful for users to understand the target rules configured according to actual needs.

[0021] (3) By automatically generating rule descriptions, the descriptions are more standardized and complete compared to the prior art where the alarm configurator adds descriptions based on subjective understanding. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 Shown is a flowchart of the Prometheus indicator management method described in an embodiment of the present application.

[0023] Figure 2 Shown is a schematic diagram of the Prometheus indicator management method described in an embodiment of the present application.

[0024] Figure 3 Shown is a flowchart of the method for using Prometheus indicators described in an embodiment of the present application.

[0025] Figure 4 Shown is a schematic diagram of the structure of the Prometheus indicator management system described in an embodiment of the present application.

[0026] Figure 5 Shown is a structural diagram of the Prometheus indicator usage system described in an embodiment of the present application. DETAILED DESCRIPTION

[0027] The following describes the embodiments of the present application through specific examples, and those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. The present application can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present application. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.

[0028] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present application, and thus the drawings only show components related to the present application rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed at will, and the component layout may also be more complicated.

[0029] See also Figures 1 to 5 . The following embodiments of the present application provide a method, system, medium, and electronic device for managing and using Prometheus indicators. Compared with the prior art, the present application adopts the OneData theory to solve the problem that Prometheus indicators have no standardized naming and description, and reversely generates OneData information by parsing the PromQL expression, which has the advantages of less workload and wider coverage; by saving the indicator name, OneData information and the first PromQL expression, it is convenient to directly select and use the Prometheus indicator in the subsequent use, and it is beneficial for users to understand the target rules configured according to actual needs; by automatically generating rule descriptions, compared with the prior art, the alarm configurator adds descriptions through subjective understanding, making the description more standardized and complete.

[0030] Prometheus is an open source system monitoring and alerting tool designed for modern cloud-native environments. Prometheus was developed by former Google engineers inside SoundCloud and later released as an independent open source project.

[0031] PromQL is the built-in data query language of Prometheus, which can realize the query, aggregation, logical operation, etc. of event sequence data. It is also widely used in the daily application of Prometheus, including data query, visualization, and alarm processing.

[0032] The technical solutions in the embodiments of the present application will be described in detail below in conjunction with the drawings in the embodiments of the present application.

[0033] like Figure 1As shown, in one embodiment, the present application provides a Prometheus indicator management method, and the Prometheus indicator management method includes:

[0034] Step S101: Obtain a first PromQL expression corresponding to a Prometheus indicator.

[0035] In one embodiment, the first PromQL expression is written by the indicator Owner according to the original indicator.

[0036] It should be noted that the original indicator refers to the most basic and original indicator or variable for data collection or collection, which is usually a data indicator that has not been processed or calculated in any way, and is the original data obtained directly from the data source; the indicator owner (corresponding to the alarm configurator in the above background technology, that is, an administrator with corresponding professional knowledge who can write accurate PromQL expressions) is a professional in the enterprise who is responsible for a specific indicator. They are not only managers of data and numbers, but also data analysts and decision makers. They need to be responsible for the collection, analysis and interpretation of the indicator in order to better help the enterprise make decisions and plans. At the same time, the indicator owner should have a deep understanding of the business and technical capabilities in order to better maintain and optimize the indicator.

[0037] Specifically, when the original indicator is generated by an application, the indicator owner supplements the basic information for the original indicator according to the actual situation. For example, mysql_request_count is associated with the atomic indicator: the number of database requests, and the Chinese name of the supplementary dimension: application name, database instance, etc.; then, the indicator owner adds a derived indicator based on the original indicator supplemented with basic information, for example:

[0038] sum(increase(mysql_request_count{springapp='metricplus',dataSourceInstance= ~ '.*aliyuncs.*'}

[0039] [5m])>0)by(dataSourceInstance).

[0040] It should be noted that the specific information included in the above basic information is not a condition to limit this application. In actual application, it is determined by the indicator Owner according to actual conditions.

[0041] Atomic indicators are measurements based on a certain business event behavior. They are indicators that cannot be further divided in the business definition and have clear business nouns, such as payment amount.

[0042] Derived indicator = one atomic indicator + multiple business limits (optional) + statistical period, which can be understood as the definition of the statistical scope of the atomic indicator business. For example, the atomic indicator: payment amount, the payment amount of overseas buyers in the most recent day is a derived indicator.

[0043] Dimension is a measurement environment that reflects a type of business attribute. The collection of such attributes constitutes a dimension, which can also be called an entity object. Dimensions belong to a data domain, such as geographic dimensions (including content at the country, region, province, and city levels) and time dimensions (including content at the year, quarter, month, week, day, etc.).

[0044] The statistical period is used to clarify the time range or time point of data statistics, such as the last 30 days, natural week, as of the current day, etc.

[0045] Business qualifications are a key component used to refine and standardize data indicator definitions. Business qualifications are conditions used in derived indicators to filter out records that meet specific business rules.

[0046] Step S102: Parse the first PromQL expression based on OneData and ANTLR to obtain OneData information.

[0047] It should be noted that OneData is a data management and integration methodology proposed by Alibaba Group, which aims to build a unified, standardized and shareable global data system. Its goal is to solve common data management problems in large organizations; ANTLR (ANother Tool for Language Recognition) is a powerful open source parser generator, mainly used to read, process, execute or translate structured text or binary files, especially programming languages, domain-specific languages ​​(DSLs) or any other context-free grammar (CFG).

[0048] The working principle of step S102 is further explained below through a specific embodiment.

[0049] like Figure 2 As shown, in one embodiment, the first PromQL expression is:

[0050] sum(increase(mysql_request_count{springapp='metricplus',dataSourceInstance= ~ '.*aliyuncs.*'}

[0051] [5m])>0)by(dataSourceInstance), after parsing it through ANTLR, the OneData information obtained includes:

[0052] Statistical method: total;

[0053] Atomic indicators: number of database requests;

[0054] Business restrictions: 1. Application name equals metricplus; 2. Database instance fuzzy match.*aliyuncs.*; 3. Value greater than 0;

[0055] Statistical period: the last 5 minutes;

[0056] Dimension: Database instance.

[0057] Step S103: Generate an indicator name based on a preset naming convention and the OneData information.

[0058] Specifically, the indicator name is automatically generated based on the OneData information according to the preset naming convention.

[0059] In one embodiment, the preset naming convention is: [type label] statistical period_atomic indicator_statistical method_suffix [dimension label] [business-limited label]; wherein,

[0060] [Type label] is used to indicate the type of the Prometheus indicator; the suffix is ​​the unique code corresponding to the first PromQL expression; [Dimension label] is used to indicate the dimension of the Prometheus indicator; specifically, the dimension of the Prometheus indicator is displayed when the mouse is hovering; [Business limitation label] is used to indicate the business limitation of the Prometheus indicator; specifically, the business limitation of the Prometheus indicator is displayed when the mouse is hovering.

[0061] In one embodiment, different symbols are used to represent different types of Prometheus indicators (such as Figure 2 As shown in , the symbol "D" is used to represent the derived indicator).

[0062] In one embodiment, the suffix is ​​a numeric code automatically generated according to the first PromQL expression (e.g. Figure 2 The suffix is ​​unique for each first PromQL expression.

[0063] It should be noted that the type label includes at least but is not limited to any one of the following: original indicator, derived indicator, and composite indicator.

[0064] The working principle of step S103 is further explained below through a specific embodiment.

[0065] like Figure 2 As shown, the generated indicator name is: [D] Last 5 minutes_Total number of database requests_2315 [Dimension (1)] [Limit (3)]; D indicates that the type label is a derived indicator; when the mouse hovers over [Dimension (1)], the dimension is displayed: database instance; when the mouse hovers over [Limit (3)], the business limitation is displayed: 1. Application name is equal to metricplus; 2. Database instance fuzzy match.*aliyuncs.*; 3. The value is greater than 0.

[0066] In one embodiment, the indicator name that does not conform to the preset naming specification is manually changed by the indicator owner.

[0067] Step S104: Save the indicator name, the OneData information and the first PromQL expression to MySQL.

[0068] It should be noted that by saving the indicator name, OneData information and the first PromQL expression to MySQL, the indicator can be directly selected for use later, and it is beneficial for subsequent users to better understand the configuration rules based on the indicator name, OneData information and the first PromQL expression.

[0069] MySQL is a relational database management system developed by MySQL AB of Sweden and is a product of Oracle. MySQL is one of the most popular relational database management systems. In terms of WEB applications, MySQL is one of the best RDBMS (Relational Database Management System) application software.

[0070] This application adopts the OneData theory to solve the problem that Prometheus indicators have no standardized naming and description. By parsing the indicator PromQL expression, OneData information is reversely generated, which has the following advantages:

[0071] (1) Less workload. Compared with the existing technology, the OneData forward generation indicator adopted does not require very rigorous management of dimensional information and dependent derived indicators.

[0072] (2) Wider coverage: As long as you can write a PromQL expression, you can cover it. If OneData information cannot be automatically generated in some special cases, you can also use manual supplementary recording as a backup. If OneData generates indicators positively, it may not be able to generate the PromQL expression of the indicator in some special cases.

[0073] The protection scope of the Prometheus indicator management method described in the embodiment of the present application is not limited to the execution order of the steps listed in the present embodiment. All solutions implemented by adding, reducing or replacing steps in the prior art based on the principles of the present application are included in the protection scope of the present application.

[0074] like Figure 3 As shown, in one embodiment, the present application provides a method for using a Prometheus indicator, wherein the Prometheus indicator is a Prometheus indicator provided by the above-mentioned Prometheus indicator management method; the method for using the Prometheus indicator includes:

[0075] Step S301: Determine the target Prometheus indicator, target operator, target threshold and target logical operator according to actual needs.

[0076] Specifically, the target operators at least include but are not limited to: >, =, <; the target logical symbols at least include but are not limited to: and, or.

[0077] Step S302: configure target rules according to the target Prometheus indicator, the target operator, the target threshold and the target logical symbol.

[0078] Step S303: Determine a target PromQL expression corresponding to the target Prometheus indicator based on the first PromQL expression.

[0079] Specifically, the target PromQL expression corresponding to the target Prometheus indicator is determined based on the first PromQL expression saved in step S104, that is, when using the target PromQL expression, it can be directly selected from the first PromQL expression saved in step S104, and the target PromQL expression can be reused. The target PromQL expression can continue to be selected during the next configuration without rewriting the target PromQL expression, thereby realizing indicator reuse.

[0080] Step S304: Generate a second PromQL expression corresponding to the target rule based on the target operator, the target threshold, the target logical symbol, and the target PromQL expression.

[0081] Step S305: Send the second PromQL expression to Prometheus to make the target rule effective.

[0082] In one embodiment, the Prometheus indicator use method further includes: generating a rule description according to the target Prometheus indicator, the target operator, the target threshold and the target logical symbol, and saving the rule description to MySQL.

[0083] It should be noted that, by automatically generating rule descriptions, the rule descriptions are made more standardized and complete compared to the prior art in which the configurator describes the rule descriptions based on subjective understanding; at the same time, by saving the rule descriptions to MySQL, it can assist users in understanding the target rules.

[0084] In one embodiment, the Prometheus indicator use method further includes: saving the target rule to MySQL.

[0085] It should be noted that saving the target rule helps users understand Prometheus indicators.

[0086] In one embodiment, the method for using Prometheus indicators further includes: when the Prometheus triggers the actual demand, sending the target rule and the rule description to a recipient client.

[0087] It should be noted that sending the target rule and the rule description to the recipient client is helpful in assisting the user (ie, the recipient) to understand the second PromQL expression.

[0088] The Prometheus indicator usage method provided in this application can be applied to a variety of scenarios, such as monitoring alarm scenarios; specifically, when Prometheus triggers an alarm (corresponding to the above-mentioned actual needs), the Prometheus indicator usage method includes: receiving an alarm event sent by Prometheus, and generating a corresponding second PromQL expression according to the alarm event; at the same time, pushing the target rule and rule description corresponding to the second PromQL expression to the recipient client.

[0089] The protection scope of the Prometheus indicator usage method described in the embodiment of the present application is not limited to the execution order of the steps listed in the present embodiment. All solutions implemented by adding, reducing, or replacing steps in the prior art based on the principles of the present application are included in the protection scope of the present application.

[0090] An embodiment of the present invention further provides an electronic device, comprising: a processor and a memory; the memory is used to store a computer program; the processor is used to execute the computer program stored in the memory, so that the electronic device executes the above-mentioned Prometheus indicator management method and / or the above-mentioned Prometheus indicator usage method.

[0091] An embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by an electronic device, implements the above-mentioned Prometheus indicator management method and / or the above-mentioned Prometheus indicator use method.

[0092] A person of ordinary skill in the art can understand that all or part of the steps in the method for implementing the above-mentioned embodiment can be completed by instructing a processor through a program, and the program can be stored in a computer-readable storage medium, and the storage medium is a non-transitory medium, such as a random access memory, a read-only memory, a flash memory, a hard disk, a solid-state hard disk, a magnetic tape, a floppy disk, an optical disc, and any combination thereof. The above-mentioned storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or a data center that includes one or more available media. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a tape), an optical medium (for example, a digital video disc (DVD)), or a semiconductor medium (for example, a solid-state disk (SSD)), etc.

[0093] The embodiment of the present application also provides a Prometheus indicator management system, which can implement the Prometheus indicator management method described in the present application. However, the implementation device of the Prometheus indicator management method described in the present application includes but is not limited to the structure of the Prometheus indicator management system listed in this embodiment. All structural deformations and replacements of the prior art made according to the principles of the present application are included in the protection scope of the present application.

[0094] like Figure 4 As shown, in one embodiment, the present invention provides a Prometheus indicator management system, and the Prometheus indicator management system includes:

[0095] The first acquisition module 401 is used to acquire a first PromQL expression corresponding to a Prometheus indicator.

[0096] The second acquisition module 402 is used to parse the first PromQL expression based on OneData and ANTLR to obtain OneData information.

[0097] The generation module 403 is used to generate an indicator name based on a preset naming specification and the OneData information.

[0098] The saving module 404 is used to save the indicator name, the OneData information and the first PromQL expression to MySQL.

[0099] It should be noted that the structures and principles of the first acquisition module 401, the second acquisition module 402, the generation module 403 and the storage module 404 correspond one to one with the steps (steps S101 to S104) in the above-mentioned Prometheus indicator management method, and the specific working principle can also be referred to the introduction of the Prometheus indicator management method in the above-mentioned embodiment, so it will not be repeated here.

[0100] The embodiment of the present application also provides a Prometheus indicator usage system, which can implement the Prometheus indicator usage method described in the present application. However, the implementation device of the Prometheus indicator usage method described in the present application includes but is not limited to the structure of the Prometheus indicator usage system listed in the present embodiment. All structural deformations and replacements of the prior art made according to the principles of the present application are included in the protection scope of the present application.

[0101] like Figure 5 As shown, in one embodiment, the present invention provides a Prometheus indicator using system, wherein the Prometheus indicator is a Prometheus indicator provided by the above-mentioned Prometheus indicator management method; the Prometheus indicator using system includes:

[0102] The first determination module 501 is used to determine the target Prometheus indicator, target operator, target threshold and target logical symbol according to actual needs.

[0103] The configuration module 502 is used to configure the target rule according to the target Prometheus indicator, the target operator, the target threshold and the target logical symbol.

[0104] The second determination module 503 is used to determine a target PromQL expression corresponding to the target Prometheus indicator based on the first PromQL expression.

[0105] The generating module 504 is configured to generate a second PromQL expression corresponding to the target rule based on the target operator, the target threshold, the target logical symbol and the target PromQL expression.

[0106] The sending module 505 is used to send the second PromQL expression to Prometheus to make the target rule effective.

[0107] It should be noted that the structures and principles of the first determination module 501, the configuration module 502, the second determination module 503, the generation module 504 and the sending module 505 correspond one to one with the steps (steps S301 to S305) in the above-mentioned Prometheus indicator usage method, and its specific working principle can also be referred to the introduction of the Prometheus indicator usage method in the above-mentioned embodiment, so it will not be repeated here.

[0108] In the several embodiments provided in the present application, it should be understood that the disclosed system, device or method can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of modules / units is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or units can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules or units, which can be electrical, mechanical or other forms.

[0109] The modules / units described as separate components may or may not be physically separated, and the components displayed as modules / units may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules / units may be selected according to actual needs to achieve the purpose of the embodiments of the present application. For example, the functional modules / units in the various embodiments of the present application may be integrated into one processing module, or each module / unit may exist physically separately, or two or more modules / units may be integrated into one module / unit.

[0110] Those of ordinary skill in the art should further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0111] The descriptions of the processes or structures corresponding to the above-mentioned figures have different emphases. For parts that are not described in detail in a certain process or structure, please refer to the relevant descriptions of other processes or structures.

[0112] The above embodiments are merely illustrative of the principles and effects of the present application and are not intended to limit the present application. Anyone familiar with the technology may modify or change the above embodiments without violating the spirit and scope of the present application. Therefore, all equivalent modifications or changes made by a person of ordinary skill in the art without departing from the spirit and technical ideas disclosed in the present application shall still be covered by the claims of the present application.

Claims

1. A Prometheus indicator management method, characterized in that: The Prometheus indicator management method includes: Get the first PromQL expression corresponding to the Prometheus indicator; Parse the first PromQL expression based on OneData and ANTLR to obtain OneData information; Generate an indicator name based on a preset naming convention and the OneData information; Save the indicator name, the OneData information, and the first PromQL expression to MySQL.

2. The Prometheus indicator management method according to claim 1, characterized in that: The first PromQL expression is written by the indicator owner according to the original indicator.

3. The Prometheus indicator management method according to claim 1 or 2, characterized in that: The preset naming standard is: [Type Label] Statistical Period_Atomic Indicator_Statistical Method_Suffix [Dimension Label] [Business Qualification Label]; [Type label] is used to indicate the type of the Prometheus indicator; The suffix is ​​a unique code corresponding to the first PromQL expression; [Dimension label] is used to indicate the dimension of the Prometheus indicator; [Business limitation label] is used to mark the business limitation of the Prometheus indicator.

4. A method for using Prometheus indicators, characterized in that: The Prometheus indicator is the Prometheus indicator of any one of claims 1 to 3; the method for using the Prometheus indicator includes: Determine the target Prometheus indicator, target operator, target threshold, and target logic operator based on actual needs; Configure target rules according to the target Prometheus indicator, the target operator, the target threshold and the target logical operator; Determine a target PromQL expression corresponding to the target Prometheus indicator based on the first PromQL expression; Generate a second PromQL expression corresponding to the target rule based on the target operator, the target threshold, the target logical symbol, and the target PromQL expression; The second PromQL expression is sent to Prometheus to make the target rule take effect.

5. The method for using Prometheus indicators according to claim 4, characterized in that: The Prometheus indicator usage method further includes: generating a rule description according to the target Prometheus indicator, the target operator, the target threshold and the target logical symbol, and saving the rule description to MySQL; and / or Save the target rules to MySQL.

6. The method for using Prometheus indicators according to claim 5, characterized in that: The Prometheus indicator usage method also includes: when the Prometheus triggers the actual demand, sending the target rule and the rule description to the recipient client.

7. A Prometheus indicator management system, characterized in that: The Prometheus indicator management system includes: The first acquisition module is used to obtain the first PromQL expression corresponding to the Prometheus indicator; A second acquisition module is used to parse the first PromQL expression based on OneData and ANTLR to obtain OneData information; A generation module, used to generate an indicator name based on a preset naming specification and the OneData information; A saving module is used to save the indicator name, the OneData information and the first PromQL expression to MySQL.

8. A Prometheus indicator usage system, characterized in that: The Prometheus indicator is a Prometheus indicator according to any one of claims 1 to 3; the Prometheus indicator using system comprises: The first determination module is used to determine the target Prometheus indicator, target operator, target threshold and target logical symbol according to actual needs; A configuration module, used to configure target rules according to the target Prometheus indicator, the target operator, the target threshold and the target logical operator; A second determination module is used to determine a target PromQL expression corresponding to the target Prometheus indicator based on the first PromQL expression; A generating module, configured to generate a second PromQL expression corresponding to the target rule based on the target operator, the target threshold, the target logical symbol and the target PromQL expression; A sending module is used to send the second PromQL expression to Prometheus to make the target rule take effect.

9. An electronic device, characterized in that: The electronic device comprises: a processor and a memory; The memory is used to store computer programs; The processor is used to execute the computer program stored in the memory, so that the electronic device executes the Prometheus indicator management method according to any one of claims 1 to 3, and / or The method for using the Prometheus indicator according to any one of claims 4 to 6.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by the electronic device, the Prometheus indicator management method according to any one of claims 1 to 3 is implemented, and / or The method for using the Prometheus indicator according to any one of claims 4 to 6.

Citation Information

Patent Citations

  • Internet of Things equipment monitoring index dynamic management and data analysis method and device

    CN114064699A

  • Index data analysis engine, index data calculation device and calculation method

    CN117910850A

  • Enhanced natural language processing with semantic shortcuts

    US20210124736A1