Support configurable statsd prefix (was formerly just 'galaxy', which remains the default)

This commit is contained in:
Dannon Baker
2016-04-14 15:51:41 -04:00
parent 44a337ab6f
commit 238b90a7f5
4 changed files with 12 additions and 4 deletions
+4 -1
View File
@@ -767,9 +767,12 @@ use_interactive = True
# Log to statsd
# Statsd is an external statistics aggregator (https://github.com/etsy/statsd)
# Enabling the following options will cause galaxy to log request timing and
# other statistics to the configured statsd instance.
# other statistics to the configured statsd instance. The statsd_prefix is
# useful if you are running multiple Galaxy instances and want to segment
# statistics between them within the same aggregator.
#statsd_host=
#statsd_port=8125
#statsd_prefix=galaxy
# -- Data Libraries
+1
View File
@@ -446,6 +446,7 @@ class Configuration( object ):
# Statistics and profiling with statsd
self.statsd_host = kwargs.get( 'statsd_host', '')
self.statsd_port = int( kwargs.get( 'statsd_port', 8125 ) )
self.statsd_prefix = kwargs.get( 'statsd_prefix', 'galaxy' )
# Logging with fluentd
self.fluent_log = string_as_bool( kwargs.get( 'fluent_log', False ) )
self.fluent_host = kwargs.get( 'fluent_host', 'localhost' )
@@ -21,12 +21,13 @@ class StatsdMiddleware(object):
def __init__(self,
application,
statsd_host,
statsd_port):
statsd_port,
statsd_prefix):
if not statsd:
raise ImportError( "Statsd middleware configured, but no statsd python module found. "
"Please install the python statsd module to use this functionality." )
self.application = application
self.statsd_client = statsd.StatsClient(statsd_host, statsd_port, prefix='galaxy')
self.statsd_client = statsd.StatsClient(statsd_host, statsd_port, prefix=statsd_prefix)
def __call__(self, environ, start_response):
start_time = time.time()
+4 -1
View File
@@ -774,7 +774,10 @@ def wrap_in_middleware( app, global_conf, **local_conf ):
statsd_host = conf.get('statsd_host', None)
if statsd_host:
from galaxy.web.framework.middleware.statsd import StatsdMiddleware
app = StatsdMiddleware( app, statsd_host, conf.get('statsd_port'))
app = StatsdMiddleware( app,
statsd_host,
conf.get('statsd_port'),
conf.get('statsd_prefix') )
log.debug( "Enabling 'statsd' middleware" )
# X-Forwarded-Host handling