Authored by yyq

config

... ... @@ -40,12 +40,12 @@ const logger = global.yoho.logger;
// zookeeper
if (config.zookeeperServer) {
const mointor = global.yoho.mointorSender;
const mointorType = _.get(mointor, 'type.ZOOKEEPER');
const monitor = global.yoho.monitorSender;
const monitorType = _.get(monitor, 'type.ZOOKEEPER');
require('yoho-zookeeper')(config.zookeeperServer, 'wap', app.locals.wap = {}, false, {
onerror: (err) => {
mointor.tallyFail(mointorType, {
monitor.tallyFail(monitorType, {
code: err.code,
message: err.name
});
... ...
... ... @@ -240,6 +240,11 @@ if (isProduction) {
port: 80,
db: 'web-apm'
},
monitorReport: {
host: '10.66.4.25',
port: 8086,
db: 'web_monitor',
},
loggers: {
infoFile: {
name: 'info',
... ... @@ -308,6 +313,11 @@ if (isProduction) {
key: '7e6f3307b64cc87c79c472814b88f7fb',
appSecret: 'ce21ae4a3f93852279175a167e54509b',
notifyUrl: (process.env.TEST_SERVICE || 'http://service-test1.yohops.com:9999/') + 'payment/weixin_notify',
},
monitorReport: {
host: '192.168.102.22',
port: 8086,
db: 'web_monitor',
}
});
}
... ...
... ... @@ -6,8 +6,8 @@ const uuid = require('uuid');
const cookieSession = require('client-sessions');
const connectRedis = require('connect-redis');
const RedisStore = connectRedis(session);
const mointor = global.yoho.mointorSender;
const mointorType = _.get(mointor, 'type.REDIS');
const monitor = global.yoho.monitorSender;
const monitorType = _.get(monitor, 'type.REDIS');
/**
* 该中间件主要把 express-session 和 client-session 集中起来处理,如果 redis 出错了,使用 cookie session
... ... @@ -70,7 +70,7 @@ module.exports = (app) => {
store: new RedisStore(Object.assign(config.redis.session, {
logErrors: (e) => {
// 上报redis session错误
mointor && mointor.tallyFail(mointorType, e);
monitor && monitor.tallyFail(monitorType, e);
}
}))
}));
... ...
... ... @@ -3,7 +3,7 @@ const _ = require('lodash');
const redis = require('redis');
const bluebird = require('bluebird');
const config = require('../config/common');
const mointor = global.yoho.mointorSender;
const monitor = global.yoho.monitorSender;
let client;
const timeout = 200; // redis 操作超时时间
... ... @@ -13,7 +13,7 @@ try {
bluebird.promisifyAll(redis.RedisClient.prototype);
bluebird.promisifyAll(redis.Multi.prototype);
const mointorType = _.get(mointor, 'type.REDIS');
const monitorType = _.get(monitor, 'type.REDIS');
client.all = args => {
if (!client.ready) {
... ... @@ -25,10 +25,10 @@ try {
}
return client.multi.call(client, args).execAsync().timeout(timeout).then(res => {
mointor && mointor.tallySuccess(mointorType);
monitor && monitor.tallySuccess(monitorType);
return res;
}).catch((e)=>{
mointor && mointor.tallyFail(mointorType, e);
monitor && monitor.tallyFail(monitorType, e);
return false;
});
};
... ...