Merge "Remove neutron_lib.db from db profiling projects"
This commit is contained in:
commit
044ca8e3e4
@ -38,7 +38,6 @@ from neutron_lib.objects import exceptions as obj_exc
|
|||||||
|
|
||||||
|
|
||||||
MAX_RETRIES = 20
|
MAX_RETRIES = 20
|
||||||
OSPROFILER_TRACE_NAMES = {'neutron.db', 'neutron_lib.db'}
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
_synchronized = lockutils.synchronized_with_prefix("neutron-")
|
_synchronized = lockutils.synchronized_with_prefix("neutron-")
|
||||||
_CTX_MANAGER = None
|
_CTX_MANAGER = None
|
||||||
@ -68,9 +67,8 @@ def get_context_manager():
|
|||||||
def _set_hook(engine):
|
def _set_hook(engine):
|
||||||
if (profiler_opts.is_trace_enabled() and
|
if (profiler_opts.is_trace_enabled() and
|
||||||
profiler_opts.is_db_trace_enabled()):
|
profiler_opts.is_db_trace_enabled()):
|
||||||
for trace_name in OSPROFILER_TRACE_NAMES:
|
osprofiler.sqlalchemy.add_tracing(
|
||||||
osprofiler.sqlalchemy.add_tracing(
|
sqlalchemy, engine, "neutron.db")
|
||||||
sqlalchemy, engine, trace_name)
|
|
||||||
|
|
||||||
|
|
||||||
# TODO(ihrachys) the hook assumes options defined by osprofiler, and the only
|
# TODO(ihrachys) the hook assumes options defined by osprofiler, and the only
|
||||||
|
@ -213,7 +213,5 @@ class TestDBProfiler(_base.BaseTestCase):
|
|||||||
osprofiler.sqlalchemy, 'add_tracing') as add_tracing:
|
osprofiler.sqlalchemy, 'add_tracing') as add_tracing:
|
||||||
engine_mock = mock.Mock()
|
engine_mock = mock.Mock()
|
||||||
db_api._set_hook(engine_mock)
|
db_api._set_hook(engine_mock)
|
||||||
self.assertEqual(2, len(add_tracing.mock_calls))
|
add_tracing.assert_called_once_with(
|
||||||
expected_calls = [mock.call(sqlalchemy, mock.ANY, n)
|
sqlalchemy, mock.ANY, "neutron.db")
|
||||||
for n in db_api.OSPROFILER_TRACE_NAMES]
|
|
||||||
self.assertEqual(expected_calls, add_tracing.mock_calls)
|
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
other:
|
||||||
|
- |
|
||||||
|
Module ``neutron_lib.db`` is now removed from db profiling projects so
|
||||||
|
database calls done from this module will not be tracked in osprofiler
|
||||||
|
results.
|
||||||
|
All db calls which are tracked by osprofiler are comming from
|
||||||
|
Neutron and this avoids having each call logged twice in osprofiler
|
||||||
|
report.
|
Loading…
x
Reference in New Issue
Block a user