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
This commit is contained in:
Alexander Ignatyev 2016-07-20 03:32:03 +03:00 committed by Tovin Seven
parent c38f68e745
commit 4a610e6891
1 changed files with 7 additions and 9 deletions

View File

@ -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"