Skip to content

Generate Metrics


Generate new metric data from existing data within the current workspace, thereby designing and implementing new technical metrics based on actual business requirements.

Note
  • Only roles with "Generate Metrics Configuration Management" permission can create and edit metrics.
  • After metrics are generated, they will be stored according to the current default data storage policy, and charges will be incurred based on the number of generated time series.
  • If no data is reported after generating metrics, they cannot be queried or analyzed within the workspace.
What Problems Can It Solve for You?

Scenario 1: Extract Business Metrics from Logs

Business logs contain key business data (such as order amounts, error codes) that need to be transformed into monitorable metrics. By generating metrics, you can select a log data source, configure query conditions to filter target logs, extract fields to generate metrics (e.g., error log count, average response time), and group them by business dimensions (e.g., service, interface, status code).

Scenario 2: APM Data Aggregation

Generate service SLA metrics based on APM trace data. Select an APM data source, group statistics by service and interface, calculate metrics like P99 latency, error rate, throughput, etc., generate them periodically for continuous monitoring.

Scenario 3: Resource Usage Statistics

Count Kubernetes cluster resource usage. Select a basic object or Resource Catalog data source, group by cluster, namespace, node, count Pod numbers, resource requests/limits, etc., to generate resource utilization metrics.

Scenario 4: Multi-source Data Fusion

Combine multiple data sources to generate composite metrics. Create separate generation rules, and generate new metrics based on the generated metrics to build a complex business monitoring system.

Application Scope

LOG, APM, RUM, Metrics, Synthetic Tests, Basic Objects, Resource Catalog.

Create

  1. Select a data source.
  2. Configure data query conditions.
  3. Define the generated metric content, setting the method and results for generating metrics, including the generation frequency, the tag names, and the measurement name for the newly generated metrics.

Data Query

Metric data additionally supports PromQL queries. Apart from that, other data types support both simple queries and DQL queries.

For more details, refer to Chart Query.

Aggregation Functions

Function Description
count Count the number of items.
avg Calculate the average value, requires selecting a field to aggregate.
max Find the maximum value, requires selecting a field to aggregate.
min Find 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, meaning a statistical value is generated for each selected object in the data request.

Generated Metric Content

  1. Frequency: The execution cycle for generating metrics. The selected time for frequency also serves as the aggregation window. 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.

    • 1 minute (default, i.e., generate new metric data every 1 minute)
    • 5 minutes (default selection when the data type is "Basic Objects" or "Resource Catalog")
    • 15 minutes
  2. Measurement: Set the name of the measurement where the metrics will be stored.

  3. Metric: Set the name of the metric. Metric names can be duplicated, and multiple metrics can be added.

  4. Tags: Automatically generated based on the dimensions selected in the query.

  5. Unit: Optional. Set the unit for the metric. Once set for a generated metric, it can be applied in chart queries.

  6. Description: Optional. Set a description for the metric. Once set for a generated metric, it can be applied in chart queries.

After completing the form, click Confirm to finish creating the metric generation rule and start data collection.

Note

If data has a delay of more than 1 minute, it will not be counted after being stored.

Manage List

  • Edit: View all created metric generation rules and edit them.

  • Enable/Disable: Modify the rule's status. When a metric generation rule is disabled, the corresponding data will not be written to the measurement. Writing resumes after enabling.

  • Delete: Remove unnecessary rules. After a rule is deleted, the measurement is not deleted, but data writing stops.

  • Batch operations: Perform batch operations on specific rules, including enabling, disabling, deleting, and exporting rules.

  • Import: Import metric generation data.

  • View Metrics

    • View in Metric Explorer: Jump to the Metric Explorer page for query and analysis.

    • View in Metric Management: Jump to the Metric Management page to view metrics and tags. You can edit metric units and descriptions.

Note
  • Since the data source and aggregation expressions of a metric generation rule determine the data type, some configurations do not support editing and modification.
  • Generated metrics are aggregated from data within the selected frequency and query time range. If no data is reported during that period, metrics cannot be generated, nor can they be queried or searched in metrics.

Use Cases

Chart Query

Query and analyze metric data in Visual Charts.

Query Tool

Query and analyze metric data in Shortcut > Query Tool > DQL Query.