Skip to content

feat: 接入 Alarm Engine Detect/Trigger Shadow 输入与 Python 参考终态 - #12014

Open
chenguo367 wants to merge 11 commits into
TencentBlueKing:masterfrom
chenguo367:feat/alarm-engine-detection-contract/#1010158081137225805
Open

feat: 接入 Alarm Engine Detect/Trigger Shadow 输入与 Python 参考终态#12014
chenguo367 wants to merge 11 commits into
TencentBlueKing:masterfrom
chenguo367:feat/alarm-engine-detection-contract/#1010158081137225805

Conversation

@chenguo367

@chenguo367 chenguo367 commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

变更内容

  • 新增 DetectionOutcome v1 与 Trigger StrategyIR 严格契约、canonical input_id 与跨语言 Golden
  • Detect 在旧 Redis 异常链路完成后,把已最终确认的每条记录投影为 NORMAL/ANOMALOUS,按 500 条 / 512 KiB 双上限发布到隔离 Kafka topic
  • Detect 对已 ACK 的非异常输入直接生成 NO_TRIGGER/INPUT_NORMAL 参考终态
  • Trigger 在真实 AnomalyChecker 与原 MonitorEvent 副作用完成后,发布 TRIGGERNO_TRIGGER/TRIGGER_CONDITION_NOT_MET 候选终态
  • Shadow 开关、Kafka producer 配置与 topic allowlist 统一走类型化解析:环境注入的字符串 "false" 不再被当作开启

边界

  • 全部 Shadow 配置默认关闭,环境显式提供独立 topic 后才可开启
  • 只处理显式 allowlist 中的 Threshold 策略,排除 double-check 与 Nodata;策略快照不一致时 fail-closed
  • 旧 Redis 与 MonitorEvent 主链先完成,Shadow 失败只形成覆盖缺口,不改变旧链结果
  • reference topic 禁止与 Detection 输入 topic、当前集群解析出的生产 MonitorEvent topic 重合
  • 当前运行投影覆盖 NORMAL/ANOMALOUSERROR/UNSUPPORTED 只有契约能力,尚无在线终态来源
  • 不含镜像、Chart、values、topic/ACL 与任何环境部署

已知后置边界

  • Shadow 发布仍同步位于 Detect/Trigger 服务锁内,首期以窄 selector 和严格 Kafka 超时控制
  • terminal reference 仍按整批物化,首期以窄 selector 控制内存
  • Python 侧发布成功率、失败率与耗时指标尚未接入

本地验证

  • 纯契约、Golden 与配置解析:155 passed
  • Ruff check / format、compileall 通过
  • 既有 Django service 测试由分支门禁执行

@chenguo367
chenguo367 requested a review from unique0lai August 17, 2026 12:18
@chenguo367 chenguo367 self-assigned this Aug 17, 2026
@chenguo367 chenguo367 added feat A new feature. Correlates with MINOR in SemVer project/monitor project monitor alarm-engine labels Aug 17, 2026
@chenguo367
chenguo367 marked this pull request as ready for review August 18, 2026 03:28
Deployments inject settings through the environment as strings, where "false" is
truthy and a Kafka producer config stays a string instead of a mapping. The
Shadow switches could therefore open the bypass while the isolated producer and
topic allowlist were unusable.

Resolve the switches, producer configs and topic allowlists through explicit
typed parsing: only an exact "true" opens the bypass, a producer config may
arrive as a JSON document, and an allowlist with any unusable member resolves to
no allowlist at all.

Co-authored-by: Cursor <cursoragent@cursor.com>
@chenguo367 chenguo367 changed the title feat: 新增 Alarm Engine DetectionOutcome v1 契约 feat: 接入 Alarm Engine Detect/Trigger Shadow 输入与 Python 参考终态 Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

alarm-engine feat A new feature. Correlates with MINOR in SemVer project/monitor project monitor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant