mirror of
https://github.com/kubernetes/node-problem-detector.git
synced 2026-03-02 01:30:26 +00:00
Merge pull request #828 from j4ckstraw/fix-pprof
fix: fix pprof by using DefaultServeMux
This commit is contained in:
@@ -20,7 +20,7 @@ import (
|
||||
"context"
|
||||
"net"
|
||||
"net/http"
|
||||
_ "net/http/pprof"
|
||||
"net/http/pprof"
|
||||
"strconv"
|
||||
|
||||
"k8s.io/klog/v2"
|
||||
@@ -95,6 +95,13 @@ func (ke *k8sExporter) startHTTPReporting(npdo *options.NodeProblemDetectorOptio
|
||||
util.ReturnHTTPJson(w, ke.conditionManager.GetConditions())
|
||||
})
|
||||
|
||||
// register pprof
|
||||
mux.HandleFunc("/debug/pprof/", pprof.Index)
|
||||
mux.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
|
||||
mux.HandleFunc("/debug/pprof/profile", pprof.Profile)
|
||||
mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
|
||||
mux.HandleFunc("/debug/pprof/trace", pprof.Trace)
|
||||
|
||||
addr := net.JoinHostPort(npdo.ServerAddress, strconv.Itoa(npdo.ServerPort))
|
||||
go func() {
|
||||
err := http.ListenAndServe(addr, mux)
|
||||
|
||||
Reference in New Issue
Block a user