Skip to content

Create Auto-Discovery Configuration



POST /api/v1/issue_auto_discovery/add

Overview

Create an Issue auto-discovery configuration based on event aggregation.

Prerequisites and Usage Steps

This module is the former Incident Issue auto-discovery configuration. It is not Incident Center Incidents scheduling/auto-aggregation, nor is it an ErrorTrack rule in the error center. Currently, the only public write value for dqlNamespace is keyevent; legacy rum/tracing examples do not match the current declaration. Workspaces that have been migrated in the backend with issueUpgrade=true skip this v2 auto-discovery task, so a successful configuration cannot be taken as a promise that new Issues will be generated in that workspace.

Permissions must match one of trace.issueDiscovery/rum.issueDiscovery/anomaly.issueDiscovery. The rule name and the config.name of the generated Issue are two separate fields. every supports only 300/600/900/1800/3600; although 60 appears in the legacy enumeration, it is rejected by the preceding minimum value. For dimensions, explicitly provide non-empty field names; for config, explicitly provide description, channelUUIDs, and extend.text. Otherwise, even after a successful save, the task may still fail due to missing keys or invalid queries.

Rule names are unique within a workspace, but there is no idempotency key; when the result is unknown, first query by name and content, and do not create duplicates.

config.extend.manager is normalized, and unknown accounts/targets may be silently removed. Although the declaration allows an explicit null, current auditing/processing calls .get directly, which causes a 500, so do not pass it. Using dutyPerson uses the former Incident notification schedule, not Incident Center scheduling. {{variables}} are replaced only by word keys of grouping tags/aggregated count; unknown variables are kept as-is, and no arbitrary template code is executed.

Saving a configuration does not immediately execute a query or return a generated task; the schedule aligns to the Asia/Shanghai calendar cycle and processes the previous every-second window, and task queue/query time may delay it. keyevent aggregates monitor events and produces at most 1000 groups by dimensions; complete coverage over a wide range is not guaranteed. The sorted JSON of grouping dimensions generates the deduplication identity, and the rule UUID does not participate in that identity, so multiple rules in the same workspace with the same dimension values may be associated with the same existing Issue, and changing dimensions/filters may change grouping results; do not treat it as a per-rule Issue set that never intersects. Open/Pending Issues get appended replies, Resolved ones may be reopened and regress, and Closed ones are not reused; legacy Working branches are handled per the actual implementation, and complete isolation while in progress is not guaranteed. Notifications are asynchronous, and HTTP 200 does not mean the data query succeeded, a new Issue was generated, or the notification was delivered.

Request Headers

Parameter Type Required Description
DF-API-KEY string Y OpenAPI authentication credential for the workspace.
Example: <DF-API-KEY>
How to obtain or fill in: Obtain an OpenAPI Key with the required permissions from the API Key management of the target workspace.

Body Request Parameters

Parameter Type Required Description
dimensions[*] string A single field name string; the source declaration does not constrain items; non-string values cause a 500 when concatenating synchronous audit data: add usually fails before submission, while modify may fail after the first round of submission. If it is a string but the field does not exist, the backend query may fail or return no data. Do not use backticks or full query fragments as field names.
Example: service
How to obtain or fill in: An event field/tag name; make sure all target data has this field.
config.channelUUIDs[*] string A single active channel UUID; it is not a dimension field/team UUID, and an unknown or disabled one returns 404.
Example: chan_example
How to obtain or fill in: The uuid in the current workspace channel quick list.
config.extend.text string An explicit string is recommended. The task reads it and performs template replacement; missing values or non-string values may fail asynchronously; both it and config.description are separately stored text fields.
Example: 服务{{service}}发现{{count}}条事件
How to obtain or fill in: Build the Issue body template from the dimensions tags and the aggregated count.
config.extend.manager array Optional string array of assignees. Valid acnt_/team in this workspace/email/dutyPerson values are retained; unknown accounts/unknown values may be silently removed, and per-item errors are not guaranteed. Free/Free Plan workspaces do not support external emails and may return 400. Missing assignees may enter the unassigned escalation flow.
Example: []
How to obtain or fill in: Get acnt_ from Workspace Members and group_ from Team List; or use a member/allowed external email. To use the former Incident on-call person of today, use the literal value dutyPerson, configured in Notification Schedules.
config.extend.manager[*] string One valid subject, email, or dutyPerson; non-string values may cause a 500 during string startswith processing.
Example: acnt_example
How to obtain or fill in: Get acnt_ from Workspace Members and group_ from Team List; or use a member/allowed external email. To use the former Incident on-call person of today, use the literal value dutyPerson, configured in Notification Schedules.
config.extend.conditionsInputFilters any Optional arbitrary JSON, used to supplement filter display when navigating from historical Issues/notification events; the actual query still uses the top-level conditions, and you cannot replace it by changing only this key.
Example: {}
How to obtain or fill in: The display structure can be provided by the Incident condition editor.
config.extend.variable json Not recommended to be filled in requests; the task overwrites this object with the actual query columns, and count is usually the number of records in the window.
Example: {"count": 8}
How to obtain or fill in: The aggregation variables are calculated at runtime when the task is generated.
config.extend.variable.count integer Runtime occurrence count; caller input does not take effect as a reliable fixed value.
Example: 8
How to obtain or fill in: The backend calculates it with a count(*) query for this window.
config.extend.tags json Not recommended to be filled in requests; the task overwrites it with actual grouping tags, which participate in Issue deduplication and template variables.
Example: {"service": "payment"}
How to obtain or fill in: The generated task obtains them from the grouping tags.
config.extend.tags.字段 any Dynamic JSON tag value; caller-supplied values cannot force fixed generation of groups.
Example: payment
How to obtain or fill in: Comes from the event tag value corresponding to dimensions.
config.extend.channelUUIDs array Overwritten at runtime with the valid configured channels; do not use this extension field instead of config.channelUUIDs.
Example: []
How to obtain or fill in: The task writes it after filtering the currently valid channels by config.channelUUIDs.
config.extend.channelUUIDs[*] string One runtime valid channel identifier.
Example: chan_example
How to obtain or fill in: A valid channel uuid in the current workspace.
config.extend.自定义键 any Any JSON value is saved; there is no additional execution guarantee publicly documented on this page; do not put credentials in it.
Example: value
How to obtain or fill in: Caller-defined extension for business display.
name string Y Required string of up to 256 characters; the declaration does not enforce non-empty, but non-empty is recommended. Names of undeleted rules in the same workspace must be unique. Still required on modification; this is the rule name, not the generated Issue title.
Allowed null: False
Maximum length: 256
Example: 生产事件自动发现
How to obtain or fill in: The maintainer fills in a rule name that is unique within the workspace.
description string Optional string; empty is allowed. Omit to leave empty on creation, omit to keep on modification, explicitly empty to clear; it is not used as the Issue body template.
Allowed null: False
Empty string allowed: True
Example: 按服务聚合生产告警
How to obtain or fill in: The caller fills in the rule purpose description.
dqlNamespace string Y Required; the only public enum value is keyevent; it is not rum/tracing, and you must not pass other values just because legacy entities/examples allowed them.
Allowed null: False
Available values: ['keyevent']
Example: keyevent
How to obtain or fill in: Currently the public usage is fixed to the keyevent event scope.
every integer Y Required integer; only 300/600/900/1800/3600 are allowed. Although the legacy enumeration includes 60, the minimum value 300 also applies, so 60 returns 406 on the public route and 1 minute cannot be selected.
Allowed null: False
$minValue: 300
$maxValue: 3600
Available values: [60, 300, 600, 900, 1800, 3600]
Example: 300
How to obtain or fill in: Choose the cycle in seconds based on discovery latency and query volume.
conditions string Optional string containing only a filter expression, not a complete DQL/JSON statement. Omit to leave empty on creation; omit to keep and empty to clear on modification; currently the value is saved without parsing DQL, so syntax/field validity is not guaranteed, and an asynchronous task failure is not turned into an error for this API call. Entity columns are 48 characters and the declaration has no length limit, so keep expressions short and have the administrator confirm the deployment column limit.
Allowed null: False
Empty string allowed: True
Example: `df_status` = 'error'
How to obtain or fill in: Build the DQL filter condition from real fields of the target monitor events; you can verify it first with the query tool using the same time range.
dimensions array Optional array; when present, it must contain at least one item. Although omitting it on creation saves [], the by statement built by the task may be invalid, so always provide non-empty real fields. Omit to keep on modification; [] is rejected with 406 in the pre-check and cannot be used to clear. These are field names rather than channel UUIDs; field order/set affects the grouping query, and df_label is aggregated by set.
Allowed null: False
Minimum length: 1
Example: ["service"]
How to obtain or fill in: Select field names used for grouping deduplication from the actual event tag fields, such as service, host, or df_label.
config json Y Required object; each modification replaces it entirely without recursive merge; only the five declared keys name/level/channelUUIDs/description/extend are allowed. For reliable subsequent task execution, explicitly provide description, the channelUUIDs array, the extend object, and the extend.text string even though they are optional; missing values may save successfully but fail the task.
Allowed null: False
Example: {"name": "服务{{service}}告警", "description": "本窗口{{count}}条事件", "channelUUIDs": [], "extend": {"text": "服务{{service}}发现{{count}}条事件", "manager": []}}
How to obtain or fill in: Generate the Issue title, body, channels, and assignees according to the template configuration on this page.
config.name string Y Required string of up to 256 characters; the Issue title template is different from the rule name. Supports word variable names such as {{service}}/{{count}}, and unknown variables are kept as-is; arbitrary Python/Jinja expressions are not supported, and fields containing dots/hyphens are not guaranteed to be replaced.
Allowed null: False
Maximum length: 256
Example: 服务{{service}}告警
How to obtain or fill in: Build the title template from the dimensions fields and the aggregation variable count.
config.level string Optional level UUID or empty string; a non-empty value must be currently valid, otherwise 406; omitting it means no specified level. It is not a generic replacement field for Incident Center level UUIDs.
Allowed null: False
Empty string allowed: True
Example: system_level_0
How to obtain or fill in: Get the uuid from Issue Level List; if global levels are enabled in the backend, the administrator configuration takes precedence.
config.channelUUIDs array Optional array of channel UUIDs; explicit items must be currently active; it is recommended to always pass [] or a valid array, because although omitting it can still save, the task may fail when iterating over None. The task automatically adds default channel associations; the save itself still requires at least one active channel in the workspace, even with [].
Allowed null: False
Example: []
How to obtain or fill in: Get the active chan_ UUIDs of the current workspace from Channel Quick List.
config.description string Declared as an optional string, but subsequent tasks read this key directly, so always provide it explicitly (an empty string is acceptable). Modifying config replaces it entirely, and omitted sub-keys do not retain old values.
Allowed null: False
Example: 本窗口{{count}}条事件
How to obtain or fill in: Construct the Issue description using the same template variables.
config.extend json Optional object or null; the actual create/modify audit data calls extend.get directly, so an explicit null causes a 500 — on creation it usually fails before submission, while on modification the historical audit may fail after submission. It is recommended to always pass an object containing text; omitting it may also save and then fail the task due to a missing extend/text. When the object is present it is replaced entirely, and any sub-value must keep a valid structure.
Allowed null: True
Example: {"text": "服务{{service}}发现{{count}}条事件", "manager": []}
How to obtain or fill in: Refer to the display extension in Create Issue, using the fields actually consumed on this page as the standard.

Additional Parameter Notes

The current public scope is keyevent; configuration saving, scheduled execution, and notification delivery are different stages. Parameters and the full response/error boundaries are described below.

Request Example

curl --request POST 'https://openapi.guance.com/api/v1/issue_auto_discovery/add' \
  -H 'DF-API-KEY: <DF-API-KEY>' \
  -H 'Content-Type: application/json' \
  --data-raw '{"name":"生产事件自动发现","description":"按服务聚合生产告警","dqlNamespace":"keyevent","every":300,"conditions":"`df_status` = '"'"'error'"'"'","dimensions":["service"],"config":{"name":"服务{{service}}告警","description":"本窗口{{count}}条事件","channelUUIDs":[],"extend":{"text":"服务{{service}}发现{{count}}条事件","manager":[]}}}'

Response

HTTP 200, application/json. The example below shows the main fields that can be read directly.

Field Type Description
content object Configuration snapshot before submission; it does not include a creation/update identity summary and contains no generated Issues or run results.
content.id integer or null Database row ID, not used for path addressing; the pre-submission snapshot may be null.
content.uuid string Auto-discovery rule UUID with the iatdc_ prefix.
content.status integer 0 enabled, 2 disabled, 3 soft-deleted; reads exclude 3.
content.creator string Creator subject UUID; the current public entry is usually wsak_.
content.updator string or null Updating subject; may be empty or null in the creation snapshot.
content.createAt integer Creation time in Unix seconds.
content.updateAt integer or null Update time in Unix seconds; may be null in the pre-submission creation snapshot, and subsequent database default/updated values may be -1 or the actual time.
content.deleteAt integer Deletion time in Unix seconds; usually -1 if not deleted.
content.workspaceUUID string Workspace that the current Key belongs to.
content.name string Rule name.
content.description string Rule description, not the Issue body template.
content.dqlNamespace string Currently the public write value is keyevent; historical records may have other namespaces, which does not mean they can be written back through the public API.
content.every integer Cycle in seconds.
content.conditions string The saved DQL filter expression; it does not mean execution was verified as successful.
content.dimensions array<string> Array of grouping field names; historical incorrect types must be tolerated.
content.dimensions[] string One event field name.
content.config object Template defining the generated Issue.
content.config.name string Required string of up to 256 characters; the Issue title template is different from the rule name. Supports word variable names such as {{service}}/{{count}}, and unknown variables are kept as-is; arbitrary Python/Jinja expressions are not supported, and fields containing dots/hyphens are not guaranteed to be replaced.
content.config.level string Optional level UUID or empty string; a non-empty value must be currently valid, otherwise 406; omitting it means no specified level. It is not a generic replacement field for Incident Center level UUIDs.
content.config.channelUUIDs array Optional array of channel UUIDs; explicit items must be currently active; it is recommended to always pass [] or a valid array, because although omitting it can still save, the task may fail when iterating over None. The task automatically adds default channel associations; the save itself still requires at least one active channel in the workspace, even with [].
content.config.channelUUIDs[] string A single active channel UUID; it is not a dimension field/team UUID, and an unknown or disabled one returns 404.
content.config.description string Declared as an optional string, but subsequent tasks read this key directly, so always provide it explicitly (an empty string is acceptable). Modifying config replaces it entirely, and omitted sub-keys do not retain old values.
content.config.extend.text string An explicit string is recommended. The task reads it and performs template replacement; missing values or non-string values may fail asynchronously; both it and config.description are separately stored text fields.
content.config.extend.manager array Optional string array of assignees. Valid acnt_/team in this workspace/email/dutyPerson values are retained; unknown accounts/unknown values may be silently removed, and per-item errors are not guaranteed. Free/Free Plan workspaces do not support external emails and may return 400. Missing assignees may enter the unassigned escalation flow.
content.config.extend.manager[] string One valid subject, email, or dutyPerson; non-string values may cause a 500 during string startswith processing.
content.config.extend.conditionsInputFilters any Optional arbitrary JSON, used to supplement filter display when navigating from historical Issues/notification events; the actual query still uses the top-level conditions, and you cannot replace it by changing only this key.
content.config.extend.variable json Not recommended to be filled in requests; the task overwrites this object with the actual query columns, and count is usually the number of records in the window.
content.config.extend.variable.count integer Runtime occurrence count; caller input does not take effect as a reliable fixed value.
content.config.extend.tags json Not recommended to be filled in requests; the task overwrites it with actual grouping tags, which participate in Issue deduplication and template variables.
content.config.extend.tags.字段 any Dynamic JSON tag value; caller-supplied values cannot force fixed generation of groups.
content.config.extend.channelUUIDs array Overwritten at runtime with the valid configured channels; do not use this extension field instead of config.channelUUIDs.
content.config.extend.channelUUIDs[] string One runtime valid channel identifier.
content.config.extend.自定义键 any Any JSON value is saved; there is no additional execution guarantee publicly documented on this page; do not put credentials in it.
content.config.extend object or null The saved extension; new requests should use an object, because null causes synchronous audit or subsequent task exceptions.
content.declaration object or null Public declaration of the current workspace.
{
  "code": 200,
  "content": {
    "id": null,
    "uuid": "iatdc_example",
    "status": 0,
    "creator": "wsak_example",
    "updator": "",
    "createAt": 1785427200,
    "updateAt": null,
    "deleteAt": -1,
    "workspaceUUID": "wksp_example",
    "name": "生产事件自动发现",
    "description": "按服务聚合生产告警",
    "dqlNamespace": "keyevent",
    "every": 300,
    "conditions": "`df_status` = 'error'",
    "dimensions": [
      "service"
    ],
    "config": {
      "name": "服务{{service}}告警",
      "description": "本窗口{{count}}条事件",
      "channelUUIDs": [],
      "extend": {
        "text": "服务{{service}}发现{{count}}条事件",
        "manager": []
      }
    },
    "declaration": {}
  },
  "errorCode": "",
  "message": "",
  "success": true,
  "traceId": "TRACE-EXAMPLE"
}

Error Response

For authentication, rate limiting, and common request errors, see Common Error Definitions.

HTTP Status errorCode Trigger Condition Message or Response Description Handling
406 ft.ParameterValidationFailed A request field is missing, or a field value violates the declared validation conditions Parameter parsing failed Check the parameter location, field name, type, and value.
400 ft.RequestJsonFormatError The request JSON syntax is invalid Request JSON format error Fix the JSON according to content.reason, line, and column.
400 ft.JsonFormatError The request JSON top level is not an object Some json file format error Submit a parameter object.
400 ft.IssueAutoDiscoveryCfgNameExists A rule name is duplicated among undeleted rules in the current workspace A rule with the same name already exists Choose an unused name; on failure/timeout, first query the existing configurations.
406 ft.IssueLevelNotExists config.level is non-empty and not among the currently effective Issue levels Level configuration does not exist Verify the uuid against the Issue level list; do not mix display names/Incident Center levels.
404 ft.NotFoundChannel The workspace has no active channels, or a specified channelUUIDs item is not an active channel Specified channel not found Ensure the workspace has an active channel, and select UUIDs from the channel quick list; [] also does not bypass the requirement of at least one channel in the workspace.
400 ft.UnsupportFreeIssueManager In a Free/Free Plan workspace, an assignee uses a non-member external email 体验版本空间, 不支持异常追踪负责人为外部邮箱 (Free Plan workspace does not support external emails as Incident assignees) Use members of this workspace or have the administrator confirm the product edition.
500 ft.InternalServerError Unhandled exceptions such as template/assignee/dimension synchronous audit data construction, configuration database writes, or context submission Internal error First read the configuration by name to confirm whether it was saved; sub-structures/non-string dimensions usually fail before saving; when the result is unknown, do not create duplicates and keep the traceId for verification.

Feedback

Is this page helpful?