# MemoryWeave (织忆) Prometheus 告警规则 # 位置: /etc/prometheus/rules/zhiyi.yml groups: - name: zhiyi_alerts rules: # ─── 蒸馏积压 ───────────────────────── - alert: ZhiyiDistillBacklog expr: zhiyi_distill_queue_depth > 50 for: 10m labels: severity: warning annotations: summary: "织忆蒸馏队列积压 ({{ $value }} > 50)" description: "蒸馏队列深度超过 50,可能出现处理瓶颈" # ─── 冲突积压 ───────────────────────── - alert: ZhiyiConflictsPending expr: zhiyi_conflicts_pending > 5 for: 15m labels: severity: warning annotations: summary: "织忆待解决冲突 ({{ $value }} > 5)" description: "有 {{ $value }} 个冲突等待裁决,需要牧尘介入" # ─── Recall 延迟异常 ─────────────────── - alert: ZhiyiRecallLatencyHigh expr: histogram_quantile(0.99, rate(zhiyi_request_duration_seconds_bucket{endpoint="recall"}[5m])) > 2 for: 5m labels: severity: warning annotations: summary: "织忆 recall P99 延迟 > 2s ({{ $value }}s)" description: "recall 接口变慢,检查 BGE/reranker 服务状态" # ─── 服务宕机 ───────────────────────── - alert: ZhiyiServiceDown expr: up{job="zhiyid"} == 0 for: 1m labels: severity: critical annotations: summary: "织忆服务宕机" description: "zhiyid 进程在 {{ $labels.instance }} 上停止响应" # ─── LLM 调用额度接近上限 ───────────── - alert: ZhiyiLLMBudgetNearLimit expr: zhiyi_distill_llm_calls_today / 50 > 0.85 for: 30m labels: severity: warning annotations: summary: "织忆 LLM 调用接近日限 ({{ $value | humanizePercentage }})" description: "今日已用 {{ $value }}% 的蒸馏额度,将降级为硬规则提取" # ─── 深度整合失败 ───────────────────── - alert: ZhiyiConsolidationFailing expr: rate(zhiyi_consolidate_failures_total[1h]) > 0.05 for: 30m labels: severity: critical annotations: summary: "织忆深度整合连续失败" description: "zhiyi-consolidate 连续 3 次失败,需手动检查 Rust sidecar" # ─── 内存使用过高 ───────────────────── - alert: ZhiyiMemoryHigh expr: zhiyi_memory_rss_bytes > 200e6 for: 10m labels: severity: warning annotations: summary: "织忆内存使用 > 200MB ({{ $value | humanize }}B)" description: "RSS 内存超过预期,可能存在内存泄漏" # ─── SQLite 数据库过大 ──────────────── - alert: ZhiyiSQLiteDBSize expr: zhiyi_sqlite_db_size_bytes > 1e9 for: 1h labels: severity: warning annotations: summary: "织忆 SQLite 数据库 > 1GB ({{ $value | humanize }}B)" description: "数据库持续增长,建议运行深度整合修剪"