From 03dd27b8d870e3f2e9cabe4c0533f70499a70f9e Mon Sep 17 00:00:00 2001 From: Radu Ioan Fericean Date: Tue, 1 Jul 2014 23:33:08 +0300 Subject: [PATCH] added cdrstats to test.sh and started getstats --- cdrstats/stats.go | 8 ++++++++ test.sh | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/cdrstats/stats.go b/cdrstats/stats.go index 0449b429f..e5d99a212 100644 --- a/cdrstats/stats.go +++ b/cdrstats/stats.go @@ -104,6 +104,14 @@ func (sq *StatsQueue) PurgeObsoleteCDRs() { } } +func (sq *StatsQueue) GetStats() map[string]float64 { + stat := make(map[string]float64, len(sq.metrics)) + for key, metric := range sq.metrics { + stat[key] = metric.GetValue() + } + return stat +} + func (sq *StatsQueue) AcceptCDR(cdr *utils.StoredCdr) bool { if len(sq.conf.SetupInterval) > 0 { if cdr.SetupTime.Before(sq.conf.SetupInterval[0]) { diff --git a/test.sh b/test.sh index e8e4c861f..a16cfe836 100755 --- a/test.sh +++ b/test.sh @@ -12,6 +12,7 @@ go test -i github.com/cgrates/cgrates/cdrc go test -i github.com/cgrates/cgrates/utils go test -i github.com/cgrates/cgrates/history go test -i github.com/cgrates/cgrates/cdre +go test -i github.com/cgrates/cgrates/cdrstats go test github.com/cgrates/cgrates/engine en=$? @@ -39,6 +40,8 @@ go test github.com/cgrates/cgrates/cache2go c2g=$? go test github.com/cgrates/cgrates/cdre cdre=$? +go test github.com/cgrates/cgrates/cdrstats +stats=$? -exit $en && $gt && $sm && $cfg && $bl && $cr && $md && $cdrs && $cdrc && $fs && $ut && $hs && $c2g && $cdre +exit $en && $gt && $sm && $cfg && $bl && $cr && $md && $cdrs && $cdrc && $fs && $ut && $hs && $c2g && $cdre && $stats