add to logs named maps overviews instantiation

This commit is contained in:
Eneko Lakasta 2018-09-04 16:21:20 +02:00
parent b75150e91e
commit 880ef63720
3 changed files with 12 additions and 3 deletions

View File

@ -165,8 +165,12 @@ function getTemplate (
params params
); );
mapConfigProvider.getMapConfig((err, mapConfig, rendererParams) => { mapConfigProvider.getMapConfig((err, mapConfig, rendererParams, context, stats = {}) => {
req.profiler.done('named.getMapConfig'); req.profiler.done('named.getMapConfig');
stats.mapType = 'named';
req.profiler.add(stats);
if (err) { if (err) {
return next(err); return next(err);
} }

View File

@ -99,7 +99,7 @@ module.exports = class NamedMapMapConfigProvider extends BaseMapConfigProvider {
const { user, rendererParams } = this; const { user, rendererParams } = this;
this.mapConfigAdapter.getMapConfig( this.mapConfigAdapter.getMapConfig(
user, requestMapConfig, rendererParams, context, (err, mapConfig) => { user, requestMapConfig, rendererParams, context, (err, mapConfig, stats = {}) => {
if (err) { if (err) {
this.err = err; this.err = err;
return callback(err); return callback(err);
@ -108,7 +108,7 @@ module.exports = class NamedMapMapConfigProvider extends BaseMapConfigProvider {
this.mapConfig = (mapConfig === null) ? null : new MapConfig(mapConfig, context.datasource); this.mapConfig = (mapConfig === null) ? null : new MapConfig(mapConfig, context.datasource);
this.analysesResults = context.analysesResults || []; this.analysesResults = context.analysesResults || [];
return callback(null, this.mapConfig, this.rendererParams, this.context); return callback(null, this.mapConfig, this.rendererParams, this.context, stats);
}); });
}); });
}); });

View File

@ -119,6 +119,11 @@ describe('overviews metadata for named maps', function() {
assert.ok(parsedBody.layergroupid); assert.ok(parsedBody.layergroupid);
assert.ok(parsedBody.last_updated); assert.ok(parsedBody.last_updated);
const headers = JSON.parse(res.headers['x-tiler-profiler']);
assert.ok(headers.overviewsAddedToMapconfig);
assert.equal(headers.mapType, 'named');
next(null, parsedBody.layergroupid); next(null, parsedBody.layergroupid);
}, },