Generate Metrics¶
TrueWatch supports generating new metric data based on existing data in the current workspace, allowing you to design and implement new technical metrics according to your needs.
Warning
- The ability to create and edit generate metrics requires the Generate Metrics Configuration Management role permission.
- After metrics are generated, they are stored according to the default Data Storage Policy and billed based on the resulting number of time series.
- If no data is reported during the generation period, the generated metrics cannot be queried or analyzed in the workspace, such as in Metrics Analysis, Charts, or DQL Query Tool.
Create / Clone a Rule¶
Go to APM > Generate Metrics.
- Click Create Rule 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. Select all or a single service data source available in the current workspace, and generate new data based on this data source.
- Source: The data source, i.e., a service data source for which collection is enabled. Note: "*" means all data sources.
Step 2: Data Query. Based on the selected data source, you can add filters and aggregation expressions to the existing data to generate new metric results and data sets.
- Aggregation Method: See the table below.
| Aggregation Method | Description |
|---|---|
| count | Count |
| avg | Average, requires selecting a field |
| max | Maximum, requires selecting a field |
| min | Minimum, requires selecting a field |
| P75 | 75th percentile of the specified field, requires selecting a field |
| P95 | 95th percentile of the specified field, requires selecting a field |
| P99 | 99th percentile of the specified field, requires selecting a field |
- Dimensions: Aggregate data by the selected objects, i.e., generate a statistic for each selected object in the data request.
- Filter: Add one or more filter conditions to the existing tag data, and combine conditions on the same row with AND or OR logic.
Step 3: Generate Metrics. Configure the method and result of metric generation, including the generation frequency, the name of the new metric, and the measurement name.
| Field | Description |
|---|---|
| Frequency | The execution interval for generating metrics. Default is 1 minute, meaning new metric data is generated every minute. The selected frequency also serves as the aggregation interval. For example, if the frequency is 1 minute, metrics are aggregated and generated every 1 minute, and the aggregation time range is also 1 minute. |
| Measurement | Set the name of the measurement where the metrics will be stored. |
| Metric | Set the metric name. Metric names must be unique. You can add multiple metrics. |
| Tags | Automatically generated based on the dimensions selected in the query. |
| Unit | Optional. Set the unit for the metric. Once set, the unit can be applied in chart queries. |
| Description | Optional. Set the description for the metric. Once set, the description can be applied in chart queries. |
Step 4: After completing the rule configuration, click Confirm to create the generate metrics rule and start data collection.
Actions¶
All created rules are displayed on the Generate Metrics page, where users can perform the following operations:
Note:
-
Because the data source, aggregation expressions, etc., of the generate metrics rule determine the data type, some rules cannot be edited or modified.
-
When a generate metrics rule is disabled, the corresponding data will not be written to the measurement. Writing resumes when the rule is re-enabled.
-
When a rule is deleted, the measurement is not deleted, but data writing stops.
View Metrics¶
View in Metrics Analysis¶
On the Generate Metrics page, click the Open in Metrics Analysis button on the right side of the rule to jump to the Metrics Analysis page for querying and analysis.
Note: Generate metrics are aggregated based on the frequency you select and the data within the query time range. If no data is reported during that period, no metrics are generated, and they cannot be queried or searched in Metrics.
View in Metrics Management¶
On the Generate Metrics page, click the Open in Metrics Management button on the right side of the rule to jump to the Metrics Management page to view metrics and tags. You can also edit the metric unit and description.
Use Cases¶
Chart Query¶
After metrics are generated, you can query and analyze them in visual charts by going to Scenarios > Dashboard > Create Dashboard and using the Visual Charts.
DQL Query Tool¶
After metrics are generated, you can query and analyze them via Shortcut > Query Tool.





