Listen to renderer cache events and log stats

This commit is contained in:
Raul Ochoa 2015-09-14 19:24:24 +02:00
parent 3f7202d89c
commit ea872d96f8

View File

@ -61,10 +61,23 @@ RendererStatsReporter.prototype.start = function() {
global.statsClient.gauge('windshaft.mapnik-pool.waiting', renderersStats.pool.waiting); global.statsClient.gauge('windshaft.mapnik-pool.waiting', renderersStats.pool.waiting);
}, this.statsInterval); }, this.statsInterval);
this.rendererCache.on('err', rendererCacheErrorListener);
this.rendererCache.on('gc', gcTimingListener);
}; };
function rendererCacheErrorListener() {
global.statsClient.increment('windshaft.rendercache.error');
}
function gcTimingListener(gcTime) {
console.log('gctime');
global.statsClient.timing('windshaft.rendercache.gc', gcTime);
}
RendererStatsReporter.prototype.stop = function() { RendererStatsReporter.prototype.stop = function() {
this.rendererCache.removeListener('err', rendererCacheErrorListener);
this.rendererCache.removeListener('gc', gcTimingListener);
clearInterval(this.renderersStatsIntervalId); clearInterval(this.renderersStatsIntervalId);
this.renderersStatsIntervalId = null; this.renderersStatsIntervalId = null;
}; };