diff --git a/pkg/query-service/app/server.go b/pkg/query-service/app/server.go index 7908e79c18..5ca49ee184 100644 --- a/pkg/query-service/app/server.go +++ b/pkg/query-service/app/server.go @@ -5,6 +5,7 @@ import ( "fmt" "net" "net/http" + _ "net/http/pprof" // http profiler "os" "time" @@ -257,7 +258,15 @@ func (s *Server) Start() error { zap.S().Error("Could not start HTTP server", zap.Error(err)) } s.unavailableChannel <- healthcheck.Unavailable + }() + go func() { + zap.S().Info("Starting pprof server", zap.String("addr", constants.DebugHttpPort)) + + err = http.ListenAndServe(constants.DebugHttpPort, nil) + if err != nil { + zap.S().Error("Could not start HTTP server", zap.Error(err)) + } }() return nil diff --git a/pkg/query-service/main.go b/pkg/query-service/main.go index e02fd0b447..9cede29cd7 100644 --- a/pkg/query-service/main.go +++ b/pkg/query-service/main.go @@ -2,8 +2,6 @@ package main import ( "context" - "net/http" - _ "net/http/pprof" // http profiler "os" "os/signal" "syscall" @@ -35,10 +33,6 @@ func main() { logger := loggerMgr.Sugar() version.PrintVersion() - go func() { - logger.Info(http.ListenAndServe(constants.DebugHttpPort, nil)) - }() - serverOptions := &app.ServerOptions{ // HTTPHostPort: v.GetString(app.HTTPHostPort), // DruidClientUrl: v.GetString(app.DruidClientUrl),