feat(monitor): v1.3第十一检data_monitor_alive——P1-10另一半互为外盯(data转呈采纳): data-monitor health_latest.json>26h停滞或缺失=红, morn+eve双班携带, 兜'SCHTASKS自检无人执行'结构洞; 与data域075052d盯我方两班互为反向; 附strategy-ops plan入库+§6开放决策点回填+v1→v1.3演化后记 [vps]

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
2026-10-01 09:28:24 +08:00
parent d923a05dc8
commit b06dbc91f1
6 changed files with 178 additions and 9 deletions
+22 -1
View File
@@ -2,7 +2,8 @@
"""策略域体检检查函数库 — 数据面 monitor_checks 的策略镜像(目录内自含).
判据全只读: 主库(paper_accounts/live_trades/paper_trades/dbbardata/order_events)
+ pipeline.db(is_daily/strategy_weekly) + logs/live_*.log+shadow_*.log + wmic 进程快照。
+ pipeline.db(is_daily/strategy_weekly) + logs/live_*.log+shadow_*.log + wmic 进程快照
+ data/monitor/health_latest.json(data-monitor 存活外盯,只读不写)。
返回统一形状 {"key","status","expected","actual","evidence"}; status 取
green / 注册表项 severity(违例时)。
@@ -333,6 +334,25 @@ def weekly_ran(ctx, e):
{"week_start": monday})
def data_monitor_alive(ctx, e):
"""data-monitor health_latest.json 新鲜度(互为外盯, 10-01 审计 P1-10 另一半).
data-monitor 每日两班(08:05/23:50)原子写 {data_root}/monitor/health_latest.json
(节假日 schtask 照跑, 日历降级在进程内); >max_age_hours 无新写=其两班全死,
而它的 SCHTASKS 自检自己也死了无人执行=全链静默——本检在 strategy 两班
侧外盯兜住该结构洞(反向: data-monitor SCHTASKS 已盯 strategy 两班)."""
p = ctx["data_monitor_health"]
try:
mtime = dt.datetime.fromtimestamp(os.path.getmtime(p))
except OSError:
return _done(e, e["severity"], f"<={e['max_age_hours']}h", "missing",
{"file": p})
age_h = (ctx["now"] - mtime).total_seconds() / 3600
status = "green" if age_h <= e["max_age_hours"] else e["severity"]
return _done(e, status, f"<={e['max_age_hours']}h", f"{age_h:.0f}h",
{"file": p, "age_h": round(age_h, 1)})
CHECK_FNS = {
"engines_expected": engines_expected,
"engines_actual": engines_actual,
@@ -344,4 +364,5 @@ CHECK_FNS = {
"orders_leftover": orders_leftover,
"fills_vs_paper": fills_vs_paper,
"weekly_ran": weekly_ran,
"data_monitor_alive": data_monitor_alive,
}
+4 -1
View File
@@ -99,7 +99,10 @@ def main(argv=None):
ctx = {"main_db": args.main_db, "pipeline_db": args.pipeline_db,
"logs_dir": args.logs_dir, "now": now, "today": today,
"midnight": dt.datetime.combine(now.date(), dt.time.min)}
"midnight": dt.datetime.combine(now.date(), dt.time.min),
# data-monitor 健康文件(互为外盯 P1-10): 同 data_root/monitor 约定
"data_monitor_health": os.path.join(
args.data_root, "monitor", "health_latest.json")}
conn = store.connect(db_path)
checks, events, passed = [], [], []
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
"""策略域监控注册表 — v1 十检(数据面 monitor_registry 的策略镜像).
"""策略域监控注册表 — v1.3 十一检(数据面 monitor_registry 的策略镜像).
初值阈值跑两周后校准(数据轨同款纪律)。
闸门字段:
@@ -51,4 +51,8 @@ REGISTRY = [
"shifts": ("eve",), "severity": "yellow", "trading_day": True,
"enabled": True,
"title": "本周周报行缺失"},
{"key": "strategy.data_monitor_alive", "fn": "data_monitor_alive",
"shifts": ("morn", "eve"), "severity": "red", "trading_day": False,
"max_age_hours": 26, "enabled": True,
"title": "data-monitor健康文件停滞(>26h两班全死,互为外盯)"},
]