Support for additional NR metrics
[ric-app/mc.git] / mc-core / mc / queries / release_req_time.gsql
1 DEFINE{query_name 'release_req_start';
2         max_lfta_disorder '1'; max_hfta_disorder '1';
3 }
4 PARAM{ window uint; }
5 select timestamp_ms as timestamp,
6         non_temporal(timestamp_ms) as start_time,
7         0ULL as end_time,
8         id_MeNB_UE_X2AP_ID as eUE_ID,
9         id_SgNB_UE_X2AP_ID as gUE_ID,
10         gnb_id,
11         0 as event_type
12 from RELREQ.release_req
13 ;
14
15 DEFINE{query_name 'release_req_success';
16         max_lfta_disorder '1'; max_hfta_disorder '1';
17         comment 'statistics on the time to delease a DC connection';
18 }
19 PARAM{ window uint; }
20 select timestamp_ms as timestamp,
21         0ULL as start_time,
22         non_temporal(timestamp_ms) as end_time,
23         id_New_eNB_UE_X2AP_ID as eUE_ID,
24         id_SgNB_UE_X2AP_ID as gUE_ID,
25         gnb_id,
26         1 as event_type
27 from CONRELEASE.dc_release
28 ;
29
30 DEFINE{query_name 'release_req_events';
31         max_lfta_disorder '1'; max_hfta_disorder '1';
32 }
33 PARAM{ window uint; }
34 merge p1.timestamp : p2.timestamp
35 from release_req_start p1, release_req_success p2
36 ;
37
38
39 DEFINE{query_name 'release_req_success_time';
40         max_lfta_disorder '1'; max_hfta_disorder '1';
41 }
42 PARAM{ window uint; }
43 select gUE_ID, gnb_id, TB,
44         UINT(max(end_time)-max(start_time)) as success_time
45 from release_req_events
46 group by gUE_ID, gnb_id, timestamp / $window as TB
47 having max(end_time)>0 and max(start_time)>0 and max(end_time)>max(start_time)
48 ;
49
50 DEFINE{query_name 'release_req_success_stats';
51         max_lfta_disorder '1'; max_hfta_disorder '1';
52         comment 'statistics on the time to delease a DC connection';
53 }
54 PARAM{ window uint; }
55 select gnb_id as GNB_ID,
56         ($window*(TB+1))/1000 as TS, 
57              $window/1000.0 as measurementInterval,
58         MIN(success_time)/1000.0 as min_success_time,
59         MAX(success_time)/1000.0 as max_success_time,
60         AVG(success_time)/1000.0 as avg_success_time,
61         quantile_of(success_time, .05)/1000.0 as pctl_05_success_time,
62         quantile_of(success_time, .95)/1000.0 as pctl_95_success_time,
63         sqrt(
64                 sum((success_time/1000.0)*(success_time/1000.0)) - sum(success_time/1000.0)*sum(success_time/1000.0)/count(*)
65         ) / count(*) as stddev_success_time
66 from release_req_success_time
67 group by gnb_id, TB