mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
moved stats from accounting to rating db
This commit is contained in:
@@ -463,7 +463,7 @@ func main() {
|
||||
}
|
||||
|
||||
if cfg.CDRStatsEnabled {
|
||||
cdrStats = engine.NewStats(accountDb)
|
||||
cdrStats = engine.NewStats(ratingDb)
|
||||
if cfg.CDRStatConfig != nil && len(cfg.CDRStatConfig.Metrics) != 0 {
|
||||
var out int
|
||||
cdrStats.AddQueue(engine.NewCdrStatsFromCdrStatsCfg(cfg.CDRStatConfig), &out)
|
||||
|
||||
@@ -330,7 +330,7 @@ func (csvr *CSVReader) WriteToDatabase(flush, verbose bool) (err error) {
|
||||
log.Print("CDR Stats Queues")
|
||||
}
|
||||
for _, sq := range csvr.cdrStats {
|
||||
err = accountingStorage.SetCdrStats(sq)
|
||||
err = dataStorage.SetCdrStats(sq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ func (dbr *DbReader) WriteToDatabase(flush, verbose bool) (err error) {
|
||||
log.Print("CDR Stats Queues")
|
||||
}
|
||||
for _, sq := range dbr.cdrStats {
|
||||
err = accountingStorage.SetCdrStats(sq)
|
||||
err = dataStorage.SetCdrStats(sq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -39,9 +39,9 @@ type Stats struct {
|
||||
mux sync.RWMutex
|
||||
}
|
||||
|
||||
func NewStats(accountDb AccountingStorage) *Stats {
|
||||
func NewStats(ratingDb RatingStorage) *Stats {
|
||||
cdrStats := &Stats{}
|
||||
if css, err := accountDb.GetAllCdrStats(); err == nil {
|
||||
if css, err := ratingDb.GetAllCdrStats(); err == nil {
|
||||
cdrStats.UpdateQueues(css, nil)
|
||||
} else {
|
||||
Logger.Err(fmt.Sprintf("Cannot load cdr stats: %v", err))
|
||||
|
||||
@@ -86,6 +86,9 @@ type RatingStorage interface {
|
||||
SetDestination(*Destination) error
|
||||
GetLCR(string, bool) (*LCR, error)
|
||||
SetLCR(*LCR) error
|
||||
SetCdrStats(*CdrStats) error
|
||||
GetCdrStats(string) (*CdrStats, error)
|
||||
GetAllCdrStats() ([]*CdrStats, error)
|
||||
}
|
||||
|
||||
type AccountingStorage interface {
|
||||
@@ -107,9 +110,6 @@ type AccountingStorage interface {
|
||||
GetAllActionTimings() (map[string]ActionPlan, error)
|
||||
GetDerivedChargers(string, bool) (utils.DerivedChargers, error)
|
||||
SetDerivedChargers(string, utils.DerivedChargers) error
|
||||
SetCdrStats(*CdrStats) error
|
||||
GetCdrStats(string) (*CdrStats, error)
|
||||
GetAllCdrStats() ([]*CdrStats, error)
|
||||
}
|
||||
|
||||
type CdrStorage interface {
|
||||
|
||||
Reference in New Issue
Block a user