docs: 更新验证报告,记录 metrics 端点修复
This commit is contained in:
@@ -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 日志系统
|
||||
|
||||
Reference in New Issue
Block a user