Add profiling

This commit is contained in:
Daniel García Aubert
2017-11-08 10:52:25 +01:00
parent 749b205944
commit 56d33b7f5b
+7
View File
@@ -173,6 +173,7 @@ MapController.prototype.getTemplate = function () {
);
mapconfigProvider.getMapConfig((err, mapconfig, rendererParams) => {
req.profiler.done('getMapConfig');
if (err) {
return next(err);
}
@@ -209,6 +210,7 @@ MapController.prototype.prepareAdapterMapConfig = function () {
};
this.mapConfigAdapter.getMapConfig(user, requestMapConfig, res.locals, context, (err, requestMapConfig) => {
req.profiler.done('getMapConfig');
if (err) {
return next(err);
}
@@ -234,6 +236,7 @@ MapController.prototype.createLayergroup = function () {
res.locals.analysesResults = context.analysesResults;
this.mapBackend.createLayergroup(mapconfig, res.locals, mapconfigProvider, (err, layergroup) => {
req.profiler.done('createLayergroup');
if (err) {
return next(err);
}
@@ -252,6 +255,7 @@ MapController.prototype.instantiateLayergroup = function () {
new CreateLayergroupMapConfigProvider(mapconfig, user, this.userLimitsApi, rendererParams);
this.mapBackend.createLayergroup(mapconfig, rendererParams, mapconfigProvider, (err, layergroup) => {
req.profiler.done('createLayergroup');
if (err) {
return next(err);
}
@@ -320,6 +324,7 @@ MapController.prototype.getAffectedTables = function () {
});
QueryTables.getAffectedTablesFromQuery(connection, sql.join(';'), (err, affectedTables) => {
req.profiler.done('getAffectedTablesFromQuery');
if (err) {
return next(err);
}
@@ -564,6 +569,7 @@ MapController.prototype.setSurrogateKeyHeader = function () {
MapController.prototype.sendResponse = function () {
return function sendResponseMiddleware (req, res) {
req.profiler.done('res');
const { layergroup } = res.locals;
res.status(200);
@@ -580,6 +586,7 @@ MapController.prototype.augmentError = function (options) {
const { addContext = false, label = 'MAPS CONTROLLER' } = options;
return function augmentErrorMiddleware (err, req, res, next) {
req.profiler.done('error');
const { mapconfig } = res.locals;
if (addContext) {