Skip to content

Generate Metrics


TrueWatch supports generating new metrics based on existing data within the current workspace, allowing you to design and implement new technical indicators according to your needs.

Warning
  • Roles with Generate Metrics Configuration Management operation permissions can create and edit Generate Metrics;
  • Once metrics are generated, they will be stored according to the current default Data Storage Policy, and charges will be based on the number of Time Series generated;
  • If no data is reported during the period after metrics are generated, they cannot be queried and analyzed in the workspace, such as in Metrics Analysis, Charts, and Query Tools.

Create/Clone Rules

Go to the Logs > 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 space;

Step 2: Data Query: Based on the selected index data, you can filter all/single log data sources in the current space to generate new data, by adding filtering and aggregation expressions to the existing data, requesting to produce new metric results and data sets;

  • Log Source: The log data sources that have been enabled for collection.

    • Note: " * " represents all data sources;
  • Search: Supports filtering log data by keywords;

  • Filter: Supports adding one/multiple filtering conditions to existing tag data, and adding "AND", "OR" relationships to the same line of filtering conditions;

  • Aggregation Methods: See the table below:

Aggregation Method Description
count Count the number
avg Calculate the average, select the field to aggregate
max Calculate the maximum, select the field to aggregate
min Calculate the minimum, select the field to aggregate
P75 Calculate the 75% value of the specified field, select the field to aggregate
P95 Calculate the 95% value of the specified field, select the field to aggregate
P99 Calculate the 99% value of the specified field, select the 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: Set the method and result of generating metrics, including the frequency of generating metrics, the tag name of the newly generated metrics, and the measurement name;

Field Description
Frequency The execution cycle of generating metrics, default is 1 minute, i.e., generate new metrics every 1 minute;
Optional 5 minutes, 15 minutes;
The selected time for frequency also serves as the aggregation time, selecting a frequency of 1 minute means aggregating and generating metrics every 1 minute, and the time range for each aggregation is also 1 minute.
⚠ If the data has a delay of more than 1 minute, the data will not be counted after it is stored.
Time Range Based on the selected frequency as the time interval, the chart defaults to querying for 6 hours, i.e., the statistical display effect of a certain data within 6 hours; when the frequency is modified to >= 1 hour, the query time range is fixed at 7 days.
Measurement Set the name of the measurement where the metrics are stored.
Metric Set the name of the metric, where the metric name cannot be duplicated, and multiple metrics can be added.
Tags Automatically generated based on the dimensions selected in the query.
Unit Optional, set the unit of the metric, after setting the unit for the generated metric, it can be applied in chart queries.
Description Optional, set the description of the metric, after setting the description for the generated metric, it can be applied in chart queries.

Step 4: After completing the generation rule, click OK to complete the generate metrics rule and start data collection.

Operation Instructions

All added rules are displayed in the Generate Metrics interface, and users can perform the following operations:

Edit Rules

In the Generate Metrics page, you can view all created generate metrics rules and edit the generate metrics rules.

Note: Since the data source and aggregation expressions of the generate metrics rules determine the data type, some rules do not support editing and modification.

Enable/Disable Rules

In the Generate Metrics page, you can modify the rule status. When a generate metrics rule is disabled, the corresponding data will not be written to the measurement, and it will resume writing after being enabled.

Delete Rules

In the Generate Metrics page, unnecessary rules can be deleted. After a rule is deleted, the measurement will not be deleted, but data writing will stop.

Batch Operations

You can perform batch operations on specific rules, including enabling, disabling, and deleting rules.

View Metrics

View in Metrics Analysis

In 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 and generated based on the frequency you select and the data within the query time range. If no data is reported during the period, metrics cannot be generated, and they cannot be queried or searched in Metrics.

View in Metrics Management

In 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, and you can edit the metric unit and description.

More Use Cases

Apply in Chart Queries

After metrics are generated, you can go to Scenes > Dashboards > Create Dashboard, and query and analyze metric data in Visual Charts.

Apply in DQL Query Tools

After metrics are generated, you can go to Shortcut > Query Tools > DQL Query to query and analyze metric data.