diff --git a/fastdeploy/golang_router/.claude/skills/troubleshoot/SKILL.md b/fastdeploy/golang_router/.claude/skills/troubleshoot/SKILL.md index 919e25a1101..00c94a2f487 100644 --- a/fastdeploy/golang_router/.claude/skills/troubleshoot/SKILL.md +++ b/fastdeploy/golang_router/.claude/skills/troubleshoot/SKILL.md @@ -124,7 +124,7 @@ python3 $SCRIPTS/troubleshoot.py --start "16:00" --end "17:00" --erro - **终端**:简洁三层汇总(Router / FD 后端 / 客户端),含状态码分布、错误 Top N、趋势图 - **文件**:详细报告导出到 `skill_output/troubleshoot//summary/troubleshoot_report.md` - 逐分钟事件详情拆分到 `detail/health_events.md` - - 请求追踪事件链拆分到 `detail/trace_.md` + - 请求追踪事件链拆分到 `detail/trace/trace_.md` - **Cache 明细要求**:`cache_session_stickiness.md` / `cache_suboptimal.md` / `cache_eviction.md` / `cache_fallback.md` / `cache_cross.md` 必须始终生成(即使无异常也写“未发现/样本不足”总结,避免链接缺失) - **状态行**:`STATUS: HEALTHY / DEGRADED / CRITICAL` diff --git a/fastdeploy/golang_router/.claude/skills/troubleshoot/references/report_templates.md b/fastdeploy/golang_router/.claude/skills/troubleshoot/references/report_templates.md index 2ec683f2299..61db59ec7e6 100644 --- a/fastdeploy/golang_router/.claude/skills/troubleshoot/references/report_templates.md +++ b/fastdeploy/golang_router/.claude/skills/troubleshoot/references/report_templates.md @@ -62,7 +62,7 @@ - `detail/latency_diagnoses.md` — 延迟诊断详情 - `detail/cache_diagnosis.md` — cache 六维诊断详情(session 粘性/非最优/驱逐/Fallback/冷启动/交叉诊断) - `detail/cache_session_stickiness.md` / `detail/cache_suboptimal.md` / `detail/cache_eviction.md` / `detail/cache_fallback.md` / `detail/cache_cross.md` — cache 分职责拆分明细 - - `detail/trace_.md` — 请求追踪事件链 + - `detail/trace/trace_.md` — 请求追踪事件链 --- diff --git a/fastdeploy/golang_router/.claude/skills/troubleshoot/scripts/analyzers/trace.py b/fastdeploy/golang_router/.claude/skills/troubleshoot/scripts/analyzers/trace.py index d9a599b305c..d0dcbdca6d9 100644 --- a/fastdeploy/golang_router/.claude/skills/troubleshoot/scripts/analyzers/trace.py +++ b/fastdeploy/golang_router/.claude/skills/troubleshoot/scripts/analyzers/trace.py @@ -485,7 +485,9 @@ def format_trace_report(result): # 主报告中添加引用和摘要 safe_tid = tid.replace("/", "_") sections.append(f' 事件数: {len(trace["events"])}') - sections.append(f" > 完整事件链: [detail/trace_{safe_tid}.md](../detail/trace_{safe_tid}.md)") + sections.append( + f" > 完整事件链: [detail/trace/trace_{safe_tid}.md](../detail/trace/trace_{safe_tid}.md)" + ) sections.append("") return "\n".join(sections), detail_dict diff --git a/fastdeploy/golang_router/.claude/skills/troubleshoot/scripts/troubleshoot.py b/fastdeploy/golang_router/.claude/skills/troubleshoot/scripts/troubleshoot.py index 96a37ff9577..251a21c7e81 100644 --- a/fastdeploy/golang_router/.claude/skills/troubleshoot/scripts/troubleshoot.py +++ b/fastdeploy/golang_router/.claude/skills/troubleshoot/scripts/troubleshoot.py @@ -191,7 +191,7 @@ def format_full_report(results, status, status_reason): details: dict 包含需要拆分到独立文件的详情数据 - 'health_events': str 或 None - 'load_select_release': str 或 None - - 'trace_files': {trace_id: text} 或 {} + - 'trace_files': {trace_id: text} 或 {}(写入 detail/trace/) """ parts = [] details = { @@ -419,9 +419,12 @@ def save_detailed_report(report_text, output_dir, details=None): with open(os.path.join(detail_dir, "errors_topn.md"), "w", encoding="utf-8") as f: f.write(details["errors_topn"]) + trace_detail_dir = os.path.join(detail_dir, "trace") + if details.get("trace_files"): + os.makedirs(trace_detail_dir, exist_ok=True) for trace_id, trace_text in details.get("trace_files", {}).items(): safe_id = trace_id.replace("/", "_") - trace_path = os.path.join(detail_dir, f"trace_{safe_id}.md") + trace_path = os.path.join(trace_detail_dir, f"trace_{safe_id}.md") with open(trace_path, "w", encoding="utf-8") as f: f.write(trace_text)