github.com/kubeshop/testkube@v1.17.23/internal/app/api/debug/server.go (about)

     1  package debug
     2  
     3  import (
     4  	"net/http"
     5  	"net/http/pprof"
     6  )
     7  
     8  func NewDebugServer(addr string) *http.Server {
     9  	mux := http.NewServeMux()
    10  	mux.HandleFunc("/debug/pprof/", pprof.Index)
    11  	mux.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
    12  	mux.HandleFunc("/debug/pprof/profile", pprof.Profile)
    13  	mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
    14  	mux.HandleFunc("/debug/pprof/trace", pprof.Trace)
    15  	return &http.Server{
    16  		Addr:    addr,
    17  		Handler: mux,
    18  	}
    19  }