Allow using ":host" as part of statsd.prefix

It'll be replaced with hostname.
Closes #153
This commit is contained in:
Sandro Santilli 2014-02-19 15:27:20 +01:00
parent 30a2d85e92
commit b4fc8ec4a5
2 changed files with 15 additions and 1 deletions

View File

@ -1,6 +1,10 @@
1.8.2 -- 2014-MM-DD 1.8.2 -- 2014-MM-DD
------------------- -------------------
Enhancements:
* Allow using ":host" as part of statsd.prefix (#153)
1.8.1 -- 2014-02-19 1.8.1 -- 2014-02-19
------------------- -------------------

View File

@ -7,11 +7,21 @@ var _ = require('underscore')
, cartoData = require('cartodb-redis')(global.environment.redis) , cartoData = require('cartodb-redis')(global.environment.redis)
, SignedMaps = require('./signed_maps.js') , SignedMaps = require('./signed_maps.js')
, TemplateMaps = require('./template_maps.js') , TemplateMaps = require('./template_maps.js')
, Cache = require('./cache_validator'); , Cache = require('./cache_validator')
, os = require('os')
;
var CartodbWindshaft = function(serverOptions) { var CartodbWindshaft = function(serverOptions) {
var debug = global.environment.debug; 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) { if(serverOptions.cache_enabled) {
console.log("cache invalidation enabled, varnish on ", serverOptions.varnish_host, ' ', serverOptions.varnish_port); console.log("cache invalidation enabled, varnish on ", serverOptions.varnish_host, ' ', serverOptions.varnish_port);
Cache.init(serverOptions.varnish_host, serverOptions.varnish_port, serverOptions.varnish_secret); Cache.init(serverOptions.varnish_host, serverOptions.varnish_port, serverOptions.varnish_secret);