Showing
4 changed files
with
20 additions
and
10 deletions
@@ -40,12 +40,12 @@ const logger = global.yoho.logger; | @@ -40,12 +40,12 @@ const logger = global.yoho.logger; | ||
40 | 40 | ||
41 | // zookeeper | 41 | // zookeeper |
42 | if (config.zookeeperServer) { | 42 | if (config.zookeeperServer) { |
43 | - const mointor = global.yoho.mointorSender; | ||
44 | - const mointorType = _.get(mointor, 'type.ZOOKEEPER'); | 43 | + const monitor = global.yoho.monitorSender; |
44 | + const monitorType = _.get(monitor, 'type.ZOOKEEPER'); | ||
45 | 45 | ||
46 | require('yoho-zookeeper')(config.zookeeperServer, 'wap', app.locals.wap = {}, false, { | 46 | require('yoho-zookeeper')(config.zookeeperServer, 'wap', app.locals.wap = {}, false, { |
47 | onerror: (err) => { | 47 | onerror: (err) => { |
48 | - mointor.tallyFail(mointorType, { | 48 | + monitor.tallyFail(monitorType, { |
49 | code: err.code, | 49 | code: err.code, |
50 | message: err.name | 50 | message: err.name |
51 | }); | 51 | }); |
@@ -240,6 +240,11 @@ if (isProduction) { | @@ -240,6 +240,11 @@ if (isProduction) { | ||
240 | port: 80, | 240 | port: 80, |
241 | db: 'web-apm' | 241 | db: 'web-apm' |
242 | }, | 242 | }, |
243 | + monitorReport: { | ||
244 | + host: '10.66.4.25', | ||
245 | + port: 8086, | ||
246 | + db: 'web_monitor', | ||
247 | + }, | ||
243 | loggers: { | 248 | loggers: { |
244 | infoFile: { | 249 | infoFile: { |
245 | name: 'info', | 250 | name: 'info', |
@@ -308,6 +313,11 @@ if (isProduction) { | @@ -308,6 +313,11 @@ if (isProduction) { | ||
308 | key: '7e6f3307b64cc87c79c472814b88f7fb', | 313 | key: '7e6f3307b64cc87c79c472814b88f7fb', |
309 | appSecret: 'ce21ae4a3f93852279175a167e54509b', | 314 | appSecret: 'ce21ae4a3f93852279175a167e54509b', |
310 | notifyUrl: (process.env.TEST_SERVICE || 'http://service-test1.yohops.com:9999/') + 'payment/weixin_notify', | 315 | notifyUrl: (process.env.TEST_SERVICE || 'http://service-test1.yohops.com:9999/') + 'payment/weixin_notify', |
316 | + }, | ||
317 | + monitorReport: { | ||
318 | + host: '192.168.102.22', | ||
319 | + port: 8086, | ||
320 | + db: 'web_monitor', | ||
311 | } | 321 | } |
312 | }); | 322 | }); |
313 | } | 323 | } |
@@ -6,8 +6,8 @@ const uuid = require('uuid'); | @@ -6,8 +6,8 @@ const uuid = require('uuid'); | ||
6 | const cookieSession = require('client-sessions'); | 6 | const cookieSession = require('client-sessions'); |
7 | const connectRedis = require('connect-redis'); | 7 | const connectRedis = require('connect-redis'); |
8 | const RedisStore = connectRedis(session); | 8 | const RedisStore = connectRedis(session); |
9 | -const mointor = global.yoho.mointorSender; | ||
10 | -const mointorType = _.get(mointor, 'type.REDIS'); | 9 | +const monitor = global.yoho.monitorSender; |
10 | +const monitorType = _.get(monitor, 'type.REDIS'); | ||
11 | 11 | ||
12 | /** | 12 | /** |
13 | * 该中间件主要把 express-session 和 client-session 集中起来处理,如果 redis 出错了,使用 cookie session | 13 | * 该中间件主要把 express-session 和 client-session 集中起来处理,如果 redis 出错了,使用 cookie session |
@@ -70,7 +70,7 @@ module.exports = (app) => { | @@ -70,7 +70,7 @@ module.exports = (app) => { | ||
70 | store: new RedisStore(Object.assign(config.redis.session, { | 70 | store: new RedisStore(Object.assign(config.redis.session, { |
71 | logErrors: (e) => { | 71 | logErrors: (e) => { |
72 | // 上报redis session错误 | 72 | // 上报redis session错误 |
73 | - mointor && mointor.tallyFail(mointorType, e); | 73 | + monitor && monitor.tallyFail(monitorType, e); |
74 | } | 74 | } |
75 | })) | 75 | })) |
76 | })); | 76 | })); |
@@ -3,7 +3,7 @@ const _ = require('lodash'); | @@ -3,7 +3,7 @@ const _ = require('lodash'); | ||
3 | const redis = require('redis'); | 3 | const redis = require('redis'); |
4 | const bluebird = require('bluebird'); | 4 | const bluebird = require('bluebird'); |
5 | const config = require('../config/common'); | 5 | const config = require('../config/common'); |
6 | -const mointor = global.yoho.mointorSender; | 6 | +const monitor = global.yoho.monitorSender; |
7 | let client; | 7 | let client; |
8 | const timeout = 200; // redis 操作超时时间 | 8 | const timeout = 200; // redis 操作超时时间 |
9 | 9 | ||
@@ -13,7 +13,7 @@ try { | @@ -13,7 +13,7 @@ try { | ||
13 | bluebird.promisifyAll(redis.RedisClient.prototype); | 13 | bluebird.promisifyAll(redis.RedisClient.prototype); |
14 | bluebird.promisifyAll(redis.Multi.prototype); | 14 | bluebird.promisifyAll(redis.Multi.prototype); |
15 | 15 | ||
16 | - const mointorType = _.get(mointor, 'type.REDIS'); | 16 | + const monitorType = _.get(monitor, 'type.REDIS'); |
17 | 17 | ||
18 | client.all = args => { | 18 | client.all = args => { |
19 | if (!client.ready) { | 19 | if (!client.ready) { |
@@ -25,10 +25,10 @@ try { | @@ -25,10 +25,10 @@ try { | ||
25 | } | 25 | } |
26 | 26 | ||
27 | return client.multi.call(client, args).execAsync().timeout(timeout).then(res => { | 27 | return client.multi.call(client, args).execAsync().timeout(timeout).then(res => { |
28 | - mointor && mointor.tallySuccess(mointorType); | 28 | + monitor && monitor.tallySuccess(monitorType); |
29 | return res; | 29 | return res; |
30 | }).catch((e)=>{ | 30 | }).catch((e)=>{ |
31 | - mointor && mointor.tallyFail(mointorType, e); | 31 | + monitor && monitor.tallyFail(monitorType, e); |
32 | return false; | 32 | return false; |
33 | }); | 33 | }); |
34 | }; | 34 | }; |
-
Please register or login to post a comment