refactor(query-service): ♻️ move pprof to server.go

Signed-off-by: Prashant Shahi <prashant@signoz.io>
This commit is contained in:
Prashant Shahi 2022-05-13 03:38:00 +05:30
parent ac06b02d52
commit 9ba0b84a91
No known key found for this signature in database
GPG Key ID: 6E62ED14180EB2C0
2 changed files with 9 additions and 6 deletions

View File

@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"net" "net"
"net/http" "net/http"
_ "net/http/pprof" // http profiler
"os" "os"
"time" "time"
@ -257,7 +258,15 @@ func (s *Server) Start() error {
zap.S().Error("Could not start HTTP server", zap.Error(err)) zap.S().Error("Could not start HTTP server", zap.Error(err))
} }
s.unavailableChannel <- healthcheck.Unavailable 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 return nil

View File

@ -2,8 +2,6 @@ package main
import ( import (
"context" "context"
"net/http"
_ "net/http/pprof" // http profiler
"os" "os"
"os/signal" "os/signal"
"syscall" "syscall"
@ -35,10 +33,6 @@ func main() {
logger := loggerMgr.Sugar() logger := loggerMgr.Sugar()
version.PrintVersion() version.PrintVersion()
go func() {
logger.Info(http.ListenAndServe(constants.DebugHttpPort, nil))
}()
serverOptions := &app.ServerOptions{ serverOptions := &app.ServerOptions{
// HTTPHostPort: v.GetString(app.HTTPHostPort), // HTTPHostPort: v.GetString(app.HTTPHostPort),
// DruidClientUrl: v.GetString(app.DruidClientUrl), // DruidClientUrl: v.GetString(app.DruidClientUrl),