From 4a610e6891e78eef67cb04422d5106a487d87ace Mon Sep 17 00:00:00 2001 From: Alexander Ignatyev Date: Wed, 20 Jul 2016 03:32:03 +0300 Subject: [PATCH] Support new osprofiler API Notifier initialization moved to osprofiler. Added call to init_from_conf method that does it. Change-Id: Ia552b8a40eeea49b9882befaaf41fa9b1ed3da1e Depends-On: I77d0d3b5e9e725507916724dcd28d5fbc6f7f5c7 --- heat/common/profiler.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/heat/common/profiler.py b/heat/common/profiler.py index 89fc156c82..95f54c0ac5 100644 --- a/heat/common/profiler.py +++ b/heat/common/profiler.py @@ -13,13 +13,10 @@ from oslo_config import cfg from oslo_log import log as logging -import oslo_messaging as messaging -import osprofiler.profiler -import osprofiler.web +import osprofiler.initializer from heat.common import context from heat.common.i18n import _LW -from heat.common import messaging as rpc_messaging cfg.CONF.import_opt('enabled', 'heat.common.config', group='profiler') @@ -28,11 +25,12 @@ LOG = logging.getLogger(__name__) def setup(binary, host): if cfg.CONF.profiler.enabled: - _notifier = osprofiler.notifier.create( - "Messaging", messaging, context.get_admin_context().to_dict(), - rpc_messaging.TRANSPORT, "heat", binary, host) - osprofiler.notifier.set(_notifier) - osprofiler.web.enable(cfg.CONF.profiler.hmac_keys) + osprofiler.initializer.init_from_conf( + conf=cfg.CONF, + context=context.get_admin_context().to_dict(), + project="heat", + service=binary, + host=host) LOG.warning(_LW("OSProfiler is enabled.\nIt means that person who " "knows any of hmac_keys that are specified in " "/etc/heat/heat.conf can trace his requests. \n"