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 import glance_store
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
import oslo_messaging import osprofiler.initializer
import osprofiler.notifier
import osprofiler.web
from glance.common import config from glance.common import config
from glance.common import exception from glance.common import exception
@ -77,16 +75,14 @@ def main():
logging.setup(CONF, 'glance') logging.setup(CONF, 'glance')
notifier.set_defaults() notifier.set_defaults()
if cfg.CONF.profiler.enabled: if CONF.profiler.enabled:
_notifier = osprofiler.notifier.create("Messaging", osprofiler.initializer.init_from_conf(
oslo_messaging, {}, conf=CONF,
notifier.get_transport(), context={},
"glance", "api", project="glance",
cfg.CONF.bind_host) service="api",
osprofiler.notifier.set(_notifier) host=CONF.bind_host
osprofiler.web.enable(cfg.CONF.profiler.hmac_keys) )
else:
osprofiler.web.disable()
server = wsgi.Server(initialize_glance_store=True) server = wsgi.Server(initialize_glance_store=True)
server.start(config.load_paste_app('glance-api'), default_port=9292) 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_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
import oslo_messaging import osprofiler.initializer
import osprofiler.notifier
import osprofiler.web
from glance.common import config from glance.common import config
from glance.common import wsgi from glance.common import wsgi
@ -61,16 +59,14 @@ def main():
logging.setup(CONF, 'glance') logging.setup(CONF, 'glance')
notifier.set_defaults() notifier.set_defaults()
if cfg.CONF.profiler.enabled: if CONF.profiler.enabled:
_notifier = osprofiler.notifier.create("Messaging", osprofiler.initializer.init_from_conf(
oslo_messaging, {}, conf=CONF,
notifier.get_transport(), context={},
"glance", "registry", project="glance",
cfg.CONF.bind_host) service="registry",
osprofiler.notifier.set(_notifier) host=CONF.bind_host
osprofiler.web.enable(cfg.CONF.profiler.hmac_keys) )
else:
osprofiler.web.disable()
server = wsgi.Server() server = wsgi.Server()
server.start(config.load_paste_app('glance-registry'), server.start(config.load_paste_app('glance-registry'),