mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Moved pprof server on http server
This commit is contained in:
committed by
Dan Christian Bogos
parent
ac24c23cbf
commit
3ee8539908
@@ -22,8 +22,6 @@ import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
_ "net/http/pprof"
|
||||
"os"
|
||||
"os/signal"
|
||||
"path"
|
||||
@@ -1140,13 +1138,6 @@ func schedCDRsConns(internalCDRSChan chan rpcclient.RpcClientConnection, exitCha
|
||||
engine.SetSchedCdrsConns(cdrsConn)
|
||||
}
|
||||
|
||||
func startProfServer(adress string) {
|
||||
go func() {
|
||||
if err := http.ListenAndServe(adress, nil); err != nil {
|
||||
utils.Logger.Err(fmt.Sprintf("<HTTPPprof> could not start HTTP server for profiling: %v", err.Error()))
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
func memProfFile(memProfPath string) bool {
|
||||
f, err := os.Create(memProfPath)
|
||||
@@ -1258,9 +1249,7 @@ func main() {
|
||||
lgLevel = *logLevel
|
||||
}
|
||||
utils.Logger.SetLogLevel(lgLevel)
|
||||
if cfg.GeneralCfg().EnableHTTPPprof {
|
||||
startProfServer(cfg.ListenCfg().HTTPPprof)
|
||||
}
|
||||
|
||||
var loadDb engine.LoadStorage
|
||||
var cdrDb engine.CdrStorage
|
||||
var dm *engine.DataManager
|
||||
|
||||
@@ -51,7 +51,6 @@ const CGRATES_CFG_JSON = `
|
||||
"digest_separator": ",",
|
||||
"digest_equal": ":",
|
||||
"rsr_separator": ";",
|
||||
"enable_http_pprof":false, // enables the http server used for profiling
|
||||
},
|
||||
|
||||
|
||||
@@ -87,7 +86,6 @@ const CGRATES_CFG_JSON = `
|
||||
"rpc_json_tls" : "127.0.0.1:2022", // RPC JSON TLS listening address
|
||||
"rpc_gob_tls": "127.0.0.1:2023", // RPC GOB TLS listening address
|
||||
"http_tls": "127.0.0.1:2280", // HTTP TLS listening address
|
||||
"http_pprof": "127.0.0.1:2081" // HTTP pprof server address
|
||||
},
|
||||
|
||||
|
||||
|
||||
@@ -61,7 +61,6 @@ func TestDfGeneralJsonCfg(t *testing.T) {
|
||||
Digest_separator: utils.StringPointer(","),
|
||||
Digest_equal: utils.StringPointer(":"),
|
||||
Rsr_separator: utils.StringPointer(";"),
|
||||
Enable_http_pprof: utils.BoolPointer(false),
|
||||
}
|
||||
if gCfg, err := dfCgrJsonCfg.GeneralJsonCfg(); err != nil {
|
||||
t.Error(err)
|
||||
@@ -172,7 +171,6 @@ func TestDfListenJsonCfg(t *testing.T) {
|
||||
Rpc_json_tls: utils.StringPointer("127.0.0.1:2022"),
|
||||
Rpc_gob_tls: utils.StringPointer("127.0.0.1:2023"),
|
||||
Http_tls: utils.StringPointer("127.0.0.1:2280"),
|
||||
Http_pprof: utils.StringPointer("127.0.0.1:2081"),
|
||||
}
|
||||
if cfg, err := dfCgrJsonCfg.ListenJsonCfg(); err != nil {
|
||||
t.Error(err)
|
||||
|
||||
@@ -50,7 +50,6 @@ type GeneralCfg struct {
|
||||
DigestSeparator string //
|
||||
DigestEqual string //
|
||||
RsrSepatarot string // separator used to split RSRParser (by degault is used ";")
|
||||
EnableHTTPPprof bool // enables the http server used for profiling
|
||||
}
|
||||
|
||||
//loadFromJsonCfg loads General config from JsonCfg
|
||||
@@ -138,8 +137,6 @@ func (gencfg *GeneralCfg) loadFromJsonCfg(jsnGeneralCfg *GeneralJsonCfg) (err er
|
||||
if jsnGeneralCfg.Rsr_separator != nil {
|
||||
gencfg.RsrSepatarot = *jsnGeneralCfg.Rsr_separator
|
||||
}
|
||||
if jsnGeneralCfg.Enable_http_pprof != nil {
|
||||
gencfg.EnableHTTPPprof = *jsnGeneralCfg.Enable_http_pprof
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -43,7 +43,6 @@ type GeneralJsonCfg struct {
|
||||
Digest_separator *string
|
||||
Digest_equal *string
|
||||
Rsr_separator *string
|
||||
Enable_http_pprof *bool
|
||||
}
|
||||
|
||||
// Listen config section
|
||||
@@ -54,7 +53,6 @@ type ListenJsonCfg struct {
|
||||
Rpc_json_tls *string
|
||||
Rpc_gob_tls *string
|
||||
Http_tls *string
|
||||
Http_pprof *string
|
||||
}
|
||||
|
||||
// HTTP config section
|
||||
|
||||
@@ -26,8 +26,6 @@ type ListenCfg struct {
|
||||
RPCJSONTLSListen string // RPC JSON TLS listening address
|
||||
RPCGOBTLSListen string // RPC GOB TLS listening address
|
||||
HTTPTLSListen string // HTTP TLS listening address
|
||||
HTTPPprof string // HTTP pprof server address
|
||||
|
||||
}
|
||||
|
||||
//loadFromJsonCfg loads Database config from JsonCfg
|
||||
@@ -53,8 +51,5 @@ func (lstcfg *ListenCfg) loadFromJsonCfg(jsnListenCfg *ListenJsonCfg) (err error
|
||||
if jsnListenCfg.Http_tls != nil && *jsnListenCfg.Http_tls != "" {
|
||||
lstcfg.HTTPTLSListen = *jsnListenCfg.Http_tls
|
||||
}
|
||||
if jsnListenCfg.Http_pprof != nil && *jsnListenCfg.Http_pprof != "" {
|
||||
lstcfg.HTTPPprof = *jsnListenCfg.Http_pprof
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
// "digest_separator": ",",
|
||||
// "digest_equal": ":",
|
||||
// "rsr_separator": ";",
|
||||
// "enable_http_pprof":false, // enables the http server used for profiling
|
||||
// },
|
||||
|
||||
|
||||
@@ -66,7 +65,6 @@
|
||||
// "rpc_json_tls" : "127.0.0.1:2022", // RPC JSON TLS listening address
|
||||
// "rpc_gob_tls": "127.0.0.1:2023", // RPC GOB TLS listening address
|
||||
// "http_tls": "127.0.0.1:2280", // HTTP TLS listening address
|
||||
// "http_pprof": "127.0.0.1:2081" // HTTP pprof server address
|
||||
// },
|
||||
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import (
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
_ "net/http/pprof"
|
||||
"net/rpc"
|
||||
"net/rpc/jsonrpc"
|
||||
"reflect"
|
||||
|
||||
Reference in New Issue
Block a user