Skip to content

Detection Rules


The system provides a rich set of built-in detection rules that precisely match the monitoring requirements of various types of data, effectively avoiding false alerts and missed alerts.

Configuration Process

Creating a Monitor requires completing the configuration in the following order:

  1. Select a rule type: determines the data scope and algorithm logic of the detection configuration;
  2. Detection Configuration: different types have different configuration items;
  3. Event Notification: define the event title, content, associated information, and No Data event content;
  4. Alert Configuration: set notification policies and Mute periods;
  5. Association: configure dashboard association;
  6. Permissions: set operation permissions.

Except for Detection Configuration, which changes with the rule type, the configuration logic for event notification, alert configuration, association, and permissions is the same across all rule types.

Rule Type

You can select the detection logic that suits your monitoring goal:

Rule Name
Data Scope
Description
Threshold Detection All Detects anomalies in metric data based on configured thresholds
Mutation Detection Metric (M) Detects sudden abnormal behavior of metrics based on historical data; mostly suitable for business data and scenarios with short time windows
Interval Detection Metric (M) Detects abnormal metric data points based on a dynamic threshold range; mostly suitable for time series with stable trends
Interval Detection V2 Metric (M)
Trace (T)
RUM Data (R)
Detects abnormal metric data points based on a dynamic threshold range; mostly suitable for time series with stable trends
Outlier Detection Metric (M) Detects whether the metrics/statistics of detection objects under a specific group have outlier deviations
Log Detection Log (L) Detects business application anomalies based on log data
Process Anomaly Detection Process Object (O::host_processes) Periodically detects process data to identify process anomalies
Infrastructure Liveness Detection V2 Object (O) Based on infrastructure object data, sets liveness conditions to monitor infrastructure stability
APM Metric Detection Trace (T) Based on Application Performance Monitoring (APM) data, sets threshold rules to detect anomalies
RUM Metric Detection RUM Data (R) Based on Real User Monitoring (RUM) data, sets threshold rules to detect anomalies
Composite Detection All Combines the results of multiple Monitors into one Monitor through expressions and alerts based on the combined result
Synthetic Testing Anomaly Detection Synthetic Data (D::类型) Based on Synthetic Monitoring data, sets threshold rules to detect anomalies
Network Data Detection Network (N) Based on network data, sets threshold rules to detect network performance stability
External Event Detection Other Generates event data after third-party systems send abnormal events or records to an HTTP server as POST requests to a specified URL
Infrastructure Change Detection Object (O) Based on infrastructure lifecycle tracking, monitors various change activities and accurately identifies anomalies such as configuration drift and unauthorized operations
Programmable Detection All Uses scripts to write detection rules; mostly suitable for complex monitoring scenarios with frequently changing rules

After selecting a rule type, the available parameters in the Detection Configuration module change accordingly. Event notification and subsequent configurations remain consistent across all types.

Detection Configuration

You can configure the detection frequency, detection interval, and detection metric for different detection rule types.

Detection configurations vary significantly by rule type. Refer to the detailed configuration documentation for the corresponding type.

No Data

No Data means that no data has been queried for an identified detection object for a sustained period. For Monitors that provide a No Data handling action, you can select an action, enter the No Data duration, and save the setting under Detection Configuration > No Data; the setting is used for subsequent detection.

To generate No Data events, you can choose one of the following methods:

Handling Action Event Generation Method
Trigger No Data event For the same object, an event is generated once per No Data occurrence. If the object recovers and then enters No Data again, a new event can be generated. This suits scenarios where each No Data occurrence is recorded as one anomaly.
Continuously trigger No Data events When the same object continuously meets the No Data condition, events are generated at the detection frequency until data recovers. This suits continuous tracking of objects that remain in No Data.

The No Data Duration determines when triggering starts, and the Detection Frequency determines the subsequent detection and the generation cadence of continuous events. For example, if the No Data Duration is set to 10 minutes and the Detection Frequency is set to 5 minutes, then after the 10-minute No Data condition is met, an event is generated each time a subsequent detection still meets the condition. Each detection object is evaluated separately; if the object recovers and then enters No Data again, a new round of processing starts.

The continuous mode is independent of Enable Consecutive Trigger Evaluation: the latter still controls the number of consecutive times the threshold condition must be met. When creating a Monitor, Do Not Trigger Events is selected by default; existing Monitors continue to execute the saved action.

After an event is generated, actual notifications are determined by the associated Alert Policy and Mute configuration. You can control the repeated notification interval through Repeat Alerts; During Mute, events continue to be recorded, and corresponding notifications are suppressed according to Mute rules.

Data Waiting Window

The Data Waiting Window applies to all Monitor types. After the scheduled execution time is reached, the Monitor first waits for the specified duration before performing detection evaluation, reducing the possibility of false alerts caused by data latency.

  • The default value is No Wait;
  • Available waiting durations are 1 minute, 2 minutes, 3 minutes, 5 minutes, 10 minutes, 15 minutes, and 30 minutes;
  • The waiting duration must be shorter than the interval between two adjacent scheduled execution times; otherwise, the Monitor cannot be saved, and the message “The Data Waiting Window must be shorter than the Monitor execution interval” is displayed. Crontab mode is also validated against adjacent scheduled execution times.

For example, if a Monitor is scheduled to run at 10:00 and the Data Waiting Window is set to 5 minutes, the task starts at approximately 10:05. Waiting only delays the execution time and does not change the query time range; if the detection interval is the last 1 hour, data from 09:00 ~ 10:00 is still queried.

For detailed execution logic, refer to Monitor Internal Principles.

Streaming Aggregation Acceleration

Streaming aggregation speeds up Monitor queries. When enabled, the system automatically selects a query strategy and uses streaming aggregation when conditions are met; when disabled, detection uses the original query path. If historical data backfill exists for cloud integration metrics, we recommend disabling acceleration.

When creating or editing a standard Monitor, an AI Intelligent Monitor, or an AI Monitor, you can select the acceleration method at the end of Detection Configuration. The setting is used for subsequent detection after being saved.

Configuration Method Effective Rule
Follow Workspace Configuration (default) Uses the current setting in Management > Workspace Settings > Monitor Streaming Aggregation Acceleration. After the workspace configuration is changed and saved, existing Monitors automatically follow it in subsequent detection without needing to be saved again one by one.
Configure Individually Enable or disable independently for the current Monitor, with priority over the workspace configuration. For example, after the workspace setting is disabled, an individually enabled Monitor still queries according to the automatic strategy.

After a Monitor that follows the workspace is imported into another workspace, the target workspace's current settings are used.

Disabling acceleration may increase query time. This setting only controls the detection query path; when historical data is subsequently updated, the alert value and the results of a later retrospective query may still differ.

Event Notification

Defines the event title, content, notification members, and associated handling generated when a Monitor is triggered.

Event Title

Defines the event name for the alert trigger condition; preset template variables can be used.

Note

In the latest version, the Monitor name is generated synchronously after the event title is entered. In older Monitors, the Monitor name and event title may be inconsistent. We recommend syncing to the latest version.

Event Content

Write the event notification content. When the trigger condition is met, the system sends this content externally. It generally includes the following:

Event content supports syntax validation and template preview, allowing you to check variable and conditional branch rendering before saving.

Click + Link, and the system automatically generates a jump link based on the current detection metric. The link URL contains the current domain, Workspace ID, detection time range ({{df_check_range_start}} ~ {{df_check_range_end}}), and dynamic filtering conditions.

Link Type Description Configuration Requirement
Custom Link Supports any URL and allows template variables Enter the complete link URL manually
View Related Logs Go to Log Explorer Generated automatically; filtering conditions and time range can be adjusted after insertion
View Related Traces Go to Trace Explorer Generated automatically; automatically associates the current trace_id or service name
View Related Profile Go to Profile Explorer Generated automatically; automatically fills in the service name and time range
View Related Containers Go to container object details Generated automatically; automatically matches the container name and Host tags
View Related Pod Go to Pod object details Generated automatically; automatically fills in the Pod name and namespace
View Related Processes Go to process object details Generated automatically; automatically matches the Host and process name
View Related Session Go to RUM Session Replay Generated automatically; automatically fills in the Session ID
View Related View Go to RUM View Explorer Generated automatically; automatically fills in the view path
View Related Error Go to RUM Error Explorer Generated automatically; automatically fills in the error type and time range
View Related Resource Go to RUM Resource Explorer Generated automatically; automatically fills in the resource path
View Related Synthetic Monitoring Go to Synthetic Test details Generated automatically; automatically associates the Synthetic Test name
View Related Dashboard Go to the specified dashboard Manually add the Dashboard ID and name; supports adjusting view variables and time range

Link format examples:

Log Explorer: [View Related Logs](<{{STUDIO_CONSOLE_BASE_URL}}/logIndi/log/all?time={{df_check_range_start}},{{df_check_range_end}}&w={{df_workspace_uuid}}>)

Trace Explorer: [View Related Traces](<{{STUDIO_CONSOLE_BASE_URL}}/tracing/link/all?time={{df_check_range_start}},{{df_check_range_end}}&w={{df_workspace_uuid}}>)

Template Variables

Click + Variable to insert preset template variables. Variables are dynamically replaced with actual values when an event is triggered:

Variable Description
{{df_dimension}} Detection dimension object
{{df_monitor_checker_name}} Current Monitor name
{{df_monitor_name}} Name of the associated Alert Policy
{{Result}} Detection result value
{{df_status}} Event status (error/warning/ok)
{{df_event_id}} Unique event identifier

Click to view all supported template variables.

Advanced Configuration

Use Advanced Configuration to embed related data context into events through DQL.

1. Add Related Logs

Clicking it automatically generates the following template:

{% set dql_data = DQL("L::RE(`.*`):(`message`) { `index` = 'default' } LIMIT 1") %}
{{ dql_data.message | limit_lines(10) }}

Configuration points:

  • Replace {index= 'default' } with the actual index name

  • RE(``.*``) supports regular expression matching, for example RE(``error\|exception``)

  • limit_lines(10) limits the number of output lines to keep notifications from becoming too long

2. Add Related Error Stacks

Clicking it automatically generates the following template:

{% set dql_data = DQL("T::re(`.*`):(`error_message`,`error_stack`){ (`source` NOT IN ['service_map', 'tracing_stat', 'service_list_1m', 'service_list_1d', 'service_list_1h', 'profile']) AND (`error_stack` = exists()) } LIMIT 1") %}
{{ dql_data.error_message | limit_lines(10) }}
{{ dql_data.error_stack | limit_lines(10) }}

Configuration points:

  • source NOT IN [...] excludes statistical aggregate data and retains only raw traces

  • (error_stack= exists()) ensures that errors containing stack information are returned

Notification Members (@)

Click to select Workspace members.

Effective logic:

  1. The @ member configuration takes effect and sends the event content here to the specified members only when Associate Incidents is enabled;
  2. This configuration is independent of the notification targets in Alert Configuration and does not affect the alert notification scope.
Custom Notification Content

By default, the system uses Event Content as the alert notification content. If you need to customize the notification actually sent externally, you can enable the switch here and enter the notification information.

  • Expands a separate editor where the notification content sent externally can be defined independently;
  • The original event content is still retained in the platform for event details display;
  • The separate editor also supports Markdown, template variables, associated links, and advanced configuration.

No Data Events

This is the customized notification content for No Data (no data reported). You can also configure the title, content, and other information ultimately sent externally for such events.

If not customized, the system uses the official default template to send No Data alerts.

Custom No Data event content also supports syntax validation and template preview; the preview uses the currently entered No Data title and content.

Associate Incidents

After association is enabled, if an abnormal event is generated under this Monitor, an Incident is created synchronously.

Configuration Items
  1. Add tags to automatically created Incidents to facilitate classification and filtering in the Incident Center;
  2. Configure the mapping between event severity and Incident severity; multiple rules can be added.

    • When an event of Fatal/Critical/Important/Warning/No Data severity is generated, a new Incident with severity P0/P1/P2/P3/... is created synchronously.

Incidents created here can be viewed in the Incident Center (❗️such Incidents include tag filtering conditions).

Linkage Mechanism
  1. When an event is triggered, an Incident record is automatically created in the Incident Center, and the Incident description is automatically synchronized with the event content;
  2. Send a new Incident notification according to the @ member list in the event content;
  3. You can view Incident details in the Incident Center. The system automatically associates and displays full-stack data related to the Incident (performance metrics, error logs, call traces, infrastructure topology, etc.).

Alert Configuration

After a Monitor meets the trigger condition, it immediately sends an alert message to the specified notification targets.

Alert Policy

Select created Alert Policies; multiple selection is supported. Click the policy name to expand details, and click Edit Alert Policy to modify the configuration:

Configuration Item Description
Notification Configuration Shows the notification target groups bound to the policy (such as All, etc.)
Repeat Alerts The same event does not send repeated alert notifications within the specified time (for example, 10 minutes)
Alert Aggregation Aggregation method, such as AI aggregation
Aggregation Period New events within the specified time (for example, 5 minutes) are aggregated into one alert notification. After the period ends, new events are aggregated into a new alert notification

Association

Select a created dashboard to establish an association between the Monitor and the dashboard, enabling quick navigation and visual viewing of monitoring data.

Permissions

Set the operation permissions for the Monitor to ensure that different users can perform operations that match their roles and permission levels. The Owner of the current Workspace is not affected by the operation permission configuration here.

  • If this configuration is disabled: follows the default permissions of "Monitor Configuration Management";
  • If enabled and custom permission objects are selected: only the creator and objects granted permissions can enable/disable, edit, and delete the rules set for this Monitor;
  • If enabled but no custom permission objects are selected: only the creator has permission to enable/disable, edit, and delete this Monitor.

In addition, the Workspace Owner can use Unified Permission Management Configuration to grant Monitor operation permissions to administrators, roles, or members in a unified manner. Authorized objects can operate all Monitors with custom operation permissions enabled, without needing to be added one by one to each Monitor's custom permission objects.

Trigger Detection Now

After the rule configuration is complete, click Trigger Detection Now to manually run a test and verify the overall effect of the current rule configuration. Test execution does not generate actual alert notifications.

Alert Cache Protection Mechanism

After configuration is complete, the Monitor executes the following protection policies during operation. The system uses the following mechanisms to prevent system pressure caused by excessive detection objects generated by high-cardinality aggregation:

Stage Trigger Condition System Behavior
Threshold Warning The number of detection objects reaches 80% of the system limit (80,000) Triggers a system notification (at most once per day) to remind you to check the query conditions and grouping settings
Limit Exceeded Protection The number of detection objects reaches the system upper limit of 100,000 Automatically pauses the Monitor and sends a notification; execution stops during the pause

The alert cache limit is 100,000 records, and the warning threshold is 80%.

Pause and Recovery Mechanism

After a Monitor is paused by the system because the alert cache limit is exceeded, perform any of the following operations to recover automatically:

  • Modify the query conditions and save the Monitor again

  • Save the Monitor again directly

The system automatically clears the alert cache flag and resumes normal Monitor operation; no additional operations are required.

Further Reading

After a Monitor rule is created successfully, you may need to:

Feedback

Is this page helpful?