Merge "Support new osprofiler API"

This commit is contained in:
Jenkins 2016-12-13 11:42:27 +00:00 committed by Gerrit Code Review
commit 54429130a1
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"