Update windshaft and use the new method that reports stats about cached renderers
This commit is contained in:
parent
69a02bcee0
commit
21d1a56953
@ -6,8 +6,6 @@
|
||||
// - the mapnik-pool status: count, unused and waiting
|
||||
// - the internally cached objects: png and grid
|
||||
|
||||
var _ = require('underscore');
|
||||
|
||||
function RendererStatsReporter (rendererCache, statsInterval) {
|
||||
this.rendererCache = rendererCache;
|
||||
this.statsInterval = statsInterval || 6e4;
|
||||
@ -17,50 +15,16 @@ function RendererStatsReporter (rendererCache, statsInterval) {
|
||||
module.exports = RendererStatsReporter;
|
||||
|
||||
RendererStatsReporter.prototype.start = function () {
|
||||
var self = this;
|
||||
this.renderersStatsIntervalId = setInterval(function () {
|
||||
var rendererCacheEntries = self.rendererCache.renderers;
|
||||
this.renderersStatsIntervalId = setInterval(() => {
|
||||
const rendererStats = this.rendererCache.getStats();
|
||||
|
||||
if (!rendererCacheEntries) {
|
||||
return null;
|
||||
}
|
||||
|
||||
global.statsClient.gauge('windshaft.rendercache.count', _.keys(rendererCacheEntries).length);
|
||||
|
||||
var renderersStats = _.reduce(rendererCacheEntries, function (_rendererStats, cacheEntry) {
|
||||
var stats = cacheEntry.renderer && cacheEntry.renderer.getStats && cacheEntry.renderer.getStats();
|
||||
if (!stats) {
|
||||
return _rendererStats;
|
||||
}
|
||||
|
||||
_rendererStats.pool.count += stats.pool.count;
|
||||
_rendererStats.pool.unused += stats.pool.unused;
|
||||
_rendererStats.pool.waiting += stats.pool.waiting;
|
||||
|
||||
_rendererStats.cache.grid += stats.cache.grid;
|
||||
_rendererStats.cache.png += stats.cache.png;
|
||||
|
||||
return _rendererStats;
|
||||
},
|
||||
{
|
||||
pool: {
|
||||
count: 0,
|
||||
unused: 0,
|
||||
waiting: 0
|
||||
},
|
||||
cache: {
|
||||
png: 0,
|
||||
grid: 0
|
||||
for (let [stat, value] of rendererStats) {
|
||||
if (stat === 'rendercache.count') {
|
||||
global.statsClient.gauge(`windshaft.${stat}`, value);
|
||||
} else {
|
||||
global.statsClient.gauge(`windshaft.mapnik-${stat}`, value);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
global.statsClient.gauge('windshaft.mapnik-cache.png', renderersStats.cache.png);
|
||||
global.statsClient.gauge('windshaft.mapnik-cache.grid', renderersStats.cache.grid);
|
||||
|
||||
global.statsClient.gauge('windshaft.mapnik-pool.count', renderersStats.pool.count);
|
||||
global.statsClient.gauge('windshaft.mapnik-pool.unused', renderersStats.pool.unused);
|
||||
global.statsClient.gauge('windshaft.mapnik-pool.waiting', renderersStats.pool.waiting);
|
||||
}, this.statsInterval);
|
||||
|
||||
this.rendererCache.on('err', rendererCacheErrorListener);
|
||||
|
4
package-lock.json
generated
4
package-lock.json
generated
@ -165,7 +165,7 @@
|
||||
}
|
||||
},
|
||||
"@carto/cartonik": {
|
||||
"version": "github:cartodb/cartonik#2060705bc1ddd18363cadd6084df26448575d55d",
|
||||
"version": "github:cartodb/cartonik#1b22ad88765af8cad3b2f043d43d3601cc751004",
|
||||
"from": "github:cartodb/cartonik#preview-promises",
|
||||
"requires": {
|
||||
"@carto/mapnik": "3.6.2-carto.16",
|
||||
@ -6618,7 +6618,7 @@
|
||||
"integrity": "sha1-tDFbtCFKPXBY6+7okuE/ok2YsHU="
|
||||
},
|
||||
"windshaft": {
|
||||
"version": "github:cartodb/windshaft#f07bc4cc89066b616ffcec1ee62da7937eb4a023",
|
||||
"version": "github:cartodb/windshaft#3bf298758e1c3a6330506190df4833038b1a101f",
|
||||
"from": "github:cartodb/windshaft#get-tile-promises",
|
||||
"requires": {
|
||||
"@carto/cartonik": "github:cartodb/cartonik#preview-promises",
|
||||
|
Loading…
Reference in New Issue
Block a user