Support new OSProfiler API

Use osprofiler initializer instead of calling osprofiler
notifier directly

Co-Authored-By: Tovin Seven <vinhnt@vn.fujitsu.com>

Change-Id: I127077f8d153994632b80cee649475478fa18164
This commit is contained in:
Alexey Yelistratov
2016-05-16 15:42:39 +03:00
committed by Tovin Seven
parent 578f538baf
commit d51fa7fe20
2 changed files with 18 additions and 26 deletions
+9 -13
View File
@@ -43,9 +43,7 @@ if os.path.exists(os.path.join(possible_topdir, 'glance', '__init__.py')):
import glance_store
from oslo_config import cfg
from oslo_log import log as logging
import oslo_messaging
import osprofiler.notifier
import osprofiler.web
import osprofiler.initializer
from glance.common import config
from glance.common import exception
@@ -76,16 +74,14 @@ def main():
logging.setup(CONF, 'glance')
notifier.set_defaults()
if cfg.CONF.profiler.enabled:
_notifier = osprofiler.notifier.create("Messaging",
oslo_messaging, {},
notifier.get_transport(),
"glance", "api",
cfg.CONF.bind_host)
osprofiler.notifier.set(_notifier)
osprofiler.web.enable(cfg.CONF.profiler.hmac_keys)
else:
osprofiler.web.disable()
if CONF.profiler.enabled:
osprofiler.initializer.init_from_conf(
conf=CONF,
context={},
project="glance",
service="api",
host=CONF.bind_host
)
server = wsgi.Server(initialize_glance_store=True)
server.start(config.load_paste_app('glance-api'), default_port=9292)
+9 -13
View File
@@ -40,9 +40,7 @@ if os.path.exists(os.path.join(possible_topdir, 'glance', '__init__.py')):
from oslo_config import cfg
from oslo_log import log as logging
import oslo_messaging
import osprofiler.notifier
import osprofiler.web
import osprofiler.initializer
from glance.common import config
from glance.common import wsgi
@@ -61,16 +59,14 @@ def main():
logging.setup(CONF, 'glance')
notifier.set_defaults()
if cfg.CONF.profiler.enabled:
_notifier = osprofiler.notifier.create("Messaging",
oslo_messaging, {},
notifier.get_transport(),
"glance", "registry",
cfg.CONF.bind_host)
osprofiler.notifier.set(_notifier)
osprofiler.web.enable(cfg.CONF.profiler.hmac_keys)
else:
osprofiler.web.disable()
if CONF.profiler.enabled:
osprofiler.initializer.init_from_conf(
conf=CONF,
context={},
project="glance",
service="registry",
host=CONF.bind_host
)
server = wsgi.Server()
server.start(config.load_paste_app('glance-registry'),