Integrate statsd in template instanciation endpoint

NOTE: stats are only enabled using windshaft 0.18.2+
This commit is contained in:
Sandro Santilli 2014-02-15 08:23:43 +01:00
parent 8f3c6c3c87
commit 935826ed1a

View File

@ -530,9 +530,15 @@ var CartodbWindshaft = function(serverOptions) {
} else { } else {
res.send(response, 200); res.send(response, 200);
} }
if ( req.profiler && req.profiler.statsd_client) {
req.profiler.sendStats();
}
} }
ws.post(template_baseurl + '/:template_id', function(req, res) { ws.post(template_baseurl + '/:template_id', function(req, res) {
if ( req.profiler && req.profiler.statsd_client) {
req.profiler.start('windshaft-cartodb.instance_template_post');
}
Step( Step(
function() { function() {
if ( ! req.headers['content-type'] || req.headers['content-type'].split(';')[0] != 'application/json') { if ( ! req.headers['content-type'] || req.headers['content-type'].split(';')[0] != 'application/json') {
@ -550,6 +556,9 @@ var CartodbWindshaft = function(serverOptions) {
* callback query argument is mandartoy * callback query argument is mandartoy
*/ */
ws.get(template_baseurl + '/:template_id/jsonp', function(req, res) { ws.get(template_baseurl + '/:template_id/jsonp', function(req, res) {
if ( req.profiler && req.profiler.statsd_client) {
req.profiler.start('windshaft-cartodb.instance_template_get');
}
Step( Step(
function() { function() {
if ( req.query.callback === undefined || req.query.callback.length === 0) { if ( req.query.callback === undefined || req.query.callback.length === 0) {