Authored by yyq

config

... ... @@ -55,12 +55,12 @@ app.locals.version = pkg.version;
// 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, 'pc', app.locals.pc = {}, global.yoho.cache, {
onerror: (err) => {
mointor.tallyFail(mointorType, {
monitor.tallyFail(monitorType, {
code: err.code,
message: err.name
});
... ...
... ... @@ -247,6 +247,11 @@ if (isProduction) {
host: 'badjs.yoho.cn',
port: 80,
db: 'web-apm'
},
monitorReport: {
host: '10.66.4.25',
port: 8086,
db: 'web-monitor',
}
});
} else if (isTest) {
... ... @@ -264,6 +269,11 @@ if (isProduction) {
yohoNowApi: process.env.YOHO_NOW_API || 'http://yohonow-test.yohops.com:9999/',
},
useOneapm: true,
useCache: true
useCache: true,
monitorReport: {
host: '192.168.102.22',
port: 8086,
db: 'web-monitor',
}
});
}
... ...
... ... @@ -4,7 +4,7 @@ const redis = require('redis');
const bluebird = require('bluebird');
const config = require('../../config/common');
const logger = global.yoho.logger;
const mointor = global.yoho.mointorSender;
const monitor = global.yoho.monitorSender;
const timeout = 200; // redis 操作超时时间
let client;
... ... @@ -14,11 +14,11 @@ 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) {
mointor && mointor.tallyFail(mointorType);
monitor && monitor.tallyFail(monitorType);
if (Array.isArray(args)) {
return Promise.resolve(_.fill(args, false));
} else {
... ... @@ -27,10 +27,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);
logger.error('redis exe time out');
return false;
});
... ...
... ... @@ -5,8 +5,8 @@ const session = require('yoho-express-session');
const cookieSession = require('client-sessions');
const redis = require('connect-redis');
const RedisStore = redis(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
... ... @@ -68,7 +68,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);
}
}))
}));
... ...