From fc61a4968e78164ca114ed1132d51f8487ee97b7 Mon Sep 17 00:00:00 2001 From: Tovin Seven Date: Mon, 6 Mar 2017 08:32:36 +0700 Subject: [PATCH] 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 --- glare/cmd/api.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/glare/cmd/api.py b/glare/cmd/api.py index 41e3d07..cf30b79 100755 --- a/glare/cmd/api.py +++ b/glare/cmd/api.py @@ -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)