Merge "Support new OSProfiler API"

This commit is contained in:
Jenkins 2017-06-07 11:35:59 +00:00 committed by Gerrit Code Review
commit 8f9353d232
2 changed files with 18 additions and 26 deletions

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
@ -77,16 +75,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)

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'),