diff --git a/internal/http/server.go b/internal/http/server.go index 31f03536e7..f37e0ce442 100644 --- a/internal/http/server.go +++ b/internal/http/server.go @@ -20,6 +20,7 @@ import ( "fmt" "net/http" "os" + "runtime" "strconv" "time" @@ -151,6 +152,10 @@ func ServeHTTP() { bindAddr := getHTTPAddr() log.Info("management listen", zap.String("addr", bindAddr)) server = &http.Server{Handler: metricsServer, Addr: bindAddr, ReadTimeout: 10 * time.Second} + // enable mutex && block profile, sampling rate 10% + runtime.SetMutexProfileFraction(10) + runtime.SetBlockProfileRate(10) + if err := server.ListenAndServe(); err != nil { log.Error("handle metrics failed", zap.Error(err)) }