|
|
@ -7,10 +7,12 @@ import ( |
|
|
|
"net" |
|
|
|
"net" |
|
|
|
"path" |
|
|
|
"path" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/grafana/pyroscope-go/godeltaprof/http/pprof" |
|
|
|
"github.com/spf13/pflag" |
|
|
|
"github.com/spf13/pflag" |
|
|
|
"k8s.io/apimachinery/pkg/runtime/schema" |
|
|
|
"k8s.io/apimachinery/pkg/runtime/schema" |
|
|
|
utilerrors "k8s.io/apimachinery/pkg/util/errors" |
|
|
|
utilerrors "k8s.io/apimachinery/pkg/util/errors" |
|
|
|
genericapiserver "k8s.io/apiserver/pkg/server" |
|
|
|
genericapiserver "k8s.io/apiserver/pkg/server" |
|
|
|
|
|
|
|
"k8s.io/apiserver/pkg/server/mux" |
|
|
|
"k8s.io/client-go/tools/clientcmd" |
|
|
|
"k8s.io/client-go/tools/clientcmd" |
|
|
|
netutils "k8s.io/utils/net" |
|
|
|
netutils "k8s.io/utils/net" |
|
|
|
|
|
|
|
|
|
|
@ -178,5 +180,19 @@ func (o *APIServerOptions) RunAPIServer(config *genericapiserver.RecommendedConf |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if config.EnableProfiling { |
|
|
|
|
|
|
|
deltaProfiling{}.Install(server.Handler.NonGoRestfulMux) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return server.PrepareRun().Run(stopCh) |
|
|
|
return server.PrepareRun().Run(stopCh) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// deltaProfiling adds godeltapprof handlers for pprof under /debug/pprof.
|
|
|
|
|
|
|
|
type deltaProfiling struct{} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Install register godeltapprof handlers to the given mux.
|
|
|
|
|
|
|
|
func (d deltaProfiling) Install(c *mux.PathRecorderMux) { |
|
|
|
|
|
|
|
c.UnlistedHandleFunc("/debug/pprof/delta_heap", pprof.Heap) |
|
|
|
|
|
|
|
c.UnlistedHandleFunc("/debug/pprof/delta_block", pprof.Block) |
|
|
|
|
|
|
|
c.UnlistedHandleFunc("/debug/pprof/delta_mutex", pprof.Mutex) |
|
|
|
|
|
|
|
} |
|
|
|