diff --git a/data/storage/mysql/create_tariffplan_tables.sql b/data/storage/mysql/create_tariffplan_tables.sql index 81aa73c88..88364faf4 100644 --- a/data/storage/mysql/create_tariffplan_tables.sql +++ b/data/storage/mysql/create_tariffplan_tables.sql @@ -330,8 +330,8 @@ CREATE TABLE tp_trends( `schedule` varchar(64) NOT NULL, `stat_id` varchar(64) NOT NULL, `metrics` varchar(128) NOT NULL, - `queue_length` int(11) NOT NULL, `ttl` varchar(32) NOT NULL, + `queue_length` int(11) NOT NULL, `min_items` int(11) NOT NULL, `correlation_type` varchar(64) NOT NULL, `tolerance` decimal(8,2) NOT NULL, diff --git a/data/storage/postgres/create_tariffplan_tables.sql b/data/storage/postgres/create_tariffplan_tables.sql index b19efb7ba..b678b1999 100644 --- a/data/storage/postgres/create_tariffplan_tables.sql +++ b/data/storage/postgres/create_tariffplan_tables.sql @@ -323,8 +323,8 @@ CREATE TABLE tp_trends( "schedule" varchar(64) NOT NULL, "stat_id" varchar(64) NOT NULL, "metrics" varchar(128) NOT NULL, - "queue_length" INTEGER NOT NULL, "ttl" varchar(32) NOT NULL, + "queue_length" INTEGER NOT NULL, "min_items" INTEGER NOT NULL, "correlation_type" varchar(64) NOT NULL, "tolerance" decimal(8,2) NOT NULL, diff --git a/data/tariffplans/oldtutorial/Trends.csv b/data/tariffplans/oldtutorial/Trends.csv index 043703a36..f6cc6c7e1 100644 --- a/data/tariffplans/oldtutorial/Trends.csv +++ b/data/tariffplans/oldtutorial/Trends.csv @@ -1,2 +1,2 @@ -#Tenant[0],Id[1],Schedule[2],StatID[3],Metrics[4],QueueLength[5],TTL[6],MinItems[7],CorrelationType[8],Tolerance[9],Stored[10],ThresholdIDs[11] -cgrates.org,TR_1,0 1 * * *,Stats1,*acc,-1,0,1,*last,5,false,TD1 +#Tenant[0],Id[1],Schedule[2],StatID[3],Metrics[4],TTL[5],QueueLength[6],MinItems[7],CorrelationType[8],Tolerance[9],Stored[10],ThresholdIDs[11] +cgrates.org,TR_1,0 1 * * *,Stats1,*acc,0,-1,1,*last,5,false,TD1 diff --git a/data/tariffplans/testtp/Trends.csv b/data/tariffplans/testtp/Trends.csv index 1015d915b..04bd0afb9 100644 --- a/data/tariffplans/testtp/Trends.csv +++ b/data/tariffplans/testtp/Trends.csv @@ -1,2 +1,2 @@ -#Tenant[0],Id[1],Schedule[2],StatID[3],Metrics[4],QueueLength[5],TTL[6],MinItems[7],CorrelationType[8],Tolerance[9],Stored[10],ThresholdIDs[11] +#Tenant[0],Id[1],Schedule[2],StatID[3],Metrics[4],TTL[5],QueueLength[6],MinItems[7],CorrelationType[8],Tolerance[9],Stored[10],ThresholdIDs[11] cgrates.org,TREND1,0 12 * * *,Stats2,*acc;*tcc,-1,-1,1,*average,2.1,true,TD1;TD2 diff --git a/engine/libtest.go b/engine/libtest.go index 6aa4bd84f..d1f5a95cb 100644 --- a/engine/libtest.go +++ b/engine/libtest.go @@ -247,7 +247,7 @@ cgrates.org,TestStats2,,,,,2,*sum#~*req.Cost;*average#~*req.Cost,,true,true,20, cgrates.org,Ranking1,15m,Stats2;Stats3;Stats4,Metric1;Metric3,*asc,,THD1;THD2 ` TrendsCSVContent = ` -#Tenant[0],Id[1],Schedule[2],StatID[3],Metrics[4],QueueLength[5],TTL[6],MinItems[7],CorrelationType[8],Tolerance[9],Stored[10],ThresholdIDs[11] +#Tenant[0],Id[1],Schedule[2],StatID[3],Metrics[4],TTL[5],QueueLength[6],MinItems[7],CorrelationType[8],Tolerance[9],Stored[10],ThresholdIDs[11] cgrates.org,TREND1,0 12 * * *,Stats2,*acc;*tcc,-1,-1,1,*average,2.1,true,TD1;TD2 ` ThresholdsCSVContent = ` diff --git a/engine/libtrends.go b/engine/libtrends.go index 5ba56d130..8ed69a52f 100644 --- a/engine/libtrends.go +++ b/engine/libtrends.go @@ -33,8 +33,8 @@ type TrendProfile struct { Schedule string // Cron expression scheduling gathering of the metrics StatID string Metrics []string - QueueLength int TTL time.Duration + QueueLength int MinItems int // minimum number of items for building Trends CorrelationType string // *last, *average Tolerance float64 // allow this deviation margin for *constant trend diff --git a/engine/model_helpers.go b/engine/model_helpers.go index cac8baca3..03175edf0 100644 --- a/engine/model_helpers.go +++ b/engine/model_helpers.go @@ -1644,7 +1644,7 @@ type TrendsMdls []*TrendsMdl func (tps TrendsMdls) CSVHeader() (result []string) { return []string{"#" + utils.Tenant, utils.ID, utils.Schedule, utils.StatID, - utils.Metrics, utils.QueueLength, utils.TTL, utils.MinItems, utils.CorrelationType, utils.Tolerance, utils.Stored, utils.ThresholdIDs} + utils.Metrics, utils.TTL, utils.QueueLength, utils.MinItems, utils.CorrelationType, utils.Tolerance, utils.Stored, utils.ThresholdIDs} } func (models TrendsMdls) AsTPTrends() (result []*utils.TPTrendsProfile) { diff --git a/engine/model_helpers_test.go b/engine/model_helpers_test.go index 4231c9866..c528da00c 100644 --- a/engine/model_helpers_test.go +++ b/engine/model_helpers_test.go @@ -5975,8 +5975,8 @@ func TestTrendsMdlCSVHeader(t *testing.T) { utils.Schedule, utils.StatID, utils.Metrics, - utils.QueueLength, utils.TTL, + utils.QueueLength, utils.MinItems, utils.CorrelationType, utils.Tolerance, diff --git a/engine/models.go b/engine/models.go index 0ab714998..2b4da9266 100644 --- a/engine/models.go +++ b/engine/models.go @@ -309,8 +309,8 @@ type TrendsMdl struct { Schedule string `index:"2" re:".*"` StatID string `index:"3" re:".*"` Metrics string `index:"4" re:".*"` - QueueLength int `index:"5" re:".*"` - TTL string `index:"6" re:".*"` + TTL string `index:"5" re:".*"` + QueueLength int `index:"6" re:".*"` MinItems int `index:"7" re:".*"` CorrelationType string `index:"8" re:".*"` Tolerance float64 `index:"9" re:".*"` diff --git a/utils/apitpdata.go b/utils/apitpdata.go index cf2de09d5..f98acddce 100644 --- a/utils/apitpdata.go +++ b/utils/apitpdata.go @@ -1066,8 +1066,8 @@ type TPTrendsProfile struct { Schedule string StatID string Metrics []string - QueueLength int TTL string + QueueLength int MinItems int CorrelationType string Tolerance float64