mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-24 08:38:45 +05:00
CDRS sendind rated cdr to statS
This commit is contained in:
committed by
Dan Christian Bogos
parent
3b3e0cbd72
commit
1984934ae3
@@ -782,20 +782,20 @@ func (bc Balances) SaveDirtyBalances(acc *Account) {
|
||||
}
|
||||
accountId = b.account.ID
|
||||
acntTnt := utils.NewTenantID(accountId)
|
||||
thEv := &ArgsProcessEvent{
|
||||
CGREvent: utils.CGREvent{
|
||||
Tenant: acntTnt.Tenant,
|
||||
ID: utils.GenUUID(),
|
||||
Event: map[string]interface{}{
|
||||
utils.EventType: utils.BalanceUpdate,
|
||||
utils.EventSource: utils.AccountService,
|
||||
utils.Account: acntTnt.ID,
|
||||
utils.BalanceID: b.ID,
|
||||
utils.Units: b.Value}}}
|
||||
if !b.ExpirationDate.IsZero() {
|
||||
thEv.Event[utils.ExpiryTime] = b.ExpirationDate.Format(time.RFC3339)
|
||||
}
|
||||
if thresholdS != nil {
|
||||
thEv := &ArgsProcessEvent{
|
||||
CGREvent: utils.CGREvent{
|
||||
Tenant: acntTnt.Tenant,
|
||||
ID: utils.GenUUID(),
|
||||
Event: map[string]interface{}{
|
||||
utils.EventType: utils.BalanceUpdate,
|
||||
utils.EventSource: utils.AccountService,
|
||||
utils.Account: acntTnt.ID,
|
||||
utils.BalanceID: b.ID,
|
||||
utils.Units: b.Value}}}
|
||||
if !b.ExpirationDate.IsZero() {
|
||||
thEv.Event[utils.ExpiryTime] = b.ExpirationDate.Format(time.RFC3339)
|
||||
}
|
||||
var hits int
|
||||
if err := thresholdS.Call(utils.ThresholdSv1ProcessEvent, thEv, &hits); err != nil &&
|
||||
err.Error() != utils.ErrNotFound.Error() {
|
||||
|
||||
@@ -222,7 +222,7 @@ func (self *CdrServer) processCdr(cdr *CDR) (err error) {
|
||||
}
|
||||
if self.rals != nil && !cdr.Rated { // CDRs not rated will be processed by Rating
|
||||
go self.deriveRateStoreStatsReplicate(cdr, self.cgrCfg.CDRSStoreCdrs,
|
||||
self.cdrstats != nil, len(self.cgrCfg.CDRSOnlineCDRExports) != 0)
|
||||
true, len(self.cgrCfg.CDRSOnlineCDRExports) != 0)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -232,22 +232,22 @@ func (sS *StatService) processEvent(ev *utils.CGREvent) (err error) {
|
||||
sS.ssqMux.Unlock()
|
||||
}
|
||||
}
|
||||
var thIDs []string
|
||||
if len(sq.sqPrfl.ThresholdIDs) != 0 {
|
||||
thIDs = sq.sqPrfl.ThresholdIDs
|
||||
}
|
||||
thEv := &ArgsProcessEvent{
|
||||
ThresholdIDs: thIDs,
|
||||
CGREvent: utils.CGREvent{
|
||||
Tenant: sq.Tenant,
|
||||
ID: utils.GenUUID(),
|
||||
Event: map[string]interface{}{
|
||||
utils.EventType: utils.StatUpdate,
|
||||
utils.StatID: sq.ID}}}
|
||||
for metricID, metric := range sq.SQMetrics {
|
||||
thEv.Event[metricID] = metric.GetValue()
|
||||
}
|
||||
if sS.thdS != nil {
|
||||
var thIDs []string
|
||||
if len(sq.sqPrfl.ThresholdIDs) != 0 {
|
||||
thIDs = sq.sqPrfl.ThresholdIDs
|
||||
}
|
||||
thEv := &ArgsProcessEvent{
|
||||
ThresholdIDs: thIDs,
|
||||
CGREvent: utils.CGREvent{
|
||||
Tenant: sq.Tenant,
|
||||
ID: utils.GenUUID(),
|
||||
Event: map[string]interface{}{
|
||||
utils.EventType: utils.StatUpdate,
|
||||
utils.StatID: sq.ID}}}
|
||||
for metricID, metric := range sq.SQMetrics {
|
||||
thEv.Event[metricID] = metric.GetValue()
|
||||
}
|
||||
var hits int
|
||||
if err := sS.thdS.Call(utils.ThresholdSv1ProcessEvent, thEv, &hits); err != nil &&
|
||||
err.Error() != utils.ErrNotFound.Error() {
|
||||
|
||||
Reference in New Issue
Block a user