mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(webconsole,monitor): pprof handlers of gorilla mux
This commit is contained in:
@@ -15,10 +15,8 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net"
|
||||
"net/http"
|
||||
_ "net/http/pprof"
|
||||
"net/url"
|
||||
"os"
|
||||
"strconv"
|
||||
@@ -100,7 +98,7 @@ func start() {
|
||||
root.Handle(WebsocketProxyPathPrefix, srv)
|
||||
|
||||
// misc handler
|
||||
addMiscHandlers(app, root)
|
||||
appsrv.AddMiscHandlersToMuxRouter(app, root, o.Options.EnableAppProfiling)
|
||||
|
||||
cron := cronman.InitCronJobManager(true, o.Options.CronJobWorkerCount, o.Options.TimeZone)
|
||||
|
||||
@@ -126,22 +124,3 @@ func start() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func addMiscHandlers(app *appsrv.Application, root *mux.Router) {
|
||||
adapterF := func(appHandleFunc func(ctx context.Context, w http.ResponseWriter, r *http.Request)) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
appHandleFunc(app.GetContext(), w, r)
|
||||
}
|
||||
}
|
||||
|
||||
// ref: pkg/appsrv/appsrv:addDefaultHandlers
|
||||
root.HandleFunc("/version", adapterF(appsrv.VersionHandler))
|
||||
root.HandleFunc("/stats", adapterF(appsrv.StatisticHandler))
|
||||
root.HandleFunc("/ping", adapterF(appsrv.PingHandler))
|
||||
root.HandleFunc("/worker_stats", adapterF(appsrv.WorkerStatsHandler))
|
||||
|
||||
// pprof handler
|
||||
if o.Options.EnableAppProfiling {
|
||||
root.PathPrefix("/debug/pprof/").Handler(http.DefaultServeMux)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user