-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.go
37 lines (32 loc) · 1.04 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main
import (
"fmt"
"net/http"
"net/http/pprof"
"os"
"github.com/gorilla/mux"
"github.com/quorumcontrol/tupelo/signer/cmd"
)
func main() {
if os.Getenv("TUPELO_PPROF_ENABLED") == "true" {
go func() {
debugR := mux.NewRouter()
debugR.HandleFunc("/debug/pprof/", pprof.Index)
debugR.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
debugR.HandleFunc("/debug/pprof/profile", pprof.Profile)
debugR.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
debugR.HandleFunc("/debug/pprof/trace", pprof.Trace)
debugR.Handle("/debug/pprof/mutex", pprof.Handler("mutex"))
debugR.Handle("/debug/pprof/allocs", pprof.Handler("allocs"))
debugR.Handle("/debug/pprof/heap", pprof.Handler("heap"))
debugR.Handle("/debug/pprof/goroutine", pprof.Handler("goroutine"))
debugR.Handle("/debug/pprof/block", pprof.Handler("block"))
debugR.Handle("/debug/pprof/threadcreate", pprof.Handler("threadcreate"))
err := http.ListenAndServe(":8080", debugR)
if err != nil {
fmt.Println(err.Error())
}
}()
}
cmd.Execute()
}