From 7bc5bab4325c5adca0494ccd01fe3188f4c54653 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Mon, 3 Mar 2014 16:24:20 +0100 Subject: [PATCH] Properly prefix statsd labels for all endpoints CDB-1861 #resolve Will be 100% complete with update of Windshaft to 0.19.3+ --- NEWS.md | 4 ++++ lib/cartodb/cartodb_windshaft.js | 20 +++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 30059b17..c5fd0ed7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,10 @@ 1.8.5 -- 2014-03-DD ------------------- +Enhancements: + + - Set statsd prefix for all endpoints + 1.8.4 -- 2014-03-03 ------------------- diff --git a/lib/cartodb/cartodb_windshaft.js b/lib/cartodb/cartodb_windshaft.js index a592d308..349f3189 100644 --- a/lib/cartodb/cartodb_windshaft.js +++ b/lib/cartodb/cartodb_windshaft.js @@ -97,6 +97,9 @@ var CartodbWindshaft = function(serverOptions) { * Helper to allow access to the layer to be used in the maps infowindow popup. */ ws.get(serverOptions.base_url + '/infowindow', function(req, res){ + if ( req.profiler && req.profiler.statsd_client ) { + req.profiler.start('windshaft-cartodb.get_infowindow'); + } ws.doCORS(res); Step( function(){ @@ -118,6 +121,9 @@ var CartodbWindshaft = function(serverOptions) { * Helper to allow access to metadata to be used in embedded maps. */ ws.get(serverOptions.base_url + '/map_metadata', function(req, res){ + if ( req.profiler && req.profiler.statsd_client ) { + req.profiler.start('windshaft-cartodb.get_map_metadata'); + } ws.doCORS(res); Step( function(){ @@ -139,6 +145,9 @@ var CartodbWindshaft = function(serverOptions) { * TODO: Move? */ ws.del(serverOptions.base_url + '/flush_cache', function(req, res){ + if ( req.profiler && req.profiler.statsd_client ) { + req.profiler.start('windshaft-cartodb.flush_cache'); + } ws.doCORS(res); Step( function flushCache(){ @@ -273,6 +282,9 @@ var CartodbWindshaft = function(serverOptions) { // Get a specific template ws.get(template_baseurl + '/:template_id', function(req, res) { + if ( req.profiler && req.profiler.statsd_client ) { + req.profiler.start('windshaft-cartodb.get_template'); + } ws.doCORS(res); var that = this; var response = {}; @@ -330,7 +342,10 @@ var CartodbWindshaft = function(serverOptions) { }); // Delete a specific template - ws.delete(template_baseurl + '/:template_id', function(req, res) { + ws.del(template_baseurl + '/:template_id', function(req, res) { + if ( req.profiler && req.profiler.statsd_client ) { + req.profiler.start('windshaft-cartodb.delete_template'); + } ws.doCORS(res); var that = this; var response = {}; @@ -381,6 +396,9 @@ var CartodbWindshaft = function(serverOptions) { // Get a list of owned templates ws.get(template_baseurl, function(req, res) { + if ( req.profiler && req.profiler.statsd_client ) { + req.profiler.start('windshaft-cartodb.get_template_list'); + } ws.doCORS(res); var that = this; var response = {};