APM Metric Detection¶
Document Scope
This document is the second step in the detection rule configuration process. After configuration is complete, return to the main document to continue to Step 3: Event Notification.
Data scope: Traces (T), used to monitor key APM metric data in the workspace. The system counts the number of traces that meet the conditions within a specified period and triggers an anomaly event when the count exceeds the custom threshold.
Detection Configuration¶
Detection Frequency¶
Set the time interval for running detection.
-
Preset options: 1 minute, 5 minutes, 10 minutes, 15 minutes, 30 minutes, 1 hour
-
Crontab mode: Click "Switch to Crontab mode" to configure a custom interval. Scheduled task execution can be configured based on intervals such as seconds, minutes, hours, days, months, and weeks.
Detection Window¶
Set the data time range queried by each detection (❗️The detection window must be greater than or equal to the detection frequency and must match the actual data reporting interval to avoid missed or false detections).
| Detection Frequency | Detection Window (drop-down options) |
|---|---|
| 30s | 1m/5m/15m/30m/1h/3h |
| 1m | 1m/5m/15m/30m/1h/3h |
| 5m | 5m/15m/30m/1h/3h |
| 15m | 15m/30m/1h/3h/6h |
| 30m | 30m/1h/3h/6h |
| 1h | 1h/3h/6h/12h/24h |
| 6h | 6h/12h/24h |
| 12h | 12h/24h |
| 24h | 24h |
- Custom format: Enter a custom detection window, such as
20m(last 20 minutes),2h(last 2 hours), or1d(last 1 day).
Detection Metrics¶
Set the metrics for detection data. Two detection modes are supported:
-
Service Metrics
-
Trace Statistics
Note
Avoid selecting high-cardinality fields as detection dimensions. Improper configuration or overly broad trigger conditions may cause frequent alerts. The maximum number of records returned by a query is currently 100,000.
Service Metrics¶
Monitor Application Performance Monitoring (APM) services in the current workspace.
| Configuration Item | Description |
|---|---|
| Service | Select an APM service in the current workspace. You can select "All" or a specific service. |
| Metric | The specific detection metric, including: request count, error request count, request error rate, average requests per second, average response time, P50 response time, P75 response time, P90 response time, and P99 response time. |
| Filter Conditions | Filter detection data by metric tags to limit the detection scope. You can add one or more tag filters and use fuzzy match and fuzzy non-match filter conditions. |
| Detection Dimensions | String (keyword) fields in the configuration data can be selected as detection dimensions. Up to three fields can currently be selected. Combining multiple detection dimension fields identifies a specific detection object (for example, {service: svc1, host: host1}). |
| Additional Information | Select field information to display additionally to enrich event content. |
Trace Statistics¶
Counts the number of traces (Spans) that meet the conditions within a specified period and triggers an anomaly event when the count exceeds the custom threshold. This can be used for notifications about abnormal errors in service traces.
| Configuration Item | Description |
|---|---|
| Source | Select the trace data source (service) to count. You can enter keywords to filter. |
| Filter Conditions | Filter traces span by tags to limit the detection data scope. You can add one or more tag filter conditions. |
| Aggregation Algorithm | "*" is selected by default, and the corresponding aggregation function is count (counts the number of Spans). If another field is selected, the aggregation function automatically changes to count distinct (counts the number of data points where the keyword appears, i.e., deduplicated count). |
| Detection Dimensions | String (keyword) fields in the configuration data can be selected as detection dimensions. Up to three fields can currently be selected. Combining multiple detection dimension fields identifies a specific detection object. |
Trigger Conditions¶
Configure trigger conditions and severity levels. When a query returns multiple values, an event is generated if any value meets the trigger conditions.
You can configure four threshold levels (Critical, Major, Minor, and Warning) and the OK recovery condition.
| Level | Configuration | Description |
|---|---|---|
| Critical | When Result >= [value] |
Highest-severity alert, requiring immediate action |
| Major | When Result >= [value] |
High-severity alert, requiring priority handling |
| Minor | When Result >= [value] |
Medium-severity alert, requiring attention |
| Warning | When Result >= [value] |
Low-severity alert, requiring monitoring |
| OK | No event is generated in [N] detections |
If the detection metric triggers a "Critical", "Major", "Minor", or "Warning" anomaly event, and the next N consecutive detections are normal, an "OK" event is generated. This is used to determine whether an anomaly event has recovered. It is recommended to configure this. |
For more information, see Event Severity Levels.
Advanced Options¶
Consecutive Trigger Evaluation¶
When enabled, an event is generated only when the trigger conditions are continuously met, preventing false alerts from momentary fluctuations (❗️The maximum configuration limit is 10 consecutive times).
High-Volume Alert Protection¶
Enabled by default.
When the number of alerts generated by a single detection exceeds the preset threshold, the system automatically switches to a status-based aggregation strategy: instead of processing alert objects one by one, it generates and sends a small number of summary alerts based on event status.
This ensures timely notifications while significantly reducing alert noise and avoiding timeout risks caused by processing too many alerts.
When this switch is enabled, such event details generated after the monitor detects an anomaly will not display history or related events.
Recovery Conditions¶
Configure recovery conditions and severity levels. When a query returns multiple values, a recovery event is generated if any value meets the recovery trigger conditions.
Set independent recovery thresholds for different severity levels to implement downgraded recovery. For example, a Major alert recovers when the value drops below 70, while a Minor alert recovers when it drops below 80.
Default Recovery Logic
When tiered recovery condition configuration is not enabled, recovery occurs automatically by default when the detection result no longer meets the trigger conditions.
No Data¶
Handling strategy when the query result for the detection metric is empty within the detection window:
| Option | Description |
|---|---|
| Do not trigger an event (default) | No alert is generated when there is no data. This applies to scenarios where data absence is allowed. |
| Treat query result as 0 | Empty data is treated as 0 for threshold evaluation. |
| Trigger a no-data event | A no-data event is generated once per data gap round for the same object. After recovery, a new no-data event can be generated if a data gap occurs again. |
| Continuously trigger no-data events | When the same object continuously meets the no-data condition, no-data events are generated at the detection frequency until data recovers. For configuration details, see No Data. |
| Trigger a Critical event | Trigger a Critical-severity event when there is no data. |
| Trigger a Major event | Trigger a Major-severity event when there is no data. |
| Trigger a Minor event | Trigger a Minor-severity event when there is no data. |
| Trigger a Warning event | Trigger a Warning-severity event when there is no data. |
| Trigger a recovery event | Trigger a recovery event when there is no data. |
When trigger conditions, no-data handling, and information generation are configured at the same time, priority is determined as follows: No Data > Trigger Conditions > Information Event Generation.
That is, first determine whether data is missing, then determine whether a threshold is triggered, and finally determine whether to generate an information event.
Information Generation¶
After this option is enabled, you must configure information generation conditions. The system writes an "Info" event only when the detection result does not trigger any of the "Critical", "Major", "Minor", or "Warning" thresholds and meets the information generation conditions.
This applies to scenarios where normal state changes or low-priority information need to be recorded.
Next Steps¶
After completing the detection configuration above, continue with the following:
- Event Notification: Define the event title, content, notification members, no-data handling, and related incidents;
- Alert Configuration: Select an alert policy and set notification targets and mute periods;
- Relate: Relate dashboards for quick navigation to view data;
- Permissions: Set operation permissions to control who can edit or delete this monitor.