Generate Metrics¶
Guance supports generating new metric data based on existing data within the current workspace, allowing you to design and implement new technical metrics according to your needs.
Warning
- Roles with the Generate Metrics Configuration Management operation permission can create and edit Generate Metrics;
- After metrics are generated, they will be stored according to the current default Data Storage Policy and billed based on the number of Time Series generated;
- After metrics are generated, if no data is reported during a period, they cannot be queried and analyzed in the workspace, such as querying metric data in Metric Explorer, Dashboards, or Query Tools.
Create/Clone Rule¶
Go to the Log > Generate Metrics page,
-
Click the Create button to start creating a new Generate Metrics rule;
-
Click the icon to clone an existing rule and create a new one.
Step 1: Data Source: Filter all existing Index data in the current workspace;
Step 2: Data Query: Based on the selected index data, you can filter all/single log data sources in the current workspace to generate new data. By adding filters and aggregation expressions to the existing data, new metric results and data sets are produced;
-
Log Source: Refers to the log data sources that have been enabled for collection.
- Note: " * " represents all data sources;
-
Search: Supports filtering log data by keyword;
-
Filter: Supports adding one/multiple filter conditions to existing tag data, and adding "AND" or "OR" relationships to conditions on the same line;
-
Aggregation Method: See the table below:
| Aggregation Method | Description |
|---|---|
| count | Count the number of occurrences |
| avg | Calculate the average value, requires selecting a field to aggregate |
| max | Calculate the maximum value, requires selecting a field to aggregate |
| min | Calculate the minimum value, requires selecting a field to aggregate |
| P75 | Calculate the 75th percentile value of the specified field, requires selecting a field to aggregate |
| P95 | Calculate the 95th percentile value of the specified field, requires selecting a field to aggregate |
| P99 | Calculate the 99th percentile value of the specified field, requires selecting a field to aggregate |
- Dimensions: Aggregate data according to the selected objects, i.e., generate a statistical value for each selected object in the data request
Step 3: Generate Metrics: Configure the method and result of generating metrics, including the generation frequency, the tag name of the newly generated metrics, and the Measurement name;
| Field | Description |
|---|---|
| Frequency | The execution cycle for generating metrics, default is 1 minute, meaning new metric data is generated every 1 minute; Options include 5 minutes, 15 minutes; The selected time for frequency also serves as the aggregation time. Choosing a frequency of 1 minute means metrics are aggregated and generated every 1 minute, and each aggregation covers a time range of 1 minute. ❗️ If data has a delay of more than 1 minute, it will not be counted after being stored. |
| Time Range | Based on the selected frequency as the time interval, the chart defaults to querying a 6-hour range, showing the statistical effect of data within 6 hours; when the frequency is modified to >= 1 hour, the query time range is fixed to 7 days. |
| Measurement | Set the name of the Measurement where the metrics will be stored. |
| Metrics | Set the names of the metrics. Metric names cannot be duplicated. Multiple metrics can be added. |
| Tags | Automatically generated based on the dimensions selected in the query. |
| Unit | Optional. Set the unit for the metric. After setting the unit for a generated metric, it can be applied in chart queries. |
| Description | Optional. Set a description for the metric. After setting the description for a generated metric, it can be applied in chart queries. |
Step 4: After completing the generation rule, click Confirm to finish creating the Generate Metrics rule and start data collection.
Operation Instructions¶
All added rules are displayed on the Generate Metrics interface. Users can perform the following operations:
Edit Rule¶
On the Generate Metrics page, you can view all created Generate Metrics rules and edit them.
Note: Since the data source and aggregation expressions of a Generate Metrics rule determine the data type, some rules do not support editing and modification.
Enable/Disable Rule¶
On the Generate Metrics page, you can modify the rule status. After a metric generation rule is disabled, the corresponding data will not be written to the Measurement. Data writing resumes after the rule is enabled.
Delete Rule¶
On the Generate Metrics page, unnecessary rules can be deleted. After a rule is deleted, the Measurement is not deleted, but data writing stops.
Batch operations¶
You can perform batch operations on specific rules, including enabling, disabling, and deleting rules.
View Metrics¶
View in Metric Explorer¶
On the Generate Metrics page, click the Open in Metric Explorer button on the right side of a rule to jump to the Metric Explorer page for query and analysis.
Note: Generate Metrics aggregates data within the query time range according to the selected frequency to generate metrics. If no data is reported during a period, metrics cannot be generated and cannot be queried or searched in Metrics.
View in Metric Management¶
On the Generate Metrics page, click the Open in Metric Management button on the right side of a rule to jump to the Metric Management page to view metrics and tags. You can edit the metric unit and description.
More Use Cases¶
Apply in Chart Query¶
After metrics are generated, you can go to Scene > Dashboards > New Dashboard and query and analyze metric data in Visual Charts.
Apply in DQL Query Tool¶
After metrics are generated, you can query and analyze metric data in Shortcut > Query Tools > DQL Query.





