Skip to content

Commit

Permalink
In lieu of rolling an egg, just test for statsd when middleware is wr…
Browse files Browse the repository at this point in the history
…apped.
  • Loading branch information
dannon committed Oct 1, 2015
1 parent fc69247 commit c6794e6
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/galaxy/webapps/galaxy/buildapp.py
Expand Up @@ -692,9 +692,15 @@ def wrap_in_middleware( app, global_conf, **local_conf ):
# Statsd request timing and profiling
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'))
log.debug( "Enabling 'statsd' middleware" )
try:
import statsd # noqa -- we simply ensure availability of the statsd module here before wrapping middleware
from galaxy.web.framework.middleware.statsd import StatsdMiddleware
app = StatsdMiddleware( app, statsd_host, conf.get('statsd_port'))
log.debug( "Enabling 'statsd' middleware" )
except ImportError:
log.error( "Statsd middleware configured, but no statsd python module found. "
"Please install the python statsd module to use this functionality." )

# X-Forwarded-Host handling
from galaxy.web.framework.middleware.xforwardedhost import XForwardedHostMiddleware
app = XForwardedHostMiddleware( app )
Expand Down

0 comments on commit c6794e6

Please sign in to comment.