Authored by htoooth

fix

@@ -20,13 +20,13 @@ module.exports = { @@ -20,13 +20,13 @@ module.exports = {
20 infoFile: { 20 infoFile: {
21 name: 'info', 21 name: 'info',
22 level: 'info', 22 level: 'info',
23 - filename: '/Data/log/yoho-yohobuy-apm/info.log', 23 + filename: '/Data/log/yoho-apm/info/info.log',
24 maxFiles: 7 24 maxFiles: 7
25 }, 25 },
26 errorFile: { 26 errorFile: {
27 name: 'error', 27 name: 'error',
28 level: 'error', 28 level: 'error',
29 - filename: '/Data/log/yoho-yohobuy-apm/error.log', 29 + filename: '/Data/log/yoho-apm/error/error.log',
30 handleExceptions: true, 30 handleExceptions: true,
31 maxFiles: 7 31 maxFiles: 7
32 }, 32 },
@@ -27,7 +27,7 @@ @@ -27,7 +27,7 @@
27 "source-map": "^0.5.7", 27 "source-map": "^0.5.7",
28 "url": "^0.11.0", 28 "url": "^0.11.0",
29 "useragent": "^2.3.0", 29 "useragent": "^2.3.0",
30 - "yoho-node-lib": "^0.5.24" 30 + "yoho-node-lib": "^0.6.13"
31 }, 31 },
32 "devDependencies": { 32 "devDependencies": {
33 "babel-core": "^6.26.0", 33 "babel-core": "^6.26.0",
  1 +use webapm;
  2 +
  3 +DELIMITER $$
  4 +CREATE PROCEDURE `p_del_perf`(IN `date_inter` INT)
  5 +BEGIN
  6 + DELETE FROM perf_report WHERE (TO_DAYS(NOW()) - TO_DAYS(FROM_UNIXTIME(create_time/1000)))>=date_inter;
  7 +END$$
  8 +DELIMITER ;
  9 +
  10 +CREATE EVENT `e_del_perf_report`
  11 +ON SCHEDULE EVERY 1 DAY STARTS '2018-5-24 0:0:0'
  12 +ON COMPLETION PRESERVE DISABLE
  13 +DO CALL p_del_perf (3);
  14 +
  15 +alter event e_del_perf_report on completion preserve enable;
@@ -21,6 +21,13 @@ BEGIN @@ -21,6 +21,13 @@ BEGIN
21 END$$ 21 END$$
22 DELIMITER ; 22 DELIMITER ;
23 23
  24 +DELIMITER $$
  25 +CREATE PROCEDURE `p_del_perf`(IN `date_inter` INT)
  26 +BEGIN
  27 + DELETE FROM perf_report WHERE (TO_DAYS(NOW()) - TO_DAYS(FROM_UNIXTIME(create_time/1000)))>=date_inter;
  28 +END$$
  29 +DELIMITER ;
  30 +
24 -- test 31 -- test
25 DELIMITER $$ 32 DELIMITER $$
26 CREATE PROCEDURE `i_sert`(IN `date_inter` INT) 33 CREATE PROCEDURE `i_sert`(IN `date_inter` INT)
@@ -32,6 +39,7 @@ DELIMITER ; @@ -32,6 +39,7 @@ DELIMITER ;
32 -- 删除存储过程 39 -- 删除存储过程
33 drop procedure if exists p_del_slow; 40 drop procedure if exists p_del_slow;
34 drop procedure if exists p_del_error; 41 drop procedure if exists p_del_error;
  42 +drop procedure if exists p_del_perf;
35 43
36 -- 列出所有存储过程 44 -- 列出所有存储过程
37 select specific_name from mysql.proc; 45 select specific_name from mysql.proc;
@@ -57,6 +65,11 @@ ON SCHEDULE EVERY 1 DAY STARTS '2018-2-1 0:0:0' @@ -57,6 +65,11 @@ ON SCHEDULE EVERY 1 DAY STARTS '2018-2-1 0:0:0'
57 ON COMPLETION PRESERVE DISABLE 65 ON COMPLETION PRESERVE DISABLE
58 DO CALL p_del_error (7); 66 DO CALL p_del_error (7);
59 67
  68 +CREATE EVENT `e_del_perf_report`
  69 +ON SCHEDULE EVERY 1 DAY STARTS '2018-5-24 0:0:0'
  70 +ON COMPLETION PRESERVE DISABLE
  71 +DO CALL p_del_perf (7);
  72 +
60 -- test 73 -- test
61 CREATE EVENT `i_second` 74 CREATE EVENT `i_second`
62 ON SCHEDULE EVERY 1 SECOND 75 ON SCHEDULE EVERY 1 SECOND
@@ -72,14 +85,17 @@ SELECT event_name,event_definition,interval_value,interval_field,status FROM inf @@ -72,14 +85,17 @@ SELECT event_name,event_definition,interval_value,interval_field,status FROM inf
72 --开启定时任务 85 --开启定时任务
73 alter event e_del_slow_route on completion preserve enable; 86 alter event e_del_slow_route on completion preserve enable;
74 alter event e_del_error_report on completion preserve enable; 87 alter event e_del_error_report on completion preserve enable;
  88 +alter event e_del_perf_report on completion preserve enable;
75 89
76 --关闭定时任务 90 --关闭定时任务
77 alter event e_del_slow_route on completion preserve disable; 91 alter event e_del_slow_route on completion preserve disable;
78 alter event e_del_error_report on completion preserve disable; 92 alter event e_del_error_report on completion preserve disable;
  93 +alter event e_del_perf_report on completion preserve disable;
79 94
80 --删除定时任务 95 --删除定时任务
81 drop event if exists e_del_slow_route; 96 drop event if exists e_del_slow_route;
82 drop event if exists e_del_error_report; 97 drop event if exists e_del_error_report;
  98 +drop event if exists e_del_perf_report;
83 99
84 ALTER TABLE slow_duration ADD useragent varchar(200); 100 ALTER TABLE slow_duration ADD useragent varchar(200);
85 101