Authored by 陈峰

Merge branch 'feature/yoluckTip' into 'master'

Feature/yoluck tip



See merge request !91
@@ -77,7 +77,7 @@ app.use(global.yoho.httpCtx()); @@ -77,7 +77,7 @@ app.use(global.yoho.httpCtx());
77 app.enable('trust proxy'); 77 app.enable('trust proxy');
78 78
79 app.use((req, res, next) => { 79 app.use((req, res, next) => {
80 - req.isApmReport = _.get(req.app.locals, 'isProduction'); 80 + req.isApmReport = _.get(req.app.locals, 'isProduction', false);
81 next(); 81 next();
82 }); 82 });
83 83
@@ -82,7 +82,7 @@ @@ -82,7 +82,7 @@
82 "xlsx": "^0.11.16", 82 "xlsx": "^0.11.16",
83 "xlsx-style": "^0.8.13", 83 "xlsx-style": "^0.8.13",
84 "yoho-md5": "^2.0.0", 84 "yoho-md5": "^2.0.0",
85 - "yoho-node-lib": "^0.6.33", 85 + "yoho-node-lib": "=0.6.44",
86 "yoho-zookeeper": "^1.0.8" 86 "yoho-zookeeper": "^1.0.8"
87 }, 87 },
88 "devDependencies": { 88 "devDependencies": {
@@ -2,7 +2,6 @@ const mysql = require('mysql'); @@ -2,7 +2,6 @@ const mysql = require('mysql');
2 const _ = require('lodash'); 2 const _ = require('lodash');
3 const md5 = require('yoho-md5'); 3 const md5 = require('yoho-md5');
4 const qs = require('querystring'); 4 const qs = require('querystring');
5 -const monitorType = 'sql';  
6 5
7 class SqlHelper { 6 class SqlHelper {
8 constructor(database) { 7 constructor(database) {
@@ -10,6 +9,7 @@ class SqlHelper { @@ -10,6 +9,7 @@ class SqlHelper {
10 this.logger = global.yoho.logger; 9 this.logger = global.yoho.logger;
11 this.cache = global.yoho.cache; 10 this.cache = global.yoho.cache;
12 this.monitor = global.yoho.monitorSender; 11 this.monitor = global.yoho.monitorSender;
  12 + this.monitorType = _.get(this.monitor, 'type.SQL');
13 database = database || 'mysql'; 13 database = database || 'mysql';
14 this.createPool(database); 14 this.createPool(database);
15 } 15 }
@@ -97,12 +97,12 @@ class SqlHelper { @@ -97,12 +97,12 @@ class SqlHelper {
97 // 写入缓存 97 // 写入缓存
98 cacheTime && this.cache.set(cacheKey, result, cacheTime); 98 cacheTime && this.cache.set(cacheKey, result, cacheTime);
99 resolve(result); 99 resolve(result);
100 - this.monitor && this.monitor.tallySuccess(monitorType); 100 + this.monitor && this.monitor.tallySuccess(this.monitorType);
101 } 101 }
102 }); 102 });
103 }).catch(e => { 103 }).catch(e => {
104 reject(e); 104 reject(e);
105 - this.monitor && this.monitor.tallyFail(monitorType, e); 105 + this.monitor && this.monitor.tallyFail(this.monitorType, e);
106 }); 106 });
107 }); 107 });
108 } 108 }
@@ -4906,7 +4906,15 @@ inflight@^1.0.4, inflight@~1.0.6: @@ -4906,7 +4906,15 @@ inflight@^1.0.4, inflight@~1.0.6:
4906 once "^1.3.0" 4906 once "^1.3.0"
4907 wrappy "1" 4907 wrappy "1"
4908 4908
4909 -influx-batch-sender@^0.1.7, influx-batch-sender@^0.1.9: 4909 +influx-batch-sender@=0.1.7:
  4910 + version "0.1.7"
  4911 + resolved "http://npm.yohops.com/influx-batch-sender/-/influx-batch-sender-0.1.7.tgz#9f925bfc500e886cae27001b3cc20f2584fa464a"
  4912 + dependencies:
  4913 + debug "^3.0.1"
  4914 + lodash "^4.17.4"
  4915 + request "^2.83.0"
  4916 +
  4917 +influx-batch-sender@^0.1.9:
4910 version "0.1.10" 4918 version "0.1.10"
4911 resolved "http://npm.yohops.com/influx-batch-sender/-/influx-batch-sender-0.1.10.tgz#697e51ab8e5aa20fb9cc3b07a2922e069b86c229" 4919 resolved "http://npm.yohops.com/influx-batch-sender/-/influx-batch-sender-0.1.10.tgz#697e51ab8e5aa20fb9cc3b07a2922e069b86c229"
4912 dependencies: 4920 dependencies:
@@ -12093,13 +12101,13 @@ yoho-mlellipsis@0.0.3: @@ -12093,13 +12101,13 @@ yoho-mlellipsis@0.0.3:
12093 version "0.0.3" 12101 version "0.0.3"
12094 resolved "http://npm.yohops.com/yoho-mlellipsis/-/yoho-mlellipsis-0.0.3.tgz#5f743eeb74ff6f2df58a802cff7cd8ad8e4b21f4" 12102 resolved "http://npm.yohops.com/yoho-mlellipsis/-/yoho-mlellipsis-0.0.3.tgz#5f743eeb74ff6f2df58a802cff7cd8ad8e4b21f4"
12095 12103
12096 -yoho-node-lib@^0.6.33:  
12097 - version "0.6.34"  
12098 - resolved "http://npm.yohops.com/yoho-node-lib/-/yoho-node-lib-0.6.34.tgz#c650e06bfc530cf13c79cf4b3e08bc5d15345933" 12104 +yoho-node-lib@=0.6.44:
  12105 + version "0.6.44"
  12106 + resolved "http://npm.yohops.com/yoho-node-lib/-/yoho-node-lib-0.6.44.tgz#7ede014f170c2a55840bfcf627cef5305111fedb"
12099 dependencies: 12107 dependencies:
12100 dnscache "^1.0.1" 12108 dnscache "^1.0.1"
12101 handlebars "^4.0.5" 12109 handlebars "^4.0.5"
12102 - influx-batch-sender "^0.1.7" 12110 + influx-batch-sender "=0.1.7"
12103 lodash "^4.13.1" 12111 lodash "^4.13.1"
12104 lru-cache "^4.1.1" 12112 lru-cache "^4.1.1"
12105 md5 "^2.1.0" 12113 md5 "^2.1.0"