diff --git a/docs/2026-06-02-PRODUCTION-VALIDATION-REPORT.md b/docs/2026-06-02-PRODUCTION-VALIDATION-REPORT.md index 3eab5547..7a1f443d 100644 --- a/docs/2026-06-02-PRODUCTION-VALIDATION-REPORT.md +++ b/docs/2026-06-02-PRODUCTION-VALIDATION-REPORT.md @@ -189,19 +189,24 @@ Dockerfile | 多阶段构建 | ✅ 使用builder模式 | | 环境变量文档 | ✅ 已添加注释 | | 必需配置标记 | ✅ ADMIN_TOKEN标记为必需 | +### 6.3 Metrics 暴露 (⚠️ 已修复) -### 6.3 Metrics 暴露 +**修复前问题**: `/metrics` 返回 404 +- 原因: metrics handler 仅定义在独立启动函数中,未注册到主路由 + +**修复方案**: 在 `NewAPIHandlerWithAuth` 中添加: +```go +mux.Handle("GET /metrics", metrics.Handler()) ``` -GET /metrics - Prometheus格式 ✅ -指标覆盖: -- http_requests_total -- http_request_duration_seconds -- active_hosts -- active_providers -- route_decisions_total -- route_failovers_total -- log_flush_errors_total -- log_dropped_events_total + +**验证结果**: +```bash +✅ curl http://127.0.0.1:18080/metrics +返回 Prometheus 格式数据: +# HELP active_hosts Number of active hosts +# TYPE active_hosts gauge +active_hosts 0 +... ``` ### 6.4 日志系统