|
|
|
|
@ -8,6 +8,7 @@ import (
|
|
|
|
|
"fmt" |
|
|
|
|
"net" |
|
|
|
|
"net/http" |
|
|
|
|
"net/http/pprof" |
|
|
|
|
"os" |
|
|
|
|
"runtime" |
|
|
|
|
"strings" |
|
|
|
|
@ -368,6 +369,10 @@ func runServe(options serveOptions) error {
|
|
|
|
|
return fmt.Errorf("listening (%s) on %s: %v", name, c.Telemetry.HTTP, err) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if c.Telemetry.EnableProfiling { |
|
|
|
|
pprofHandler(telemetryRouter) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
server := &http.Server{ |
|
|
|
|
Handler: telemetryRouter, |
|
|
|
|
} |
|
|
|
|
@ -550,3 +555,11 @@ func applyConfigOverrides(options serveOptions, config *Config) {
|
|
|
|
|
config.Frontend.Dir = os.Getenv("DEX_FRONTEND_DIR") |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func pprofHandler(router *http.ServeMux) { |
|
|
|
|
router.HandleFunc("/debug/pprof/", pprof.Index) |
|
|
|
|
router.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline) |
|
|
|
|
router.HandleFunc("/debug/pprof/profile", pprof.Profile) |
|
|
|
|
router.HandleFunc("/debug/pprof/symbol", pprof.Symbol) |
|
|
|
|
router.HandleFunc("/debug/pprof/trace", pprof.Trace) |
|
|
|
|
} |
|
|
|
|
|