-
Notifications
You must be signed in to change notification settings - Fork 0
/
pprof.go
51 lines (41 loc) · 1.03 KB
/
pprof.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package pprof
import (
"context"
"net/http/pprof"
"github.com/boxgo/box/pkg/insight"
)
type (
PProf struct {
cfg *Config
}
)
var (
Default = StdConfig().Build()
)
func newPProf(cfg *Config) *PProf {
pp := &PProf{
cfg: cfg,
}
insight.GetF("/debug/pprof/", pprof.Index)
insight.GetF("/debug/pprof/allocs", pprof.Index)
insight.GetF("/debug/pprof/block", pprof.Index)
insight.GetF("/debug/pprof/cmdline", pprof.Cmdline)
insight.GetF("/debug/pprof/goroutine", pprof.Index)
insight.GetF("/debug/pprof/heap", pprof.Index)
insight.GetF("/debug/pprof/mutex", pprof.Index)
insight.GetF("/debug/pprof/profile", pprof.Profile)
insight.GetF("/debug/pprof/threadcreate", pprof.Index)
insight.GetF("/debug/pprof/symbol", pprof.Symbol)
insight.PostF("/debug/pprof/symbol", pprof.Symbol)
insight.GetF("/debug/pprof/trace", pprof.Trace)
return pp
}
func (pp *PProf) Name() string {
return "pprof"
}
func (pp *PProf) Serve(ctx context.Context) error {
return nil
}
func (pp *PProf) Shutdown(ctx context.Context) error {
return nil
}