pprof

package
v0.13.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2022 License: Apache-2.0 Imports: 5 Imported by: 19

Documentation

Overview

Package pprof contains a helper to register pprof endpoints on a controller-runtime manager.

Index

Constants

View Source
const HTTPPrefixPProf = "/debug/pprof"

HTTPPrefixPProf is the prefix appended to all Endpoints.

Variables

View Source
var Endpoints = map[string]http.Handler{
	HTTPPrefixPProf + "/":             http.HandlerFunc(pprof.Index),
	HTTPPrefixPProf + "/cmdline":      http.HandlerFunc(pprof.Cmdline),
	HTTPPrefixPProf + "/profile":      http.HandlerFunc(pprof.Profile),
	HTTPPrefixPProf + "/symbol":       http.HandlerFunc(pprof.Symbol),
	HTTPPrefixPProf + "/trace":        http.HandlerFunc(pprof.Trace),
	HTTPPrefixPProf + "/heap":         pprof.Handler("heap"),
	HTTPPrefixPProf + "/goroutine":    pprof.Handler("goroutine"),
	HTTPPrefixPProf + "/threadcreate": pprof.Handler("threadcreate"),
	HTTPPrefixPProf + "/block":        pprof.Handler("block"),
	HTTPPrefixPProf + "/mutex":        pprof.Handler("mutex"),
}

Endpoints defines the debugging endpoints that are added by SetupHandlers.

Functions

func SetupHandlers

func SetupHandlers(mgr ctrl.Manager, log logr.Logger)

SetupHandlers registers the pprof endpoints on the metrics server of the given mgr.

The func can be used in the main.go file of your controller, after initialisation of the manager:

func main() {
	mgr, err := ctrl.NewManager(cfg, ctrl.Options{})
	if err != nil {
		log.Error(err, "unable to start manager")
		os.Exit(1)
	}
	pprof.SetupHandlers(mgr, log)
}

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL