Created
February 16, 2023 20:01
-
-
Save gebv/7ec7819f48a408b4c2d83753e9b1b7bf to your computer and use it in GitHub Desktop.
Golang debug handlers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
mux.Handle("/debug/pprof/block", pprof.Handler("block")) | |
mux.Handle("/debug/pprof/heap", pprof.Handler("heap")) | |
mux.Handle("/debug/pprof/goroutine", pprof.Handler("goroutine")) | |
mux.Handle("/debug/pprof/threadcreate", pprof.Handler("threadcreate")) | |
mux.Handle("/debug/vars", expvar.Handler()) | |
mux.HandleFunc("/debug/requests", trace.Traces) | |
mux.HandleFunc("/debug/events", trace.Events) | |
mux.Handle("/debug/gc", http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { | |
runtime.GC() | |
l.Warn("triggered GC from debug endpoint") | |
})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment