Remove sqlalchemy osprofiler

sqlalchemy osprofiler is set up for Neutron by neutron-lib in [1]. As a
consequence, there is no need to set it up in Neutron. Besides, when
profiling Neutron code, this duplication creates repetitive output in
the reports. This patch removes this set up from the DB API module.

[1] https://github.com/openstack/neutron-lib/blob/master/neutron_lib/db/api.py

Change-Id: I15f3ee374333e3cba2bf659439dd82263681f1df
This commit is contained in:
Boden R 2018-11-05 09:23:51 -06:00 committed by Tovin Seven
parent 2e720b158b
commit 8588be3e43

View File

@ -17,29 +17,13 @@ import weakref
from neutron_lib.db import api
from neutron_lib.db import model_base
from oslo_config import cfg
from osprofiler import opts as profiler_opts
import osprofiler.sqlalchemy
import sqlalchemy
from sqlalchemy import event # noqa
from sqlalchemy import orm
def set_hook(engine):
if (profiler_opts.is_trace_enabled() and
profiler_opts.is_db_trace_enabled()):
osprofiler.sqlalchemy.add_tracing(sqlalchemy, engine, 'neutron.db')
context_manager = api.get_context_manager()
# TODO(ihrachys) the hook assumes options defined by osprofiler, and the only
# public function that is provided by osprofiler that will register them is
# set_defaults, that's why we call it here even though we don't need to change
# defaults
profiler_opts.set_defaults(cfg.CONF)
context_manager.append_on_engine_create(set_hook)
# Expire relationships when foreign key changes.
#