From 9ba0b84a917f83bb23b35bfbab5d6121962f58d9 Mon Sep 17 00:00:00 2001 From: Prashant Shahi Date: Fri, 13 May 2022 03:38:00 +0530 Subject: [PATCH] =?UTF-8?q?refactor(query-service):=20=E2=99=BB=EF=B8=8F?= =?UTF-8?q?=20=20move=20pprof=20to=20server.go?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Prashant Shahi --- pkg/query-service/app/server.go | 9 +++++++++ pkg/query-service/main.go | 6 ------ 2 files changed, 9 insertions(+), 6 deletions(-) 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),