mirror of
https://github.com/foomo/keel.git
synced 2025-10-16 12:35:34 +00:00
37 lines
771 B
Go
37 lines
771 B
Go
//go:build pprof
|
|
// +build pprof
|
|
|
|
package service
|
|
|
|
import (
|
|
"net/http"
|
|
"net/http/pprof"
|
|
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
var (
|
|
DefaultHTTPPProfName = "pprof"
|
|
DefaultHTTPPProfAddr = "localhost:6060"
|
|
DefaultHTTPPProfPath = "/debug/pprof"
|
|
)
|
|
|
|
func NewHTTPPProf(l *zap.Logger, name, addr, path string) *HTTP {
|
|
handler := http.NewServeMux()
|
|
handler.HandleFunc(path+"/", pprof.Index)
|
|
handler.HandleFunc(path+"/cmdline", pprof.Cmdline)
|
|
handler.HandleFunc(path+"/profile", pprof.Profile)
|
|
handler.HandleFunc(path+"/symbol", pprof.Symbol)
|
|
handler.HandleFunc(path+"/trace", pprof.Trace)
|
|
return NewHTTP(l, name, addr, handler)
|
|
}
|
|
|
|
func NewDefaultHTTPPProf(l *zap.Logger) *HTTP {
|
|
return NewHTTPPProf(
|
|
l,
|
|
DefaultHTTPPProfName,
|
|
DefaultHTTPPProfAddr,
|
|
DefaultHTTPPProfPath,
|
|
)
|
|
}
|