mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Debug info for version and identifying exrta fields in map
This commit is contained in:
@@ -34,8 +34,8 @@ import (
|
||||
|
||||
"github.com/cgrates/cgrates/agents"
|
||||
"github.com/cgrates/cgrates/analyzers"
|
||||
"github.com/cgrates/cgrates/apier/v1"
|
||||
"github.com/cgrates/cgrates/apier/v2"
|
||||
v1 "github.com/cgrates/cgrates/apier/v1"
|
||||
v2 "github.com/cgrates/cgrates/apier/v2"
|
||||
"github.com/cgrates/cgrates/cdrc"
|
||||
"github.com/cgrates/cgrates/config"
|
||||
"github.com/cgrates/cgrates/dispatchers"
|
||||
@@ -1331,8 +1331,9 @@ func shutdownSingnalHandler(exitChan chan bool) {
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
vers := utils.GetCGRVersion()
|
||||
if *version {
|
||||
fmt.Println(utils.GetCGRVersion())
|
||||
fmt.Println(vers)
|
||||
return
|
||||
}
|
||||
if *pidFile != "" {
|
||||
@@ -1365,6 +1366,7 @@ func main() {
|
||||
return
|
||||
}()
|
||||
}
|
||||
utils.Logger.Debug(fmt.Sprintf("Starting CGRateS with version <%s>", vers))
|
||||
var err error
|
||||
// Init config
|
||||
cfg, err = config.NewCGRConfigFromFolder(*cfgDir)
|
||||
|
||||
@@ -160,6 +160,7 @@ func (me MapEvent) AsCDR(cfg *config.CGRConfig, tnt, tmz string) (cdr *CDR, err
|
||||
cdr = &CDR{Tenant: tnt, Cost: -1.0, ExtraFields: make(map[string]string)}
|
||||
for k, v := range me {
|
||||
if !utils.IsSliceMember(utils.NotExtraCDRFields, k) { // not primary field, populate extra ones
|
||||
utils.Logger.Debug(fmt.Sprintf("field <%s> as extra since is not present in %s", k, utils.ToJSON(utils.NotExtraCDRFields)))
|
||||
if cdr.ExtraFields[k], err = utils.IfaceAsString(v); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -535,6 +535,7 @@ func (rs *Responder) Status(arg string, reply *map[string]interface{}) (err erro
|
||||
response["MemoryUsage"] = utils.SizeFmt(float64(memstats.HeapAlloc), "")
|
||||
response[utils.ActiveGoroutines] = runtime.NumGoroutine()
|
||||
response["Footprint"] = utils.SizeFmt(float64(memstats.Sys), "")
|
||||
response[utils.Version] = utils.GetCGRVersion
|
||||
*reply = response
|
||||
return
|
||||
}
|
||||
|
||||
@@ -542,6 +542,7 @@ const (
|
||||
TCP = "tcp"
|
||||
CGRDebitInterval = "CGRDebitInterval"
|
||||
MetaAsr = "*asr"
|
||||
Version = "Version"
|
||||
)
|
||||
|
||||
// Migrator Action
|
||||
|
||||
Reference in New Issue
Block a user