mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-23 16:18:44 +05:00
rankings,trends: added implementation,services and tests
This commit is contained in:
committed by
Dan Christian Bogos
parent
766a717b3c
commit
132a2b3bf9
@@ -78,6 +78,29 @@ CREATE TABLE tp_trends(
|
||||
UNIQUE KEY `unique_tp_trends` (`tpid`,`tenant`,`id`,`stat_id`)
|
||||
);
|
||||
|
||||
--
|
||||
-- Table structure for tabls `tp_rankings`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS tp_rankings;
|
||||
CREATE TABLE tp_rankings(
|
||||
`pk` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`tpid` varchar(64) NOT NULL,
|
||||
`tenant` varchar(64) NOT NULL,
|
||||
`id` varchar(64) NOT NULL,
|
||||
`schedule` varchar(32) NOT NULL,
|
||||
`stat_ids` varchar(64) NOT NULL,
|
||||
`metric_ids` varchar(64) NOT NULL,
|
||||
`sorting` varchar(32) NOT NULL,
|
||||
`sorting_parameters` varchar(64) NOT NULL,
|
||||
`stored` BOOLEAN NOT NULL,
|
||||
`threshold_ids` varchar(64) NOT NULL,
|
||||
`created_at` TIMESTAMP,
|
||||
PRIMARY KEY (`pk`),
|
||||
KEY `tpid` (`tpid`),
|
||||
UNIQUE KEY `unique_tp_rankings` (`tpid`,`tenant`,`id`,`stat_ids`)
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Table structure for table `tp_threshold_cfgs`
|
||||
|
||||
@@ -76,6 +76,29 @@ CREATE TABLE tp_trends(
|
||||
CREATE INDEX tp_trends_idx ON tp_trends(tpid);
|
||||
CREATE INDEX tp_trends_unique ON tp_trends("tpid","tenant","id","stat_id");
|
||||
|
||||
|
||||
--
|
||||
-- Table structure for table `tp_rankings`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS tp_rankings;
|
||||
CREATE TABLE tp_rankings(
|
||||
"pk" SERIAL PRIMARY KEY,
|
||||
"tpid" varchar(64) NOT NULL,
|
||||
"tenant" varchar(64) NOT NULL,
|
||||
"id" varchar(64) NOT NULL,
|
||||
"schedule" varchar(32) NOT NULL,
|
||||
"stat_ids" varchar(64) NOT NULL,
|
||||
"metric_ids" varchar(64) NOT NULL,
|
||||
"sorting" varchar(32) NOT NULL,
|
||||
"sorting_parameters" varchar(64) NOT NULL,
|
||||
"stored" BOOLEAN NOT NULL,
|
||||
"threshold_ids" varchar(64) NOT NULL,
|
||||
"created_at" TIMESTAMP WITH TIME ZONE
|
||||
);
|
||||
CREATE INDEX tp_rankings_idx ON tp_rankings (tpid);
|
||||
CREATE INDEX tp_rankings_unique ON tp_rankings ("tpid","tenant", "id","stat_ids");
|
||||
|
||||
|
||||
--
|
||||
-- Table structure for table `tp_threshold_cfgs`
|
||||
|
||||
5
data/tariffplans/tuttrends/Stats.csv
Normal file
5
data/tariffplans/tuttrends/Stats.csv
Normal file
@@ -0,0 +1,5 @@
|
||||
#Tenant[0],Id[1],FilterIDs[2],ActivationInterval[3],QueueLength[4],TTL[5],MinItems[6],Metrics[7],MetricFilterIDs[8],Stored[9],Blocker[10],Weight[11],ThresholdIDs[12]
|
||||
cgrates.org,Stats1_1,*string:~*req.Account:1001,,,,,*tcc;*acd;*tcd,,,,,
|
||||
cgrates.org,Stats1_2,*string:~*req.Account:1002,,,,,*sum#~*req.Usage;*pdd,,,,,
|
||||
tenant1,Stat1,*string:~*req.Account:1005,,,,,*tcd;*asr;*acc,,,,,
|
||||
tenant2,Stat_Avg,,,,,,*acc,,,,,
|
||||
|
8
data/tariffplans/tuttrends/Trends.csv
Normal file
8
data/tariffplans/tuttrends/Trends.csv
Normal file
@@ -0,0 +1,8 @@
|
||||
#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,TREND_1,@every 1s,Stats1_1,,-1,-1,1,*last,1,false,
|
||||
cgrates.org,TREND_2,@every 3s,Stats1_2,,-1,2,4,*last,1,false,
|
||||
cgrates.org,TR_1min,@every 1m,Stats1_1,,-1,3,2,*average,0.15,false,
|
||||
tenant1,TR_5min,*/5 * * * *,Stat1,,-1,-1,8,*average,0.23,true,
|
||||
tenant1,TR_1hr,0 * * * *,Stat1,,-1,-1,8,*average,0.1,true,
|
||||
tenant2,Trend_avg,@every 10m,Stat_Avg,,-1,-1,8,*average,0.6,true,
|
||||
tenant2,Trend_avg_30min,@every 30m,Stat_Avg,,-1,-1,100,*average,0.3,true,
|
||||
|
Reference in New Issue
Block a user