def test_options_defaults_override(self):
     opts.set_defaults(self.conf_fixture.conf, enabled=True, trace_sqlalchemy=True, hmac_keys="MY_KEY")
     self.assertTrue(self.conf_fixture.conf.profiler.enabled)
     self.assertTrue(self.conf_fixture.conf.profiler.trace_sqlalchemy)
     self.assertEqual("MY_KEY", self.conf_fixture.conf.profiler.hmac_keys)
     self.assertTrue(opts.is_trace_enabled(self.conf_fixture.conf))
     self.assertTrue(opts.is_db_trace_enabled(self.conf_fixture.conf))
 def test_options_defaults(self):
     opts.set_defaults(self.conf_fixture.conf)
     self.assertFalse(self.conf_fixture.conf.profiler.enabled)
     self.assertFalse(self.conf_fixture.conf.profiler.trace_sqlalchemy)
     self.assertEqual("SECRET_KEY", self.conf_fixture.conf.profiler.hmac_keys)
     self.assertFalse(opts.is_trace_enabled(self.conf_fixture.conf))
     self.assertFalse(opts.is_db_trace_enabled(self.conf_fixture.conf))
Esempio n. 3
0
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')
Esempio n. 4
0
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')
Esempio n. 5
0
def _set_hook(engine):
    if (profiler_opts.is_trace_enabled()
            and profiler_opts.is_db_trace_enabled()):
        for trace_name in OSPROFILER_TRACE_NAMES:
            osprofiler.sqlalchemy.add_tracing(sqlalchemy, engine, trace_name)