fix(metrics): 在主路由中注册 /metrics 端点
- 添加 metrics 包导入 - 在主 handler 中注册 GET /metrics 路由
This commit is contained in:
@@ -24,6 +24,7 @@ import (
|
||||
"sub2api-cn-relay-manager/internal/store/sqlite"
|
||||
|
||||
"sub2api-cn-relay-manager/internal/access"
|
||||
"sub2api-cn-relay-manager/internal/metrics"
|
||||
)
|
||||
|
||||
// 版本信息变量,在构建时通过 -ldflags 注入
|
||||
@@ -336,6 +337,7 @@ func NewAPIHandlerWithAuth(adminAuth AdminAuthConfig, actions ActionSet) http.Ha
|
||||
mux := http.NewServeMux()
|
||||
mux.HandleFunc("GET /healthz", healthz)
|
||||
mux.HandleFunc("GET /version", handleVersion)
|
||||
mux.Handle("GET /metrics", metrics.Handler())
|
||||
mux.HandleFunc("GET /api/admin/session", func(w http.ResponseWriter, r *http.Request) {
|
||||
handleAdminSessionState(w, r, adminAuth)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user