MCPcopy Index your code
hub / github.com/VictoriaMetrics/VictoriaLogs / pprofHandler

Function pprofHandler

lib/httpserver/httpserver.go:513–542  ·  view source on GitHub ↗
(profileName string, w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

511}
512
513func pprofHandler(profileName string, w http.ResponseWriter, r *http.Request) {
514 // This switch has been stolen from init func at https://golang.org/src/net/http/pprof/pprof.go
515 switch profileName {
516 case "cmdline":
517 pprofCmdlineRequests.Inc()
518 pprof.Cmdline(w, r)
519 case "profile":
520 pprofProfileRequests.Inc()
521 pprof.Profile(w, r)
522 case "symbol":
523 pprofSymbolRequests.Inc()
524 pprof.Symbol(w, r)
525 case "trace":
526 pprofTraceRequests.Inc()
527 pprof.Trace(w, r)
528 case "mutex":
529 pprofMutexRequests.Inc()
530 seconds, _ := strconv.Atoi(r.FormValue("seconds"))
531 if seconds <= 0 {
532 seconds = 10
533 }
534 prev := runtime.SetMutexProfileFraction(10)
535 time.Sleep(time.Duration(seconds) * time.Second)
536 pprof.Index(w, r)
537 runtime.SetMutexProfileFraction(prev)
538 default:
539 pprofDefaultRequests.Inc()
540 pprof.Index(w, r)
541 }
542}
543
544var (
545 metricsRequests = metrics.NewCounter(`vm_http_requests_total{path="/metrics"}`)

Callers 1

builtinRoutesHandlerFunction · 0.85

Calls 1

DurationMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…