|
@@ -3165,4 +3165,69 @@ GROUP BY
|
|
|
app_name,
|
|
|
priority,
|
|
|
app_type,
|
|
|
- substring(thedvalue,1,4)
|
|
|
+ substring(thedvalue,1,4)
|
|
|
+
|
|
|
+
|
|
|
+-- 响应时间趋势
|
|
|
+DROP TABLE IF EXISTS `bi_app_response_time_stat`;
|
|
|
+CREATE TABLE `bi_app_response_time_stat` (
|
|
|
+ `dtype` varchar(5) NOT NULL DEFAULT '' COMMENT '日期类型',
|
|
|
+ `thedvalue` varchar(20) DEFAULT NULL COMMENT '日期',
|
|
|
+ `dhour` varchar(15) DEFAULT NULL COMMENT '小时',
|
|
|
+ `NET_ID` varchar(64) DEFAULT NULL COMMENT '网系ID',
|
|
|
+ `NET_NAME` varchar(64) DEFAULT NULL COMMENT '网系名称',
|
|
|
+ `ORGAN_ID` varchar(100) DEFAULT NULL COMMENT '区域ID/数据来源',
|
|
|
+ `ORGAN_NAME` varchar(100) DEFAULT NULL COMMENT '区域名称',
|
|
|
+ `app_id` varchar(64) DEFAULT NULL COMMENT '应用ID',
|
|
|
+ `app_name` varchar(255) DEFAULT NULL COMMENT '应用名称',
|
|
|
+ `response_time` decimal(20,10) DEFAULT NULL COMMENT '响应时间',
|
|
|
+ `priority` varchar(10) DEFAULT NULL COMMENT '应用等级:核心-high;重要-important;一般-low',
|
|
|
+ `app_type` varchar(255) DEFAULT NULL COMMENT '应用分类'
|
|
|
+) ENGINE = InnoDB DEFAULT CHARSET = utf8;
|
|
|
+
|
|
|
+
|
|
|
+ insert into bi_app_response_time_stat
|
|
|
+ select
|
|
|
+ 'HOUR' as dtype,
|
|
|
+ date_format(a.CREATE_TIME,'%Y%m%d%H') as thedvalue,
|
|
|
+ date_format(a.CREATE_TIME,'%H') as dhour,
|
|
|
+ b.ITM_NETGROUP_ID as NET_ID,
|
|
|
+ d.name as NET_NAME,
|
|
|
+ a.ORGAN_ID as ORGAN_ID,
|
|
|
+ e.`SHORT_NAME` as organ_name,
|
|
|
+ a.app_id as app_id,
|
|
|
+ b.ITM_APP_NAME as app_name,
|
|
|
+ avg(a.resp_time) as response_time,
|
|
|
+ case b.PRIORITY WHEN 'low' then '一般应用' when 'important' then '重要应用' when 'high' then '核心应用' else '未知' end as priority,
|
|
|
+ e.name as app_type
|
|
|
+ from app_app_detail_stat a
|
|
|
+ LEFT JOIN itm_app b on a.app_id =b.ITM_APP_ID
|
|
|
+ LEFT JOIN itm_organ_net c on c.NET_ID = a.net_id
|
|
|
+ inner JOIN (select * from m_com_dict where dict_index = 'app_type') d on b.app_type=d.value
|
|
|
+ left join pub_organ e on b.ORGAN_ID = e.`CODE`
|
|
|
+ group by
|
|
|
+ date_format(a.monitortime,'%Y%m%d%H'),date_format(a.monitortime,'%H'),
|
|
|
+ b.PRIORITY,
|
|
|
+ d.name,c.net_name,a.id ,a.app_id ,a.app_name ,a.ORGAN_ID ,a.net_id,e.`SHORT_NAME`,e.`NAME`;
|
|
|
+
|
|
|
+
|
|
|
+ insert into bi_app_response_time_stat
|
|
|
+ select 'DAY' as dtype,substring(thedvalue,1,8) AS thedvalue,
|
|
|
+ dhour, NET_ID, NET_NAME, ORGAN_ID, ORGAN_NAME, app_id, app_name, avg(response_time) as response_time, priority, app_type
|
|
|
+ from bi_app_response_time_stat
|
|
|
+ where dtype = 'HOUR'
|
|
|
+ GROUP BY substring(thedvalue,1,8),dhour, NET_ID, NET_NAME, ORGAN_ID, ORGAN_NAME, app_id, app_name,priority, app_type;
|
|
|
+
|
|
|
+ insert into bi_app_response_time_stat
|
|
|
+ select 'MONTH' as dtype,substring(thedvalue,1,6) AS thedvalue,
|
|
|
+ dhour, NET_ID, NET_NAME, ORGAN_ID, ORGAN_NAME, app_id, app_name, avg(response_time) as response_time, priority, app_type
|
|
|
+ from bi_app_response_time_stat
|
|
|
+ where dtype = 'DAY'
|
|
|
+ GROUP BY substring(thedvalue,1,6),dhour, NET_ID, NET_NAME, ORGAN_ID, ORGAN_NAME, app_id, app_name,priority, app_type;
|
|
|
+
|
|
|
+ insert into bi_app_response_time_stat
|
|
|
+ select 'YEAR' as dtype,substring(thedvalue,1,4) AS thedvalue,
|
|
|
+ dhour, NET_ID, NET_NAME, ORGAN_ID, ORGAN_NAME, app_id, app_name, avg(response_time) as response_time, priority, app_type
|
|
|
+ from bi_app_response_time_stat
|
|
|
+ where dtype = 'MONTH'
|
|
|
+ GROUP BY substring(thedvalue,1,4),dhour, NET_ID, NET_NAME, ORGAN_ID, ORGAN_NAME, app_id, app_name,priority, app_type;
|