diff --git a/NEWS.md b/NEWS.md index 80f2d85b..b35e4018 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,10 @@ 1.8.2 -- 2014-MM-DD ------------------- +Enhancements: + + * Allow using ":host" as part of statsd.prefix (#153) + 1.8.1 -- 2014-02-19 ------------------- diff --git a/lib/cartodb/cartodb_windshaft.js b/lib/cartodb/cartodb_windshaft.js index 9a40725e..8f76ab71 100644 --- a/lib/cartodb/cartodb_windshaft.js +++ b/lib/cartodb/cartodb_windshaft.js @@ -7,11 +7,21 @@ var _ = require('underscore') , cartoData = require('cartodb-redis')(global.environment.redis) , SignedMaps = require('./signed_maps.js') , TemplateMaps = require('./template_maps.js') - , Cache = require('./cache_validator'); + , Cache = require('./cache_validator') + , os = require('os') +; var CartodbWindshaft = function(serverOptions) { var debug = global.environment.debug; + // Perform keyword substitution in statsd + // See https://github.com/CartoDB/Windshaft-cartodb/issues/153 + if ( global.environment.statsd ) { + if ( global.environment.statsd.prefix ) { + global.environment.statsd.prefix = global.environment.statsd.prefix.replace(/:host/, os.hostname()); + } + } + if(serverOptions.cache_enabled) { console.log("cache invalidation enabled, varnish on ", serverOptions.varnish_host, ' ', serverOptions.varnish_port); Cache.init(serverOptions.varnish_host, serverOptions.varnish_port, serverOptions.varnish_secret);