From 0046a1bedd8c2f2d6f4c69ce8a85c160dfb90101 Mon Sep 17 00:00:00 2001 From: DanB Date: Sun, 7 Jun 2015 11:56:02 +0200 Subject: [PATCH] Reverting to cdrstats instead of cdr_stats for subsystems naming consistency --- config/config_defaults.go | 2 +- config/config_json.go | 2 +- data/conf/cgrates/cgrates.json | 2 +- data/conf/samples/cdrstats/cdrstats.json | 4 ++-- data/conf/samples/fscsv/cgrates.json | 2 +- data/conf/samples/tutlocal/cgrates.json | 2 +- data/storage/mysql/create_tariffplan_tables.sql | 6 +++--- data/storage/postgres/create_tariffplan_tables.sql | 10 +++++----- .../fs_evsock/cgrates/etc/cgrates/cgrates.json | 2 +- .../kamevapi/cgrates/etc/cgrates/cgrates.json | 2 +- .../osips_async/cgrates/etc/cgrates/cgrates.json | 2 +- engine/models.go | 2 +- engine/storage_sql.go | 6 +++--- utils/consts.go | 2 +- 14 files changed, 23 insertions(+), 23 deletions(-) diff --git a/config/config_defaults.go b/config/config_defaults.go index 974d2a640..bf6ac98b6 100644 --- a/config/config_defaults.go +++ b/config/config_defaults.go @@ -106,7 +106,7 @@ const CGRATES_CFG_JSON = ` }, -"cdr_stats": { +"cdrstats": { "enabled": false, // starts the cdrstats service: "queue_length": 50, // number of items in the stats buffer "time_window": "1h", // will only keep the CDRs who's call setup time is not older than time.Now()-TimeWindow diff --git a/config/config_json.go b/config/config_json.go index dfb67fd2e..6ccb5caea 100644 --- a/config/config_json.go +++ b/config/config_json.go @@ -36,7 +36,7 @@ const ( SCHEDULER_JSN = "scheduler" CDRS_JSN = "cdrs" MEDIATOR_JSN = "mediator" - CDRSTATS_JSN = "cdr_stats" + CDRSTATS_JSN = "cdrstats" CDRE_JSN = "cdre" CDRC_JSN = "cdrc" SMFS_JSN = "sm_freeswitch" diff --git a/data/conf/cgrates/cgrates.json b/data/conf/cgrates/cgrates.json index 58ee095c0..5046d8515 100644 --- a/data/conf/cgrates/cgrates.json +++ b/data/conf/cgrates/cgrates.json @@ -91,7 +91,7 @@ //}, -//"cdr_stats": { +//"cdrstats": { // "enabled": false, // starts the cdrstats service: // "queue_length": 50, // number of items in the stats buffer // "time_window": "1h", // will only keep the CDRs who's call setup time is not older than time.Now()-TimeWindow diff --git a/data/conf/samples/cdrstats/cdrstats.json b/data/conf/samples/cdrstats/cdrstats.json index 16bd11ca9..ae313dc69 100644 --- a/data/conf/samples/cdrstats/cdrstats.json +++ b/data/conf/samples/cdrstats/cdrstats.json @@ -15,10 +15,10 @@ "cdrstats": "internal", // address where to reach the cdrstats service. Empty to disable stats gathering out of mediated CDRs <""|internal|x.y.z.y:1234> }, -"cdr_stats": { +"cdrstats": { "enabled": true, // starts the cdrstats service: "queue_length": 5, // number of items in the stats buffer "time_window": "0", // will only keep the CDRs who's call setup time is not older than time.Now()-TimeWindow }, -} \ No newline at end of file +} diff --git a/data/conf/samples/fscsv/cgrates.json b/data/conf/samples/fscsv/cgrates.json index 6c4ebb308..dd3c905ba 100644 --- a/data/conf/samples/fscsv/cgrates.json +++ b/data/conf/samples/fscsv/cgrates.json @@ -21,7 +21,7 @@ "cdrstats": "internal", // address where to reach the cdrstats service, empty to disable stats functionality<""|internal|x.y.z.y:1234> }, -"cdr_stats": { +"cdrstats": { "enabled": true, // starts the cdrstats service: }, diff --git a/data/conf/samples/tutlocal/cgrates.json b/data/conf/samples/tutlocal/cgrates.json index a2d71d5e5..eb6242fee 100644 --- a/data/conf/samples/tutlocal/cgrates.json +++ b/data/conf/samples/tutlocal/cgrates.json @@ -25,7 +25,7 @@ "cdrstats": "internal", // address where to reach the cdrstats service, empty to disable stats functionality<""|internal|x.y.z.y:1234> }, -"cdr_stats": { +"cdrstats": { "enabled": true, // starts the cdrstats service: }, diff --git a/data/storage/mysql/create_tariffplan_tables.sql b/data/storage/mysql/create_tariffplan_tables.sql index 8024426b8..213a677ea 100644 --- a/data/storage/mysql/create_tariffplan_tables.sql +++ b/data/storage/mysql/create_tariffplan_tables.sql @@ -298,11 +298,11 @@ CREATE TABLE tp_derived_chargers ( -- --- Table structure for table `tp_cdr_stats` +-- Table structure for table `tp_cdrstats` -- -DROP TABLE IF EXISTS tp_cdr_stats; -CREATE TABLE tp_cdr_stats ( +DROP TABLE IF EXISTS tp_cdrstats; +CREATE TABLE tp_cdrstats ( `id` int(11) NOT NULL AUTO_INCREMENT, `tpid` varchar(64) NOT NULL, `tag` varchar(64) NOT NULL, diff --git a/data/storage/postgres/create_tariffplan_tables.sql b/data/storage/postgres/create_tariffplan_tables.sql index 4aba6eade..12a37dc21 100644 --- a/data/storage/postgres/create_tariffplan_tables.sql +++ b/data/storage/postgres/create_tariffplan_tables.sql @@ -293,11 +293,11 @@ CREATE INDEX tpderivedchargers_idx ON tp_derived_chargers (tpid,loadid,direction -- --- Table structure for table `tp_cdr_stats` +-- Table structure for table `tp_cdrstats` -- -DROP TABLE IF EXISTS tp_cdr_stats; -CREATE TABLE tp_cdr_stats ( +DROP TABLE IF EXISTS tp_cdrstats; +CREATE TABLE tp_cdrstats ( id SERIAL PRIMARY KEY, tpid VARCHAR(64) NOT NULL, tag VARCHAR(64) NOT NULL, @@ -325,5 +325,5 @@ CREATE TABLE tp_cdr_stats ( action_triggers VARCHAR(64) NOT NULL, created_at TIMESTAMP ); -CREATE INDEX tpcdrstats_tpid_idx ON tp_cdr_stats (tpid); -CREATE INDEX tpcdrstats_idx ON tp_cdr_stats (tpid,tag); +CREATE INDEX tpcdrstats_tpid_idx ON tp_cdrstats (tpid); +CREATE INDEX tpcdrstats_idx ON tp_cdrstats (tpid,tag); diff --git a/data/tutorials/fs_evsock/cgrates/etc/cgrates/cgrates.json b/data/tutorials/fs_evsock/cgrates/etc/cgrates/cgrates.json index 8aac09bb9..2a1e8e86a 100644 --- a/data/tutorials/fs_evsock/cgrates/etc/cgrates/cgrates.json +++ b/data/tutorials/fs_evsock/cgrates/etc/cgrates/cgrates.json @@ -85,7 +85,7 @@ // "cdr_replication":[], // replicate the raw CDR to a number of servers }, -"cdr_stats": { +"cdrstats": { "enabled": true, // starts the cdrstats service: // "queue_length": 50, // number of items in the stats buffer // "time_window": "1h", // will only keep the CDRs who's call setup time is not older than time.Now()-TimeWindow diff --git a/data/tutorials/kamevapi/cgrates/etc/cgrates/cgrates.json b/data/tutorials/kamevapi/cgrates/etc/cgrates/cgrates.json index d8eb3d43b..c9311506e 100644 --- a/data/tutorials/kamevapi/cgrates/etc/cgrates/cgrates.json +++ b/data/tutorials/kamevapi/cgrates/etc/cgrates/cgrates.json @@ -85,7 +85,7 @@ // "cdr_replication":[], // replicate the raw CDR to a number of servers }, -"cdr_stats": { +"cdrstats": { "enabled": true, // starts the cdrstats service: // "queue_length": 50, // number of items in the stats buffer // "time_window": "1h", // will only keep the CDRs who's call setup time is not older than time.Now()-TimeWindow diff --git a/data/tutorials/osips_async/cgrates/etc/cgrates/cgrates.json b/data/tutorials/osips_async/cgrates/etc/cgrates/cgrates.json index 8af854efa..c348c0609 100644 --- a/data/tutorials/osips_async/cgrates/etc/cgrates/cgrates.json +++ b/data/tutorials/osips_async/cgrates/etc/cgrates/cgrates.json @@ -25,7 +25,7 @@ }, -"cdr_stats": { +"cdrstats": { "enabled": true, // starts the cdrstats service: }, diff --git a/engine/models.go b/engine/models.go index 3c606ac9a..42d01fd92 100644 --- a/engine/models.go +++ b/engine/models.go @@ -257,7 +257,7 @@ func (tpdc *TpDerivedCharger) SetDerivedChargersId(id string) error { return nil } -type TpCdrStat struct { +type TpCdrstat struct { Id int64 Tpid string Tag string diff --git a/engine/storage_sql.go b/engine/storage_sql.go index b80902e04..7851beae3 100644 --- a/engine/storage_sql.go +++ b/engine/storage_sql.go @@ -383,13 +383,13 @@ func (self *SQLStorage) SetTPCdrStats(tpid string, css map[string][]*utils.TPCdr } tx := self.db.Begin() for csId, cStats := range css { - if err := tx.Where(&TpCdrStat{Tpid: tpid, Tag: csId}).Delete(TpCdrStat{}).Error; err != nil { + if err := tx.Where(&TpCdrstat{Tpid: tpid, Tag: csId}).Delete(TpCdrstat{}).Error; err != nil { tx.Rollback() return err } for _, cs := range cStats { ql, _ := strconv.Atoi(cs.QueueLength) - saved := tx.Save(&TpCdrStat{ + saved := tx.Save(&TpCdrstat{ Tpid: tpid, Tag: csId, QueueLength: ql, @@ -1430,7 +1430,7 @@ func (self *SQLStorage) GetTpSharedGroups(tpid, tag string) (map[string][]*utils func (self *SQLStorage) GetTpCdrStats(tpid, tag string) (map[string][]*utils.TPCdrStat, error) { css := make(map[string][]*utils.TPCdrStat) - var tpCdrStats []TpCdrStat + var tpCdrStats []TpCdrstat q := self.db.Where("tpid = ?", tpid) if len(tag) != 0 { q = q.Where("tag = ?", tag) diff --git a/utils/consts.go b/utils/consts.go index 18168dadf..79b285ed2 100644 --- a/utils/consts.go +++ b/utils/consts.go @@ -35,7 +35,7 @@ const ( TBL_TP_RATING_PLANS = "tp_rating_plans" TBL_TP_RATE_PROFILES = "tp_rating_profiles" TBL_TP_SHARED_GROUPS = "tp_shared_groups" - TBL_TP_CDR_STATS = "tp_cdr_stats" + TBL_TP_CDR_STATS = "tp_cdrstats" TBL_TP_LCRS = "tp_lcr_rules" TBL_TP_ACTIONS = "tp_actions" TBL_TP_ACTION_PLANS = "tp_action_plans"