78 lines
2.8 KiB
Diff
78 lines
2.8 KiB
Diff
diff --git a/keystone/common/sql/core.py b/keystone/common/sql/core.py
|
|
index e9b780a..4dcf4dc 100644
|
|
--- a/keystone/common/sql/core.py
|
|
+++ b/keystone/common/sql/core.py
|
|
@@ -28,6 +28,7 @@ from keystone.common import logging
|
|
from keystone import config
|
|
from keystone.openstack.common import jsonutils
|
|
|
|
+import tomograph
|
|
|
|
CONF = config.CONF
|
|
|
|
@@ -137,6 +138,9 @@ class Base(object):
|
|
"""Return a SQLAlchemy session."""
|
|
if self._MAKER is None or self._ENGINE is None:
|
|
self._ENGINE = self.get_engine()
|
|
+ sqlalchemy.event.listen(self._ENGINE, 'before_execute', tomograph.before_execute('keystone'))
|
|
+ sqlalchemy.event.listen(self._ENGINE, 'after_execute', tomograph.after_execute('keystone'))
|
|
+
|
|
self._MAKER = self.get_maker(self._ENGINE,
|
|
autocommit,
|
|
expire_on_commit)
|
|
diff --git a/keystone/contrib/stats/core.py b/keystone/contrib/stats/core.py
|
|
index a479ee3..efa9dc1 100644
|
|
--- a/keystone/contrib/stats/core.py
|
|
+++ b/keystone/contrib/stats/core.py
|
|
@@ -23,6 +23,7 @@ from keystone.common import logging
|
|
from keystone.common import manager
|
|
from keystone.common import wsgi
|
|
|
|
+import tomograph
|
|
|
|
CONF = config.CONF
|
|
LOG = logging.getLogger(__name__)
|
|
@@ -141,9 +142,11 @@ class StatsMiddleware(wsgi.Middleware):
|
|
|
|
def process_request(self, request):
|
|
"""Monitor incoming request attributes."""
|
|
+ tomograph.start_http('keystone', 'WSGI', request)
|
|
self.capture_stats(request.host, request, self.request_attributes)
|
|
|
|
def process_response(self, request, response):
|
|
"""Monitor outgoing response attributes."""
|
|
+ tomograph.stop('WSGI')
|
|
self.capture_stats(request.host, response, self.response_attributes)
|
|
return response
|
|
diff --git a/keystone/middleware/auth_token.py b/keystone/middleware/auth_token.py
|
|
index ddadf9f..3ee86cd 100644
|
|
--- a/keystone/middleware/auth_token.py
|
|
+++ b/keystone/middleware/auth_token.py
|
|
@@ -108,6 +108,8 @@ from keystone.common import cms
|
|
from keystone.common import utils
|
|
from keystone.openstack.common import timeutils
|
|
|
|
+import tomograph
|
|
+
|
|
CONF = None
|
|
try:
|
|
from openstack.common import cfg
|
|
@@ -398,6 +400,8 @@ class AuthProtocol(object):
|
|
|
|
while True:
|
|
try:
|
|
+ headers = kwargs.setdefault('headers', {})
|
|
+ tomograph.add_trace_info_header(headers)
|
|
conn.request(method, path, **kwargs)
|
|
response = conn.getresponse()
|
|
body = response.read()
|
|
@@ -437,6 +441,8 @@ class AuthProtocol(object):
|
|
if additional_headers:
|
|
kwargs['headers'].update(additional_headers)
|
|
|
|
+ tomograph.add_trace_info_header(kwargs['headers'])
|
|
+
|
|
if body:
|
|
kwargs['body'] = jsonutils.dumps(body)
|
|
|