amudhan023/sre-copilot

GitHub: amudhan023/sre-copilot

基于多 Agent 架构的 AI 辅助 SRE 事件响应系统,通过实时接入告警与观测数据自动完成异常检测、根因分析和事件复盘。

Stars: 0 | Forks: 0

# SRE Copilot — AI 辅助的事件响应 由 AI 驱动的 SRE Copilot 使用 LangGraph、Kafka 和 Flink 来接入实时告警、日志、指标和链路追踪,关联多服务故障,并利用 Prometheus、ELK 和部署事件,通过基于 LLM 的分析生成根因假设、事件摘要和缓解建议,最终通过 Slack 和 PagerDuty 进行交付。 ## 快速开始 ``` # 配置(仅需要 ANTHROPIC_API_KEY) cp .env.example .env # 编辑 .env 并添加你的 API key # 启动所有服务 make demo # 访问入口(约 3 分钟后准备就绪) # SRE Dashboard : http://localhost:8000 # Grafana : http://localhost:3000 (admin/admin) # Kafka UI : http://localhost:8080 # Mailhog : http://localhost:8025 ← 在这里查看 AI 邮件的出现 # Prometheus : http://localhost:9090 # Qdrant : http://localhost:6333/dashboard ``` ## 测试 ``` # 运行完整测试套件(单元 + 集成,不需要 docker-compose) make test # 仅快速单元测试 —— 在 1 秒内完成 make test-unit # 完整 E2E 测试(需要 make demo 正在运行) make test-e2e ``` ## 架构 ``` Simulation Layer Ingestion Layer Agent Layer ────────────────── ─────────────── ──────────────────────── traffic-simulator ──→ metrics-ingester ──→ Detection Agent failure-injector ──→ log-ingester ──→ Correlation Agent deployment-sim ──→ deployment-ingr ──→ Investigation Agent ──→ Knowledge Retrieval Agent Kafka Event Bus ──→ Remediation Agent ═════════════ ──→ Communication Agent ──→ Postmortem Agent Knowledge Layer ──────────────── Qdrant (5 collections): • incidents (50 historical) • runbooks (9 procedures) • architecture (6 services) • deployments (30 records) • postmortems (7 documents) ``` ## 故障场景 故障注入器自动循环以下 9 个场景: | 场景 | 服务 | 信号 | 持续时间 | |----------|---------|--------|----------| | LATENCY_SPIKE | payment-service | P99 → 8500ms | 5 分钟 | | ERROR_RATE_SPIKE | order-service | 错误率 → 45% | 3 分钟 | | CPU_SATURATION | api-gateway | CPU → 95% | 8 分钟 | | MEMORY_LEAK | notification-service | 内存 → 96% | 12 分钟 | | DB_CONNECTION_EXHAUSTION | payment-service | 连接数 → 99/100 | 6 分钟 | | KAFKA_CONSUMER_LAG | order-service | 滞后 → 52,000 条消息 | 10 分钟 | | DEPENDENCY_OUTAGE | inventory-service | 错误 → 98% | 5 分钟 | | DEPLOYMENT_FAILURE | user-service | 错误 → 100% | 4 分钟 | | NETWORK_PARTITION | payment-service | 连接重置 | 3 分钟 |
标签:AIOps, Flink, Kafka, LLM代理, SonarQube插件, SRE, 偏差过滤, 告警关联, 根因分析, 自定义请求头, 请求拦截, 逆向工具