Register osprofiler options before setting engine hook
The patch makes the module to not assume the options are registered by some other code, that may never be executed, f.e. when it's part of a single test case execution. Change-Id: I7eefb32e6f34d732bda681919b434a96b8ad36da Closes-Bug: #1640782
This commit is contained in:
parent
f562750d6b
commit
e727b92d3d
|
@ -24,6 +24,7 @@ from oslo_db import exception as db_exc
|
|||
from oslo_db.sqlalchemy import enginefacade
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
from osprofiler import opts as profiler_opts
|
||||
import osprofiler.sqlalchemy
|
||||
from pecan import util as p_util
|
||||
import six
|
||||
|
@ -42,6 +43,12 @@ def set_hook(engine):
|
|||
context_manager = enginefacade.transaction_context()
|
||||
|
||||
context_manager.configure(sqlite_fk=True)
|
||||
|
||||
# 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)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue