frostfs-s3-gw/cmd/gate/app-profiler.go
2020-07-13 02:05:51 +03:00

23 lines
513 B
Go

package main
import (
"net/http/pprof"
"github.com/gorilla/mux"
"github.com/spf13/viper"
"go.uber.org/zap"
)
func attachProfiler(v *viper.Viper, l *zap.Logger, r *mux.Router) {
if !v.GetBool(cfgEnableProfiler) {
return
}
l.Info("enable profiler")
r.HandleFunc("/debug/pprof/", pprof.Index)
r.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
r.HandleFunc("/debug/pprof/profile", pprof.Profile)
r.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
r.HandleFunc("/debug/pprof/trace", pprof.Trace)
}