diff --git a/models_gen.go b/models_gen.go index afac118..ddc7c30 100644 --- a/models_gen.go +++ b/models_gen.go @@ -763,8 +763,8 @@ type AlertMergeRequest struct { // AlertPipeline is generated from the Flashduty OpenAPI schema. type AlertPipeline struct { - // Optional OR-of-AND filter. When omitted, the rule applies to all alerts. - If OrFilterGroup `json:"if,omitempty" toon:"if,omitempty"` + // Optional AND-filter list — the rule applies only when every condition matches. Omit to apply the rule to all alerts. + If []FilterCondition `json:"if,omitempty" toon:"if,omitempty"` // Rule type. Rules run in array order; when the `if` condition matches, the event is processed according to `kind`. // | Value | Meaning | // |---|---| @@ -1071,8 +1071,8 @@ type ApAlertDrop struct{} type ApAlertInhibit struct { // Label keys whose values must be equal between the source and current alert for inhibition to apply. Equals []string `json:"equals" toon:"equals"` - // Filter that identifies the source alerts to inhibit. - SourceFilters OrFilterGroup `json:"source_filters" toon:"source_filters"` + // AND-filter list identifying the source alerts to inhibit — every condition must match. + SourceFilters []FilterCondition `json:"source_filters" toon:"source_filters"` } // ApDescriptionReset is generated from the Flashduty OpenAPI schema. @@ -1910,8 +1910,6 @@ type CreateDropRuleRequest struct { Description string `json:"description,omitempty" toon:"description,omitempty"` // Or-of-and filter tree. Each outer element is an AND group; within each group, all conditions must match. Filters [][]CreateDropRuleRequestFiltersItemItem `json:"filters,omitempty" toon:"filters,omitempty"` - // Evaluation priority. Lower runs first. - Priority int64 `json:"priority,omitempty" toon:"priority,omitempty"` // Rule name, 1 to 39 characters. RuleName string `json:"rule_name" toon:"rule_name"` } @@ -4382,6 +4380,8 @@ type KnowledgePackItem struct { CreatedAtMs TimestampMilli `json:"created_at_ms" toon:"created_at_ms"` // Person ID of the member who created the pack. CreatedBy int64 `json:"created_by" toon:"created_by"` + // Pack version at which DUTY.md was last authored or re-affirmed. When `version` is greater, DUTY.md no longer reflects every file in the pack. + DutyVersion int64 `json:"duty_version" toon:"duty_version"` // Number of files in the pack. FileCount int64 `json:"file_count" toon:"file_count"` // Knowledge pack ID (`kpk_` prefix). @@ -9996,8 +9996,6 @@ type UpdateDropRuleRequest struct { Description string `json:"description,omitempty" toon:"description,omitempty"` // Matching alerts are dropped and generate no notification. Filters FilterGroup `json:"filters,omitempty" toon:"filters,omitempty"` - // Evaluation priority. Lower runs first. - Priority int64 `json:"priority,omitempty" toon:"priority,omitempty"` // Drop rule ID (MongoDB ObjectID). RuleID string `json:"rule_id" toon:"rule_id"` // Rule name, 1 to 39 characters. diff --git a/openapi/openapi.en.json b/openapi/openapi.en.json index 3d4e496..4edc9eb 100644 --- a/openapi/openapi.en.json +++ b/openapi/openapi.en.json @@ -3465,7 +3465,6 @@ { "account_id": 2451002751131, "channel_id": 5967964835131, - "priority": 0, "rule_name": "Silence Info alerts", "description": "", "from_incident_id": "000000000000000000000000", @@ -3960,7 +3959,6 @@ { "account_id": 2451002751131, "channel_id": 5967964835131, - "priority": 0, "rule_name": "Suppress downstream alerts", "description": "", "source_filters": [ @@ -4462,7 +4460,6 @@ { "account_id": 2451002751131, "channel_id": 5967964835131, - "priority": 0, "rule_name": "Drop test alerts", "description": "", "filters": [ @@ -6365,6 +6362,21 @@ "data": { "integration_id": 10001, "rules": [ + { + "kind": "title_reset", + "if": [ + { + "key": "labels.env", + "oper": "IN", + "vals": [ + "prod" + ] + } + ], + "settings": { + "title": "[TPL]{{.Labels.service}} / {{.Labels.check}}" + } + }, { "kind": "severity_reset", "if": null, @@ -6452,7 +6464,34 @@ "items": [ { "integration_id": 10001, - "rules": [], + "rules": [ + { + "kind": "alert_inhibit", + "if": [ + { + "key": "labels.cluster", + "oper": "IN", + "vals": [ + "prod-cn" + ] + } + ], + "settings": { + "equals": [ + "service" + ], + "source_filters": [ + { + "key": "alert_severity", + "oper": "IN", + "vals": [ + "Critical" + ] + } + ] + } + } + ], "status": "enabled", "creator_id": 80011, "updated_by": 80011, @@ -6561,6 +6600,21 @@ "example": { "integration_id": 10001, "rules": [ + { + "kind": "title_reset", + "if": [ + { + "key": "labels.env", + "oper": "IN", + "vals": [ + "prod" + ] + } + ], + "settings": { + "title": "[TPL]{{.Labels.service}} / {{.Labels.check}}" + } + }, { "kind": "severity_reset", "if": null, @@ -30094,6 +30148,7 @@ "file_count": 17, "total_bytes": 41010, "version": 134, + "duty_version": 130, "created_by": 2476444212131, "created_at_ms": 1778768680053, "updated_at_ms": 1786456567177, @@ -30204,6 +30259,7 @@ "file_count": 17, "total_bytes": 41010, "version": 134, + "duty_version": 130, "created_by": 2476444212131, "created_at_ms": 1778768680053, "updated_at_ms": 1786456567177, @@ -30218,6 +30274,7 @@ "file_count": 4, "total_bytes": 11159, "version": 15, + "duty_version": 15, "created_by": 2476444212131, "created_at_ms": 1782201586089, "updated_at_ms": 1785462092702, @@ -30311,6 +30368,7 @@ "file_count": 17, "total_bytes": 41010, "version": 138, + "duty_version": 130, "created_by": 2476444212131, "created_at_ms": 1778768680053, "updated_at_ms": 1786458765182, @@ -30403,6 +30461,7 @@ "file_count": 4, "total_bytes": 11159, "version": 15, + "duty_version": 15, "created_by": 2476444212131, "created_at_ms": 1782201586089, "updated_at_ms": 1785462092702, @@ -35209,10 +35268,6 @@ "format": "int64", "description": "Owning channel ID; obtain it from `POST /channel/list`." }, - "priority": { - "type": "integer", - "description": "Evaluation priority. Lower runs first." - }, "rule_name": { "type": "string", "minLength": 1, @@ -35841,7 +35896,6 @@ "required": [ "account_id", "channel_id", - "priority", "rule_name", "description", "time_filters", @@ -35939,7 +35993,6 @@ "required": [ "account_id", "channel_id", - "priority", "rule_name", "description", "source_filters", @@ -36024,7 +36077,6 @@ "required": [ "account_id", "channel_id", - "priority", "rule_name", "description", "filters", @@ -36471,10 +36523,6 @@ "pattern": "^[0-9a-fA-F]{24}$", "description": "Drop rule ID (MongoDB ObjectID)." }, - "priority": { - "type": "integer", - "description": "Evaluation priority. Lower runs first." - }, "rule_name": { "type": "string", "minLength": 1, @@ -37587,8 +37635,11 @@ "description": "Rule type. Rules run in array order; when the `if` condition matches, the event is processed according to `kind`.\n| Value | Meaning |\n|---|---|\n| `title_reset` | Rewrites the event title from the `settings.title` template. |\n| `description_reset` | Rewrites the event description from the `settings.description` template. |\n| `severity_reset` | Resets the event severity and status to `settings.severity` (`Critical`/`Warning`/`Info`). |\n| `alert_drop` | Discards the matching event outright; no alert is created. |\n| `alert_inhibit` | Discards the event (inhibition) when an active source alert matching `settings.source_filters` and correlated via `settings.equals` exists. |" }, "if": { - "$ref": "#/components/schemas/OrFilterGroup", - "description": "Optional OR-of-AND filter. When omitted, the rule applies to all alerts." + "type": "array", + "items": { + "$ref": "#/components/schemas/FilterCondition" + }, + "description": "Optional AND-filter list — the rule applies only when every condition matches. Omit to apply the rule to all alerts." }, "settings": { "type": "object", @@ -37863,8 +37914,11 @@ "description": "Label keys whose values must be equal between the source and current alert for inhibition to apply." }, "source_filters": { - "$ref": "#/components/schemas/OrFilterGroup", - "description": "Filter that identifies the source alerts to inhibit." + "type": "array", + "items": { + "$ref": "#/components/schemas/FilterCondition" + }, + "description": "AND-filter list identifying the source alerts to inhibit — every condition must match." } } }, @@ -58662,6 +58716,10 @@ "type": "integer", "description": "Pack version, incremented on every file change." }, + "duty_version": { + "type": "integer", + "description": "Pack version at which DUTY.md was last authored or re-affirmed. When `version` is greater, DUTY.md no longer reflects every file in the pack." + }, "created_by": { "type": "integer", "description": "Person ID of the member who created the pack.", @@ -58690,6 +58748,7 @@ "file_count", "total_bytes", "version", + "duty_version", "created_by", "created_at_ms", "updated_at_ms", diff --git a/openapi/openapi.zh.json b/openapi/openapi.zh.json index 64abe1a..3948a5e 100644 --- a/openapi/openapi.zh.json +++ b/openapi/openapi.zh.json @@ -3465,7 +3465,6 @@ { "account_id": 2451002751131, "channel_id": 5967964835131, - "priority": 0, "rule_name": "Silence Info alerts", "description": "", "from_incident_id": "000000000000000000000000", @@ -3960,7 +3959,6 @@ { "account_id": 2451002751131, "channel_id": 5967964835131, - "priority": 0, "rule_name": "Suppress downstream alerts", "description": "", "source_filters": [ @@ -4462,7 +4460,6 @@ { "account_id": 2451002751131, "channel_id": 5967964835131, - "priority": 0, "rule_name": "Drop test alerts", "description": "", "filters": [ @@ -6365,6 +6362,21 @@ "data": { "integration_id": 10001, "rules": [ + { + "kind": "title_reset", + "if": [ + { + "key": "labels.env", + "oper": "IN", + "vals": [ + "prod" + ] + } + ], + "settings": { + "title": "[TPL]{{.Labels.service}} / {{.Labels.check}}" + } + }, { "kind": "severity_reset", "if": null, @@ -6452,7 +6464,34 @@ "items": [ { "integration_id": 10001, - "rules": [], + "rules": [ + { + "kind": "alert_inhibit", + "if": [ + { + "key": "labels.cluster", + "oper": "IN", + "vals": [ + "prod-cn" + ] + } + ], + "settings": { + "equals": [ + "service" + ], + "source_filters": [ + { + "key": "alert_severity", + "oper": "IN", + "vals": [ + "Critical" + ] + } + ] + } + } + ], "status": "enabled", "creator_id": 80011, "updated_by": 80011, @@ -6561,6 +6600,21 @@ "example": { "integration_id": 10001, "rules": [ + { + "kind": "title_reset", + "if": [ + { + "key": "labels.env", + "oper": "IN", + "vals": [ + "prod" + ] + } + ], + "settings": { + "title": "[TPL]{{.Labels.service}} / {{.Labels.check}}" + } + }, { "kind": "severity_reset", "if": null, @@ -30086,6 +30140,7 @@ "file_count": 17, "total_bytes": 41010, "version": 134, + "duty_version": 130, "created_by": 2476444212131, "created_at_ms": 1778768680053, "updated_at_ms": 1786456567177, @@ -30196,6 +30251,7 @@ "file_count": 17, "total_bytes": 41010, "version": 134, + "duty_version": 130, "created_by": 2476444212131, "created_at_ms": 1778768680053, "updated_at_ms": 1786456567177, @@ -30210,6 +30266,7 @@ "file_count": 4, "total_bytes": 11159, "version": 15, + "duty_version": 15, "created_by": 2476444212131, "created_at_ms": 1782201586089, "updated_at_ms": 1785462092702, @@ -30303,6 +30360,7 @@ "file_count": 17, "total_bytes": 41010, "version": 138, + "duty_version": 130, "created_by": 2476444212131, "created_at_ms": 1778768680053, "updated_at_ms": 1786458765182, @@ -30395,6 +30453,7 @@ "file_count": 4, "total_bytes": 11159, "version": 15, + "duty_version": 15, "created_by": 2476444212131, "created_at_ms": 1782201586089, "updated_at_ms": 1785462092702, @@ -35200,10 +35259,6 @@ "format": "int64", "description": "所属协作空间 ID,可通过 `POST /channel/list` 获取。" }, - "priority": { - "type": "integer", - "description": "匹配优先级,数值越小越优先。" - }, "rule_name": { "type": "string", "minLength": 1, @@ -35832,7 +35887,6 @@ "required": [ "account_id", "channel_id", - "priority", "rule_name", "description", "time_filters", @@ -35930,7 +35984,6 @@ "required": [ "account_id", "channel_id", - "priority", "rule_name", "description", "source_filters", @@ -36015,7 +36068,6 @@ "required": [ "account_id", "channel_id", - "priority", "rule_name", "description", "filters", @@ -36462,10 +36514,6 @@ "pattern": "^[0-9a-fA-F]{24}$", "description": "排除规则 ID(MongoDB ObjectID)。" }, - "priority": { - "type": "integer", - "description": "匹配优先级,数值越小越优先。" - }, "rule_name": { "type": "string", "minLength": 1, @@ -37578,8 +37626,11 @@ "description": "规则类型。规则按数组顺序依次执行,`if` 条件命中后按 `kind` 处理事件。\n| 值 | 含义 |\n|---|---|\n| `title_reset` | 按 `settings.title` 模板重写事件标题。 |\n| `description_reset` | 按 `settings.description` 模板重写事件描述。 |\n| `severity_reset` | 将事件严重程度与状态重置为 `settings.severity`(`Critical`/`Warning`/`Info`)。 |\n| `alert_drop` | 直接丢弃匹配的事件,不生成告警。 |\n| `alert_inhibit` | 当存在匹配 `settings.source_filters` 且按 `settings.equals` 关联的活跃源告警时,丢弃该事件(抑制)。 |" }, "if": { - "$ref": "#/components/schemas/OrFilterGroup", - "description": "可选的过滤条件,省略时对所有告警生效。" + "type": "array", + "items": { + "$ref": "#/components/schemas/FilterCondition" + }, + "description": "可选 AND 过滤条件列表,全部条件匹配时规则才生效;省略时对所有告警生效。" }, "settings": { "type": "object", @@ -37854,8 +37905,11 @@ "description": "需要在来源告警与当前告警之间值相等的标签键列表。" }, "source_filters": { - "$ref": "#/components/schemas/OrFilterGroup", - "description": "用于匹配待抑制来源告警的过滤条件。" + "type": "array", + "items": { + "$ref": "#/components/schemas/FilterCondition" + }, + "description": "用于匹配待抑制来源告警的 AND 过滤条件列表,需全部条件匹配。" } } }, @@ -58653,6 +58707,10 @@ "type": "integer", "description": "知识包版本号,文件每次变更时递增。" }, + "duty_version": { + "type": "integer", + "description": "最后一次撰写或确认 DUTY.md 时的知识库版本。当 `version` 大于该值时,说明 DUTY.md 已不能反映知识库的全部文件。" + }, "created_by": { "type": "integer", "description": "创建者成员 ID。", @@ -58681,6 +58739,7 @@ "file_count", "total_bytes", "version", + "duty_version", "created_by", "created_at_ms", "updated_at_ms",