diff --git a/lib/cartodb/api/template/named-template-controller.js b/lib/cartodb/api/template/named-template-controller.js index 5cdf5401..0408ed3a 100644 --- a/lib/cartodb/api/template/named-template-controller.js +++ b/lib/cartodb/api/template/named-template-controller.js @@ -165,8 +165,12 @@ function getTemplate ( params ); - mapConfigProvider.getMapConfig((err, mapConfig, rendererParams) => { + mapConfigProvider.getMapConfig((err, mapConfig, rendererParams, context, stats = {}) => { req.profiler.done('named.getMapConfig'); + + stats.mapType = 'named'; + req.profiler.add(stats); + if (err) { return next(err); } diff --git a/lib/cartodb/models/mapconfig/provider/named-map-provider.js b/lib/cartodb/models/mapconfig/provider/named-map-provider.js index e3889aff..5f8f4027 100644 --- a/lib/cartodb/models/mapconfig/provider/named-map-provider.js +++ b/lib/cartodb/models/mapconfig/provider/named-map-provider.js @@ -99,7 +99,7 @@ module.exports = class NamedMapMapConfigProvider extends BaseMapConfigProvider { const { user, rendererParams } = this; this.mapConfigAdapter.getMapConfig( - user, requestMapConfig, rendererParams, context, (err, mapConfig) => { + user, requestMapConfig, rendererParams, context, (err, mapConfig, stats = {}) => { if (err) { this.err = 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.analysesResults = context.analysesResults || []; - return callback(null, this.mapConfig, this.rendererParams, this.context); + return callback(null, this.mapConfig, this.rendererParams, this.context, stats); }); }); }); diff --git a/test/acceptance/overviews_metadata_named_maps.js b/test/acceptance/overviews_metadata_named_maps.js index 80451222..bfb42c46 100644 --- a/test/acceptance/overviews_metadata_named_maps.js +++ b/test/acceptance/overviews_metadata_named_maps.js @@ -119,6 +119,11 @@ describe('overviews metadata for named maps', function() { assert.ok(parsedBody.layergroupid); 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); },