feat(relay-server): mount /metrics on admin endpoint (auth-gated)

cognitive committed Apr 30, 2026 at 04:44 UTC e20e9f9de69332370ee1ed77c2c2836af3e084c6
1 file changed +4
cmd/relay-server/admin.go
+4
@@ -12,6 +12,7 @@ import (
12 "github.com/gosuda/portal-tunnel/v2/portal/policy"
13 "github.com/gosuda/portal-tunnel/v2/types"
14 "github.com/gosuda/portal-tunnel/v2/utils"
15 + "github.com/prometheus/client_golang/prometheus/promhttp"
16 )
17
18 const (
@@ -168,6 +169,9 @@ func (f *Frontend) serveAdmin(w http.ResponseWriter, r *http.Request) {
169 invalidRequestBody := utils.InvalidRequestError(errors.New("invalid request body"))
170
171 switch path {
172 + case "/admin/metrics":
173 + promhttp.Handler().ServeHTTP(w, r)
174 + return
175 case types.PathAdminSnapshot:
176 if !utils.RequireMethod(w, r, http.MethodGet) {
177 return