From 51cccd24ddc48583aaf965e244a66551c052f9f3 Mon Sep 17 00:00:00 2001
From: Alexander Ignatyev <aignatyev@mirantis.com>
Date: Wed, 13 Jul 2016 12:53:46 +0300
Subject: [PATCH] Support new osprofiler API

Notifier initialization moved to osprofiler. Added call
to init_from_conf method that does it.

Change-Id: I7cba52f9a6c8f4b8a9714382169cee15fb38a58a
Depends-On: I77d0d3b5e9e725507916724dcd28d5fbc6f7f5c7
---
 keystone/common/profiler.py | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/keystone/common/profiler.py b/keystone/common/profiler.py
index 58a515e868..9e59889570 100644
--- a/keystone/common/profiler.py
+++ b/keystone/common/profiler.py
@@ -11,9 +11,7 @@
 #    under the License.
 
 from oslo_log import log
-import oslo_messaging
-import osprofiler.notifier
-import osprofiler.web
+import osprofiler.initializer
 
 import keystone.conf
 from keystone.i18n import _LI
@@ -32,11 +30,13 @@ def setup(name, host='0.0.0.0'):  # nosec
                  specified host name / address usage is highly recommended.
     """
     if CONF.profiler.enabled:
-        _notifier = osprofiler.notifier.create(
-            "Messaging", oslo_messaging, {},
-            oslo_messaging.get_transport(CONF), "keystone", name, host)
-        osprofiler.notifier.set(_notifier)
-        osprofiler.web.enable(CONF.profiler.hmac_keys)
+        osprofiler.initializer.init_from_conf(
+            conf=CONF,
+            context={},
+            project="keystone",
+            service=name,
+            host=host
+        )
         LOG.info(_LI("OSProfiler is enabled.\n"
                      "Traces provided from the profiler "
                      "can only be subscribed to using the same HMAC keys that "