From 975c6f5eae19a7f37a828c1d0648f00b2366449a Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Tue, 22 Mar 2016 17:35:14 -0400 Subject: [PATCH] Much more friendly route mapping. --- lib/galaxy/web/framework/base.py | 1 + lib/galaxy/web/framework/middleware/statsd.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/web/framework/base.py b/lib/galaxy/web/framework/base.py index 11cde3ad4b1..a673e5fa482 100644 --- a/lib/galaxy/web/framework/base.py +++ b/lib/galaxy/web/framework/base.py @@ -180,6 +180,7 @@ class WebApplication( object ): # Is the method callable if not callable( method ): raise httpexceptions.HTTPNotFound( "Action not callable for " + path_info ) + environ['controller_action_key'] = "%s.%s.%s" % ('api' if environ['is_api_request'] else 'web', controller_name, action or 'default') # Combine mapper args and query string / form args and call kwargs = trans.request.params.mixed() kwargs.update( map ) diff --git a/lib/galaxy/web/framework/middleware/statsd.py b/lib/galaxy/web/framework/middleware/statsd.py index eb33d43ae2a..2e0ccd7603d 100644 --- a/lib/galaxy/web/framework/middleware/statsd.py +++ b/lib/galaxy/web/framework/middleware/statsd.py @@ -32,5 +32,5 @@ class StatsdMiddleware(object): start_time = time.time() req = self.application(environ, start_response) dt = int((time.time() - start_time) * 1000) - self.statsd_client.timing(environ.get('PATH_INFO', "NOPATH").strip('/').replace('/', '.'), dt) + self.statsd_client.timing(environ.get('controller_action_key', None) or environ.get('PATH_INFO', "NOPATH").strip('/').replace('/', '.'), dt) return req