Authored by htoooth

fix

... ... @@ -20,13 +20,13 @@ module.exports = {
infoFile: {
name: 'info',
level: 'info',
filename: '/Data/log/yoho-yohobuy-apm/info.log',
filename: '/Data/log/yoho-apm/info/info.log',
maxFiles: 7
},
errorFile: {
name: 'error',
level: 'error',
filename: '/Data/log/yoho-yohobuy-apm/error.log',
filename: '/Data/log/yoho-apm/error/error.log',
handleExceptions: true,
maxFiles: 7
},
... ...
... ... @@ -27,7 +27,7 @@
"source-map": "^0.5.7",
"url": "^0.11.0",
"useragent": "^2.3.0",
"yoho-node-lib": "^0.5.24"
"yoho-node-lib": "^0.6.13"
},
"devDependencies": {
"babel-core": "^6.26.0",
... ...
use webapm;
DELIMITER $$
CREATE PROCEDURE `p_del_perf`(IN `date_inter` INT)
BEGIN
DELETE FROM perf_report WHERE (TO_DAYS(NOW()) - TO_DAYS(FROM_UNIXTIME(create_time/1000)))>=date_inter;
END$$
DELIMITER ;
CREATE EVENT `e_del_perf_report`
ON SCHEDULE EVERY 1 DAY STARTS '2018-5-24 0:0:0'
ON COMPLETION PRESERVE DISABLE
DO CALL p_del_perf (3);
alter event e_del_perf_report on completion preserve enable;
\ No newline at end of file
... ...
... ... @@ -21,6 +21,13 @@ BEGIN
END$$
DELIMITER ;
DELIMITER $$
CREATE PROCEDURE `p_del_perf`(IN `date_inter` INT)
BEGIN
DELETE FROM perf_report WHERE (TO_DAYS(NOW()) - TO_DAYS(FROM_UNIXTIME(create_time/1000)))>=date_inter;
END$$
DELIMITER ;
-- test
DELIMITER $$
CREATE PROCEDURE `i_sert`(IN `date_inter` INT)
... ... @@ -32,6 +39,7 @@ DELIMITER ;
-- 删除存储过程
drop procedure if exists p_del_slow;
drop procedure if exists p_del_error;
drop procedure if exists p_del_perf;
-- 列出所有存储过程
select specific_name from mysql.proc;
... ... @@ -57,6 +65,11 @@ ON SCHEDULE EVERY 1 DAY STARTS '2018-2-1 0:0:0'
ON COMPLETION PRESERVE DISABLE
DO CALL p_del_error (7);
CREATE EVENT `e_del_perf_report`
ON SCHEDULE EVERY 1 DAY STARTS '2018-5-24 0:0:0'
ON COMPLETION PRESERVE DISABLE
DO CALL p_del_perf (7);
-- test
CREATE EVENT `i_second`
ON SCHEDULE EVERY 1 SECOND
... ... @@ -72,14 +85,17 @@ SELECT event_name,event_definition,interval_value,interval_field,status FROM inf
--开启定时任务
alter event e_del_slow_route on completion preserve enable;
alter event e_del_error_report on completion preserve enable;
alter event e_del_perf_report on completion preserve enable;
--关闭定时任务
alter event e_del_slow_route on completion preserve disable;
alter event e_del_error_report on completion preserve disable;
alter event e_del_perf_report on completion preserve disable;
--删除定时任务
drop event if exists e_del_slow_route;
drop event if exists e_del_error_report;
drop event if exists e_del_perf_report;
ALTER TABLE slow_duration ADD useragent varchar(200);
... ...