167 lines
4.6 KiB
Markdown
167 lines
4.6 KiB
Markdown
# 面试前验收清单
|
||
|
||
## 1. 环境检查
|
||
|
||
- 当前分支包含最新架构文档和面试材料。
|
||
- MySQL 可连接。
|
||
- Redis 可连接。
|
||
- Milvus/Zilliz 可连接。
|
||
- 模型 API key 可用。
|
||
- `mvp-demo` profile 开启 mock Prometheus 和 mock CLS。
|
||
|
||
启动服务:
|
||
|
||
```powershell
|
||
mvn spring-boot:run "-Dspring-boot.run.profiles=mvp-demo"
|
||
```
|
||
|
||
编译检查:
|
||
|
||
```powershell
|
||
mvn -q -DskipTests compile
|
||
```
|
||
|
||
目标测试:
|
||
|
||
```powershell
|
||
mvn -q "-Dtest=AiOpsServiceTest,ChatServiceSequentialAgentTest,DiagnosisTraceServiceTest,VectorSearchServiceTest,LookupKnowledgeToolTest" test
|
||
```
|
||
|
||
## 2. Chat Demo 验收
|
||
|
||
请求:
|
||
|
||
```powershell
|
||
$sessionId = "interview-chat-payment-timeout-001"
|
||
$body = @{
|
||
Id = $sessionId
|
||
Question = "支付接口最近出现超时,请结合知识库、日志和指标判断可能原因,并给出修复建议。"
|
||
} | ConvertTo-Json
|
||
|
||
Invoke-RestMethod `
|
||
-Method Post `
|
||
-Uri "http://localhost:9900/api/chat" `
|
||
-ContentType "application/json" `
|
||
-Body $body
|
||
```
|
||
|
||
验收:
|
||
|
||
- 返回 `data.success = true`。
|
||
- 返回 `data.sessionId = interview-chat-payment-timeout-001`。
|
||
- `diagnosis_session.agent_flow = CHAT`。
|
||
- Trace API 返回 session、steps、toolInvocations。
|
||
- 复杂问题下 trace 中能看到 verifier 相关数据。
|
||
|
||
SQL:
|
||
|
||
```powershell
|
||
python scripts/query_mysql.py "SELECT session_id, agent_flow, status, step_count, tool_call_count FROM diagnosis_session WHERE session_id='interview-chat-payment-timeout-001'"
|
||
```
|
||
|
||
## 3. AIOps Demo 验收
|
||
|
||
请求:
|
||
|
||
```powershell
|
||
$aiopsSessionId = "interview-aiops-payment-cpu-001"
|
||
$aiopsBody = @{
|
||
sessionId = $aiopsSessionId
|
||
alertName = "HighCPUUsage"
|
||
service = "payment-service"
|
||
severity = "P1"
|
||
description = "服务 payment-service 的 CPU 使用率持续超过 80%,当前值为 92%。实例: pod-payment-service-7d8f9c6b5-x2k4m。"
|
||
timeRange = "last_15m"
|
||
userRequest = "请结合 Prometheus 活动告警、system-metrics 日志和知识库生成告警分析报告。"
|
||
} | ConvertTo-Json
|
||
|
||
Invoke-WebRequest `
|
||
-Method Post `
|
||
-Uri "http://localhost:9900/api/ai_ops" `
|
||
-ContentType "application/json" `
|
||
-Body $aiopsBody
|
||
```
|
||
|
||
验收:
|
||
|
||
- SSE 首条包含 `type=session`。
|
||
- SSE 最后包含 `type=done`。
|
||
- `diagnosis_session.agent_flow = AI_OPS`。
|
||
- `diagnosis_session.status = SUCCESS`。
|
||
- `diagnosis_session.answer` 有最终报告。
|
||
- Trace API 返回 AIOps steps 和 tool invocations。
|
||
- 报告主章节聚焦 `HighCPUUsage/payment-service`。
|
||
- 其他 active alerts 不应展开成独立主根因章节。
|
||
- `self_evaluation.aiops_rule_evaluation` 存在。
|
||
|
||
SQL:
|
||
|
||
```powershell
|
||
python scripts/query_mysql.py "SELECT session_id, agent_flow, status, total_duration_ms, step_count, tool_call_count FROM diagnosis_session WHERE session_id='interview-aiops-payment-cpu-001'"
|
||
```
|
||
|
||
```powershell
|
||
python scripts/query_mysql.py "SELECT tool_name, COUNT(*) AS cnt FROM tool_invocation WHERE session_id='interview-aiops-payment-cpu-001' GROUP BY tool_name ORDER BY tool_name"
|
||
```
|
||
|
||
Scope 检查:
|
||
|
||
```powershell
|
||
python scripts/query_mysql.py "SELECT (answer LIKE '%HighCPUUsage%') AS has_main_alert, (answer LIKE '%payment-service%') AS has_service FROM diagnosis_session WHERE session_id='interview-aiops-payment-cpu-001'"
|
||
```
|
||
|
||
## 4. Trace API 验收
|
||
|
||
```powershell
|
||
Invoke-RestMethod `
|
||
-Method Get `
|
||
-Uri "http://localhost:9900/api/diagnosis/interview-aiops-payment-cpu-001/trace"
|
||
```
|
||
|
||
如果 PowerShell 对长 JSON 或特殊字符不稳定,可以用:
|
||
|
||
```powershell
|
||
curl.exe --silent --show-error --max-time 60 "http://localhost:9900/api/diagnosis/interview-aiops-payment-cpu-001/trace"
|
||
```
|
||
|
||
## 5. RAG 验收
|
||
|
||
```powershell
|
||
Invoke-RestMethod `
|
||
-Uri "http://127.0.0.1:9900/api/search/similar?query=ERR_TIMEOUT&topK=3" `
|
||
-Method Get
|
||
```
|
||
|
||
验收:
|
||
|
||
- 返回 `code = 200`。
|
||
- top candidates 中包含 `ERR_TIMEOUT` 相关文档。
|
||
- `scoreLabel` 能体现当前检索路径语义。
|
||
- 如果走 VectorStore,日志应出现 Spring AI VectorStore search。
|
||
|
||
## 6. 常见问题
|
||
|
||
### MySQL stale connection
|
||
|
||
现象:
|
||
|
||
```text
|
||
HikariPool - Connection is not available
|
||
No operations allowed after connection closed
|
||
```
|
||
|
||
处理:
|
||
|
||
- 重启服务。
|
||
- 确认 HikariPool 使用当前配置启动成功。
|
||
- 再跑 trace 或 AIOps 请求。
|
||
|
||
### SSE 客户端显示异常
|
||
|
||
PowerShell `Invoke-WebRequest` 有时对 SSE 或长 JSON 处理不稳定。可以改用 `curl.exe` 或直接查询 MySQL 和 Trace API 验证结果。
|
||
|
||
### OpenSpec 全量校验失败
|
||
|
||
`openspec validate --all --strict` 可能因为历史未完成 change 失败。面试演示主要依赖已归档 spec、MVP trace 和 RAG 验收材料,可以单独验证相关 spec。
|
||
|