Support new OSProfiler API

Use osprofiler initializer instead of calling
osprofiler notifier directly

Moved from this patch: https://review.openstack.org/#/c/316799/11

Change-Id: I4074e2fff14089889b759eb5c8f58a11680e1873
This commit is contained in:
Tovin Seven 2017-03-06 08:32:36 +07:00
parent c2d5a7ffde
commit fc61a4968e
1 changed files with 9 additions and 10 deletions

View File

@ -39,9 +39,7 @@ if os.path.exists(os.path.join(possible_topdir, 'glare', '__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
from osprofiler import initializer
from glare.common import config
from glare.common import exception
@ -72,13 +70,14 @@ def main():
logging.setup(CONF, 'glare')
notification.set_defaults()
if cfg.CONF.profiler.enabled:
_notifier = osprofiler.notifier.create(
"Messaging", oslo_messaging, {}, notification.get_transport(),
"glare", "artifacts", cfg.CONF.bind_host)
osprofiler.notifier.set(_notifier)
else:
osprofiler.web.disable()
if CONF.profiler.enabled:
initializer.init_from_conf(
conf=CONF,
context={},
project="glare",
service="api",
host=CONF.bind_host
)
server = wsgi.Server(initialize_glance_store=True)
server.start(config.load_paste_app('glare-api'), default_port=9494)