mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-07 01:28:27 +08:00
enhance: enable profile and block profiling (#34642)
fix #34641 Signed-off-by: xiaofanluan <xiaofan.luan@zilliz.com>
This commit is contained in:
parent
a11714913b
commit
7eaef09ba5
@ -20,6 +20,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -151,6 +152,10 @@ func ServeHTTP() {
|
|||||||
bindAddr := getHTTPAddr()
|
bindAddr := getHTTPAddr()
|
||||||
log.Info("management listen", zap.String("addr", bindAddr))
|
log.Info("management listen", zap.String("addr", bindAddr))
|
||||||
server = &http.Server{Handler: metricsServer, Addr: bindAddr, ReadTimeout: 10 * time.Second}
|
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 {
|
if err := server.ListenAndServe(); err != nil {
|
||||||
log.Error("handle metrics failed", zap.Error(err))
|
log.Error("handle metrics failed", zap.Error(err))
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user