diff --git a/pkg/monitor/service/handlers.go b/pkg/monitor/service/handlers.go index 28bb5519a1..e2e6bd5e00 100644 --- a/pkg/monitor/service/handlers.go +++ b/pkg/monitor/service/handlers.go @@ -31,6 +31,7 @@ import ( "yunion.io/x/onecloud/pkg/cloudcommon/db/taskman" common_options "yunion.io/x/onecloud/pkg/cloudcommon/options" "yunion.io/x/onecloud/pkg/monitor/models" + "yunion.io/x/onecloud/pkg/monitor/options" ) func InitHandlers(app *appsrv.Application) { @@ -134,5 +135,7 @@ func addMiscHandlers(app *appsrv.Application, root *mux.Router) { root.HandleFunc("/worker_stats", adapterF(appsrv.WorkerStatsHandler)) // pprof handler - root.PathPrefix("/debug/pprof/").Handler(http.DefaultServeMux) + if options.Options.EnableAppProfiling { + root.PathPrefix("/debug/pprof/").Handler(http.DefaultServeMux) + } } diff --git a/pkg/webconsole/service/service.go b/pkg/webconsole/service/service.go index b73fc1a658..323d5ec99b 100644 --- a/pkg/webconsole/service/service.go +++ b/pkg/webconsole/service/service.go @@ -141,5 +141,7 @@ func addMiscHandlers(app *appsrv.Application, root *mux.Router) { root.HandleFunc("/worker_stats", adapterF(appsrv.WorkerStatsHandler)) // pprof handler - root.PathPrefix("/debug/pprof/").Handler(http.DefaultServeMux) + if o.Options.EnableAppProfiling { + root.PathPrefix("/debug/pprof/").Handler(http.DefaultServeMux) + } }