-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add pprof endpoints if enabled in configuration
- Loading branch information
Jonas Falck
committed
Nov 6, 2024
1 parent
9fbd0a2
commit 01df611
Showing
2 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package main | ||
|
||
import ( | ||
"net/http" | ||
"net/http/pprof" | ||
) | ||
|
||
func enablePPROF() { | ||
prefix := "GET " | ||
http.HandleFunc(prefix+"/debug/pprof/", pprof.Index) | ||
http.HandleFunc(prefix+"/debug/pprof/cmdline", pprof.Cmdline) | ||
http.HandleFunc(prefix+"/debug/pprof/profile", pprof.Profile) | ||
http.HandleFunc(prefix+"/debug/pprof/symbol", pprof.Symbol) | ||
http.HandleFunc(prefix+"/debug/pprof/trace", pprof.Trace) | ||
} |