Merge pull request #1723 from aledbf/timoeuts

Add timeouts to http server and additional pprof routes
This commit is contained in:
Manuel Alejandro de Brito Fontes 2017-11-18 07:33:14 -03:00 committed by GitHub
commit 99d68803da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -302,6 +302,12 @@ func registerHandlers(enableProfiling bool, port int, ic *controller.NGINXContro
if enableProfiling {
mux.HandleFunc("/debug/pprof/", pprof.Index)
mux.HandleFunc("/debug/pprof/heap", pprof.Index)
mux.HandleFunc("/debug/pprof/mutex", pprof.Index)
mux.HandleFunc("/debug/pprof/goroutine", pprof.Index)
mux.HandleFunc("/debug/pprof/threadcreate", pprof.Index)
mux.HandleFunc("/debug/pprof/block", pprof.Index)
mux.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
mux.HandleFunc("/debug/pprof/profile", pprof.Profile)
mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
mux.HandleFunc("/debug/pprof/trace", pprof.Trace)
@ -310,6 +316,8 @@ func registerHandlers(enableProfiling bool, port int, ic *controller.NGINXContro
server := &http.Server{
Addr: fmt.Sprintf(":%v", port),
Handler: mux,
ReadTimeout: 10 * time.Second,
WriteTimeout: 30 * time.Second,
}
glog.Fatal(server.ListenAndServe())
}