-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
36 lines (28 loc) · 735 Bytes
/
main.go
File metadata and controls
36 lines (28 loc) · 735 Bytes
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
package main
import (
"fmt"
"net/http"
"net/http/pprof"
"time"
"github.com/arl/statsviz"
)
func Mux() *http.ServeMux {
mux := http.NewServeMux()
mux.HandleFunc("/debug/pprof/", 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)
statsviz.Register(mux)
// Liveness handler
mux.HandleFunc("/liveness", func(w http.ResponseWriter, r *http.Request) {
time.Sleep(time.Millisecond * 10)
fmt.Fprintln(w, "OK")
})
return mux
}
func main() {
if err := http.ListenAndServe("0.0.0.0:3010", Mux()); err != nil {
fmt.Println("Server Error")
}
}