mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-25 00:12:08 +08:00
Support configurable statsd prefix (was formerly just 'galaxy', which remains the default)
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user