mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 10:06:24 +05:00
Add CAPs counting to cgr-console status command
This commit is contained in:
committed by
Dan Christian Bogos
parent
49d6b8d565
commit
9be32c36da
@@ -49,6 +49,7 @@ func NewCoreService(cfg *config.CGRConfig, caps *engine.Caps, fileCPU io.Closer,
|
||||
CapsStats: st,
|
||||
fileCPU: fileCPU,
|
||||
fileMEM: fileMem,
|
||||
caps: caps,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,6 +62,7 @@ type CoreService struct {
|
||||
fileMEM string
|
||||
fileCPU io.Closer
|
||||
fileMx sync.Mutex
|
||||
caps *engine.Caps
|
||||
}
|
||||
|
||||
// Shutdown is called to shutdown the service
|
||||
@@ -141,6 +143,12 @@ func (cS *CoreService) V1Status(_ *context.Context, _ *utils.TenantWithAPIOpts,
|
||||
}
|
||||
response[utils.RunningSince] = utils.GetStartTime()
|
||||
response[utils.GoVersion] = runtime.Version()
|
||||
if cS.cfg.CoreSCfg().Caps != 0 {
|
||||
response[utils.CAPSAllocated] = cS.caps.Allocated()
|
||||
if cS.cfg.CoreSCfg().CapsStatsInterval != 0 {
|
||||
response[utils.CAPSPeak] = cS.CapsStats.GetPeak()
|
||||
}
|
||||
}
|
||||
*reply = response
|
||||
return
|
||||
}
|
||||
|
||||
@@ -47,11 +47,12 @@ func TestNewCoreService(t *testing.T) {
|
||||
stopMemPrf: stopMemPrf,
|
||||
cfg: cfgDflt,
|
||||
CapsStats: sts,
|
||||
caps: caps,
|
||||
}
|
||||
|
||||
rcv := NewCoreService(cfgDflt, caps, nil, "/tmp", stopchan, shdWg, stopMemPrf, shdChan)
|
||||
if !reflect.DeepEqual(expected, rcv) {
|
||||
t.Errorf("Expected %+v, received %+v", utils.ToJSON(expected), utils.ToJSON(rcv))
|
||||
t.Errorf("Expected %+v, received %+v", expected, rcv)
|
||||
}
|
||||
close(stopchan)
|
||||
//shut down the service
|
||||
|
||||
Reference in New Issue
Block a user