mirror of
https://github.com/coredns/coredns.git
synced 2025-11-01 02:33:14 -04:00
plugin/pprof - add option to enable block profiling (#2729)
* - add an option for block profiling to plugin pprof * - move option block into nested block
This commit is contained in:
committed by
Miek Gieben
parent
f6eb2a4c14
commit
c144da2524
@@ -6,12 +6,14 @@ import (
|
||||
"net"
|
||||
"net/http"
|
||||
pp "net/http/pprof"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
type handler struct {
|
||||
addr string
|
||||
ln net.Listener
|
||||
mux *http.ServeMux
|
||||
addr string
|
||||
rateBloc int
|
||||
ln net.Listener
|
||||
mux *http.ServeMux
|
||||
}
|
||||
|
||||
func (h *handler) Startup() error {
|
||||
@@ -30,6 +32,8 @@ func (h *handler) Startup() error {
|
||||
h.mux.HandleFunc(path+"/symbol", pp.Symbol)
|
||||
h.mux.HandleFunc(path+"/trace", pp.Trace)
|
||||
|
||||
runtime.SetBlockProfileRate(h.rateBloc)
|
||||
|
||||
go func() {
|
||||
http.Serve(h.ln, h.mux)
|
||||
}()
|
||||
|
||||
Reference in New Issue
Block a user