From 8588be3e434b65b2e0ff02b8a8b0810ec6578948 Mon Sep 17 00:00:00 2001 From: Boden R Date: Mon, 5 Nov 2018 09:23:51 -0600 Subject: [PATCH] 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 --- neutron/db/api.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/neutron/db/api.py b/neutron/db/api.py index a93b19fe764..dc98622209e 100644 --- a/neutron/db/api.py +++ b/neutron/db/api.py @@ -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. #