Browse Source

Support configuring pprof HTTP server.

See http://golang.org/pkg/net/http/pprof/ for details.
pull/12/head
Joachim Bauch 11 years ago
parent
commit
5eb8ebe51c
  1. 1
      server.conf.in
  2. 9
      src/app/spreed-speakfreely-server/main.go

1
server.conf.in

@ -8,6 +8,7 @@ listen = 127.0.0.1:8080 @@ -8,6 +8,7 @@ listen = 127.0.0.1:8080
#basePath = /some/sub/path/ # Set this when running behind a web server under a sub path.
#maxfd = 32768 # Try to set max open files limit on start (works only when run as root).
#stats = true # Provide stats API at /api/v1/stats (do not enable this in production or unprotected!).
#pprofListen = 127.0.0.1:6060 # See http://golang.org/pkg/net/http/pprof/ for details
[app]
#title = Spreed Speak Freely

9
src/app/spreed-speakfreely-server/main.go

@ -31,6 +31,7 @@ import ( @@ -31,6 +31,7 @@ import (
"html/template"
"log"
"net/http"
_ "net/http/pprof"
"os"
"path"
goruntime "runtime"
@ -153,6 +154,14 @@ func runner(runtime phoenix.Runtime) error { @@ -153,6 +154,14 @@ func runner(runtime phoenix.Runtime) error {
statsEnabled = false
}
pprofListen, err := runtime.GetString("http", "pprofListen")
if err == nil && pprofListen != "" {
log.Printf("Starting pprof HTTP server on %s", pprofListen)
go func() {
log.Println(http.ListenAndServe(pprofListen, nil))
}()
}
sessionSecret, err := runtime.GetString("app", "sessionSecret")
if err != nil {
return fmt.Errorf("No sessionSecret in config file.")

Loading…
Cancel
Save