Report to statsd the status of redis pools
This commit is contained in:
parent
9f5faf7cf8
commit
804088009e
3
NEWS.md
3
NEWS.md
@ -1,6 +1,9 @@
|
||||
1.19.1 -- 2014-mm-dd
|
||||
--------------------
|
||||
|
||||
New features:
|
||||
- Report to statsd the status of redis pools
|
||||
|
||||
Enhancements:
|
||||
- Share one redis-mpool across the application
|
||||
|
||||
|
14
app.js
14
app.js
@ -70,10 +70,7 @@ if ( global.environment.rollbar ) {
|
||||
log4js.configure(log4js_config, { cwd: __dirname });
|
||||
global.logger = log4js.getLogger();
|
||||
|
||||
var redisOpts = _.extend(global.environment.redis, {
|
||||
name: 'windshaft_cartodb',
|
||||
reportInterval: 5000
|
||||
}),
|
||||
var redisOpts = _.extend(global.environment.redis, { name: 'windshaft' }),
|
||||
redisPool = new RedisPool(redisOpts);
|
||||
|
||||
// Include cartodb_windshaft only _after_ the "global" variable is set
|
||||
@ -83,6 +80,15 @@ var CartodbWindshaft = require('./lib/cartodb/cartodb_windshaft'),
|
||||
|
||||
ws = CartodbWindshaft(serverOptions);
|
||||
|
||||
if (global.statsClient) {
|
||||
redisPool.on('status', function(status) {
|
||||
var keyPrefix = status.name + '.db' + status.db + '.';
|
||||
global.statsClient.gauge(keyPrefix + 'count', status.count);
|
||||
global.statsClient.gauge(keyPrefix + 'unused', status.unused);
|
||||
global.statsClient.gauge(keyPrefix + 'waiting', status.waiting);
|
||||
});
|
||||
}
|
||||
|
||||
// Maximum number of connections for one process
|
||||
// 128 is a good number if you have up to 1024 filedescriptors
|
||||
// 4 is good if you have max 32 filedescriptors
|
||||
|
@ -108,6 +108,9 @@ var config = {
|
||||
slowPool: {
|
||||
log: true, // whether a slow acquire must be logged or not
|
||||
elapsedThreshold: 25 // the threshold to determine an slow acquire must be reported or not
|
||||
},
|
||||
emitter: {
|
||||
statusInterval: 5000
|
||||
}
|
||||
}
|
||||
,sqlapi: {
|
||||
|
@ -102,6 +102,9 @@ var config = {
|
||||
slowPool: {
|
||||
log: true, // whether a slow acquire must be logged or not
|
||||
elapsedThreshold: 25 // the threshold to determine an slow acquire must be reported or not
|
||||
},
|
||||
emitter: {
|
||||
statusInterval: 5000
|
||||
}
|
||||
}
|
||||
,sqlapi: {
|
||||
|
@ -102,6 +102,9 @@ var config = {
|
||||
slowPool: {
|
||||
log: true, // whether a slow acquire must be logged or not
|
||||
elapsedThreshold: 25 // the threshold to determine an slow acquire must be reported or not
|
||||
},
|
||||
emitter: {
|
||||
statusInterval: 5000
|
||||
}
|
||||
}
|
||||
,sqlapi: {
|
||||
|
@ -102,6 +102,9 @@ var config = {
|
||||
slowPool: {
|
||||
log: true, // whether a slow acquire must be logged or not
|
||||
elapsedThreshold: 25 // the threshold to determine an slow acquire must be reported or not
|
||||
},
|
||||
emitter: {
|
||||
statusInterval: 5000
|
||||
}
|
||||
}
|
||||
,sqlapi: {
|
||||
|
Loading…
Reference in New Issue
Block a user