feat(incident): Phase 27 frequency_snapshot DB 持久化 — incidents 表新增 JSONB 欄位
Some checks failed
CD Pipeline / build-and-deploy (push) Has been cancelled
Some checks failed
CD Pipeline / build-and-deploy (push) Has been cancelled
frequency_stats 原僅存 Redis(TTL 35天),Pod 重啟或超期即失 - incidents.frequency_snapshot JSONB:建立 incident 時寫入快照,永久保存 - incident_repository: _record_to_incident 還原 IncidentFrequencyStats - _incident_to_record_data 序列化 frequency_stats 快照到 DB - Migration: phase27_incident_frequency_snapshot.sql 已執行完成 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -565,6 +565,15 @@ class IncidentRecord(Base):
|
||||
comment="事件結果與人類回饋",
|
||||
)
|
||||
|
||||
# === 頻率快照 (Phase 27, 2026-04-10 ogt) ===
|
||||
# frequency_stats 原本只存記憶體/Redis(TTL=35天),Pod重啟或超期即失
|
||||
# 此欄位在 incident 建立時寫入快照,永久保存當時的頻率統計
|
||||
frequency_snapshot: Mapped[dict[str, Any] | None] = mapped_column(
|
||||
JSON,
|
||||
nullable=True,
|
||||
comment="建立時刻的 AnomalyFrequency 快照,永久保存 (Phase 27)",
|
||||
)
|
||||
|
||||
# === 時間軸 ===
|
||||
created_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True),
|
||||
|
||||
Reference in New Issue
Block a user