Merge pull request #286 from CartoDB/profiler-metrics

Profiler metrics improvements
This commit is contained in:
Raul Ochoa 2015-04-15 15:41:12 +02:00
commit cbebac1cb1
4 changed files with 18 additions and 25 deletions

View File

@ -4,6 +4,12 @@
Released 2015-mm-dd
Bug fixes:
- Do not check statsd_client in profiler
Announcements:
- Upgrades windshaft to [0.42.1](https://github.com/CartoDB/Windshaft/releases/tag/0.42.1)
## 2.1.1

View File

@ -59,9 +59,6 @@ TemplateMapsController.prototype.create = function(req, res) {
return { template_id: cdbuser + '@' + tpl_id };
},
function finish(err, response){
if ( req.profiler ) {
res.header('X-Tiler-Profiler', req.profiler.toJSONString());
}
if (err){
response = { error: ''+err };
var statusCode = 400;
@ -115,9 +112,6 @@ TemplateMapsController.prototype.update = function(req, res) {
return { template_id: cdbuser + '@' + tpl_id };
},
function finish(err, response){
if ( req.profiler ) {
res.header('X-Tiler-Profiler', req.profiler.toJSONString());
}
if (err){
var statusCode = 400;
response = { error: ''+err };
@ -136,7 +130,7 @@ TemplateMapsController.prototype.update = function(req, res) {
TemplateMapsController.prototype.retrieve = function(req, res) {
var self = this;
if ( req.profiler && req.profiler.statsd_client ) {
if (req.profiler) {
req.profiler.start('windshaft-cartodb.get_template');
}
@ -198,7 +192,7 @@ TemplateMapsController.prototype.retrieve = function(req, res) {
TemplateMapsController.prototype.destroy = function(req, res) {
var self = this;
if ( req.profiler && req.profiler.statsd_client ) {
if (req.profiler) {
req.profiler.start('windshaft-cartodb.delete_template');
}
this.app.doCORS(res);
@ -250,8 +244,7 @@ TemplateMapsController.prototype.destroy = function(req, res) {
// Get a list of owned templates
TemplateMapsController.prototype.list = function(req, res) {
var self = this;
if ( req.profiler && req.profiler.statsd_client ) {
if ( req.profiler ) {
req.profiler.start('windshaft-cartodb.get_template_list');
}
this.app.doCORS(res);
@ -295,7 +288,7 @@ TemplateMapsController.prototype.list = function(req, res) {
TemplateMapsController.prototype.instantiate = function(req, res) {
var self = this;
if ( req.profiler && req.profiler.statsd_client) {
if (req.profiler) {
req.profiler.start('windshaft-cartodb.instance_template_post');
}
step(
@ -305,7 +298,7 @@ TemplateMapsController.prototype.instantiate = function(req, res) {
}
self.instantiateTemplate(req, res, req.body, this);
}, function(err, response) {
self.finish_instantiation(err, response, res, req);
self.finish_instantiation(err, response, res);
}
);
};
@ -322,7 +315,7 @@ TemplateMapsController.prototype.options = function(req, res, next) {
TemplateMapsController.prototype.jsonp = function(req, res) {
var self = this;
if ( req.profiler && req.profiler.statsd_client) {
if (req.profiler) {
req.profiler.start('windshaft-cartodb.instance_template_get');
}
step(
@ -340,7 +333,7 @@ TemplateMapsController.prototype.jsonp = function(req, res) {
}
self.instantiateTemplate(req, res, config, this);
}, function(err, response) {
self.finish_instantiation(err, response, res, req);
self.finish_instantiation(err, response, res);
}
);
};
@ -447,19 +440,13 @@ TemplateMapsController.prototype.instantiateTemplate = function(req, res, templa
);
};
TemplateMapsController.prototype.finish_instantiation = function(err, response, res, req) {
if ( req.profiler ) {
res.header('X-Tiler-Profiler', req.profiler.toJSONString());
}
TemplateMapsController.prototype.finish_instantiation = function(err, response, res) {
if (err) {
var statusCode = 400;
response = { error: ''+err };
if ( ! _.isUndefined(err.http_status) ) {
statusCode = err.http_status;
}
if(global.environment.debug) {
response.stack = err.stack;
}
this.app.sendError(res, response, statusCode, 'POST INSTANCE TEMPLATE', err);
} else {
this.app.sendResponse(res, [response, 200]);

6
npm-shrinkwrap.json generated
View File

@ -170,9 +170,9 @@
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz"
},
"windshaft": {
"version": "0.42.0",
"from": "windshaft@0.42.0",
"resolved": "https://registry.npmjs.org/windshaft/-/windshaft-0.42.0.tgz",
"version": "0.42.1",
"from": "windshaft@0.42.1",
"resolved": "https://registry.npmjs.org/windshaft/-/windshaft-0.42.1.tgz",
"dependencies": {
"chronograph": {
"version": "0.1.0",

View File

@ -24,7 +24,7 @@
"dependencies": {
"underscore" : "~1.6.0",
"dot": "~1.0.2",
"windshaft": "0.42.0",
"windshaft": "0.42.1",
"step": "~0.0.5",
"queue-async": "~1.0.7",
"request": "~2.9.203",