From 6a4cda35bd19f1fd7e7d988fed592951f28801aa Mon Sep 17 00:00:00 2001 From: Alexei Kornienko Date: Fri, 11 Oct 2013 12:30:52 +0300 Subject: [PATCH 2/3] Added sql tracing --- keystone/openstack/common/db/sqlalchemy/session.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/keystone/openstack/common/db/sqlalchemy/session.py b/keystone/openstack/common/db/sqlalchemy/session.py index d28227d..d8de7bf 100644 --- a/keystone/openstack/common/db/sqlalchemy/session.py +++ b/keystone/openstack/common/db/sqlalchemy/session.py @@ -245,6 +245,7 @@ import functools import os.path import re import time +import tomograph from oslo.config import cfg import six @@ -569,6 +570,9 @@ def get_engine(sqlite_fk=False, slave_engine=False): if engine is None: engine = create_engine(db_uri, sqlite_fk=sqlite_fk) + if engine.name != 'sqlite': + sqlalchemy.event.listen(engine, 'before_execute', tomograph.before_execute('nova')) + sqlalchemy.event.listen(engine, 'after_execute', tomograph.after_execute('nova')) if slave_engine: _SLAVE_ENGINE = engine else: -- 1.8.1.2