Add pprof
This commit is contained in:
parent
090e484e72
commit
473255dbde
|
@ -18,6 +18,7 @@ const (
|
||||||
type HMNConfig struct {
|
type HMNConfig struct {
|
||||||
Env Environment
|
Env Environment
|
||||||
Addr string
|
Addr string
|
||||||
|
PrivateAddr string
|
||||||
BaseUrl string
|
BaseUrl string
|
||||||
LogLevel zerolog.Level
|
LogLevel zerolog.Level
|
||||||
Postgres PostgresConfig
|
Postgres PostgresConfig
|
||||||
|
|
|
@ -3,7 +3,9 @@ package website
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
_ "net/http/pprof"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"time"
|
"time"
|
||||||
|
@ -58,6 +60,10 @@ var WebsiteCommand = &cobra.Command{
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
log.Println(http.ListenAndServe(config.Config.PrivateAddr, nil))
|
||||||
|
}()
|
||||||
|
|
||||||
logging.Info().Str("addr", config.Config.Addr).Msg("Serving the website")
|
logging.Info().Str("addr", config.Config.Addr).Msg("Serving the website")
|
||||||
serverErr := server.ListenAndServe()
|
serverErr := server.ListenAndServe()
|
||||||
if !errors.Is(serverErr, http.ErrServerClosed) {
|
if !errors.Is(serverErr, http.ErrServerClosed) {
|
||||||
|
|
Loading…
Reference in New Issue