mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 10:06:24 +05:00
fixes and updated cache stats API
This commit is contained in:
@@ -52,6 +52,9 @@ func (self *ApierV1) GetAccountActionPlan(attrs AttrAcntAction, reply *[]*Accoun
|
||||
}
|
||||
accID := utils.AccountKey(attrs.Tenant, attrs.Account)
|
||||
for _, ap := range allAPs {
|
||||
if ap == nil {
|
||||
continue
|
||||
}
|
||||
if _, exists := ap.AccountIDs[accID]; exists {
|
||||
for _, at := range ap.ActionTimings {
|
||||
accountATs = append(accountATs, &AccountActionTiming{
|
||||
|
||||
@@ -743,6 +743,7 @@ func (self *ApierV1) ReloadCache(attrs utils.AttrReloadCache, reply *string) err
|
||||
func (self *ApierV1) GetCacheStats(attrs utils.AttrCacheStats, reply *utils.CacheStats) error {
|
||||
cs := new(utils.CacheStats)
|
||||
cs.Destinations = cache2go.CountEntries(utils.DESTINATION_PREFIX)
|
||||
cs.ReverseDestinations = cache2go.CountEntries(utils.REVERSE_DESTINATION_PREFIX)
|
||||
cs.RatingPlans = cache2go.CountEntries(utils.RATING_PLAN_PREFIX)
|
||||
cs.RatingProfiles = cache2go.CountEntries(utils.RATING_PROFILE_PREFIX)
|
||||
cs.Actions = cache2go.CountEntries(utils.ACTION_PREFIX)
|
||||
@@ -751,6 +752,7 @@ func (self *ApierV1) GetCacheStats(attrs utils.AttrCacheStats, reply *utils.Cach
|
||||
cs.DerivedChargers = cache2go.CountEntries(utils.DERIVEDCHARGERS_PREFIX)
|
||||
cs.LcrProfiles = cache2go.CountEntries(utils.LCR_PREFIX)
|
||||
cs.Aliases = cache2go.CountEntries(utils.ALIASES_PREFIX)
|
||||
cs.ReverseAliases = cache2go.CountEntries(utils.REVERSE_ALIASES_PREFIX)
|
||||
cs.ResourceLimits = cache2go.CountEntries(utils.ResourceLimitsPrefix)
|
||||
if self.CdrStatsSrv != nil {
|
||||
var queueIds []string
|
||||
|
||||
@@ -110,7 +110,7 @@ func TestApierInitStorDb(t *testing.T) {
|
||||
}
|
||||
|
||||
// Finds cgr-engine executable and starts it with default configuration
|
||||
func TestApierStartEngine(t *testing.T) {
|
||||
/*func TestApierStartEngine(t *testing.T) {
|
||||
if !*testLocal {
|
||||
return
|
||||
}
|
||||
@@ -126,7 +126,7 @@ func TestApierStartEngine(t *testing.T) {
|
||||
t.Fatal("Cannot start cgr-engine: ", err.Error())
|
||||
}
|
||||
time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time to rater to fire up
|
||||
}
|
||||
}*/
|
||||
|
||||
// Connect rpc client to rater
|
||||
func TestApierRpcConn(t *testing.T) {
|
||||
|
||||
@@ -119,6 +119,9 @@ func (s *Scheduler) loadActionPlans() {
|
||||
// recreate the queue
|
||||
s.queue = engine.ActionTimingPriorityList{}
|
||||
for _, actionPlan := range actionPlans {
|
||||
if actionPlan == nil {
|
||||
continue
|
||||
}
|
||||
for _, at := range actionPlan.ActionTimings {
|
||||
if at.Timing == nil {
|
||||
utils.Logger.Warning(fmt.Sprintf("<Scheduler> Nil timing on action plan: %+v, discarding!", at))
|
||||
|
||||
@@ -579,6 +579,7 @@ type AttrCacheStats struct { // Add in the future filters here maybe so we avoid
|
||||
|
||||
type CacheStats struct {
|
||||
Destinations int
|
||||
ReverseDestinations int
|
||||
RatingPlans int
|
||||
RatingProfiles int
|
||||
Actions int
|
||||
@@ -589,6 +590,7 @@ type CacheStats struct {
|
||||
CdrStats int
|
||||
Users int
|
||||
Aliases int
|
||||
ReverseAliases int
|
||||
ResourceLimits int
|
||||
LastLoadID string
|
||||
LastRatingLoadID string
|
||||
|
||||
Reference in New Issue
Block a user