Merge "Use OSprofiler options consolidated in lib itself"
This commit is contained in:
commit
b24215a492
|
@ -17,6 +17,7 @@ import os
|
||||||
from eventlet.green import socket
|
from eventlet.green import socket
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
from osprofiler import opts as profiler
|
||||||
|
|
||||||
from heat.common import exception
|
from heat.common import exception
|
||||||
from heat.common.i18n import _
|
from heat.common.i18n import _
|
||||||
|
@ -249,16 +250,6 @@ rpc_opts = [
|
||||||
'It is not necessarily a hostname, FQDN, '
|
'It is not necessarily a hostname, FQDN, '
|
||||||
'or IP address.'))]
|
'or IP address.'))]
|
||||||
|
|
||||||
profiler_group = cfg.OptGroup('profiler')
|
|
||||||
profiler_opts = [
|
|
||||||
cfg.BoolOpt("profiler_enabled", default=False,
|
|
||||||
help=_('If False fully disable profiling feature.')),
|
|
||||||
cfg.BoolOpt("trace_sqlalchemy", default=False,
|
|
||||||
help=_("If False do not trace SQL requests.")),
|
|
||||||
cfg.StrOpt("hmac_keys", default="SECRET_KEY",
|
|
||||||
help=_("Secret key to use to sign tracing messages."))
|
|
||||||
]
|
|
||||||
|
|
||||||
auth_password_group = cfg.OptGroup('auth_password')
|
auth_password_group = cfg.OptGroup('auth_password')
|
||||||
auth_password_opts = [
|
auth_password_opts = [
|
||||||
cfg.BoolOpt('multi_cloud',
|
cfg.BoolOpt('multi_cloud',
|
||||||
|
@ -367,7 +358,7 @@ def list_opts():
|
||||||
yield paste_deploy_group.name, paste_deploy_opts
|
yield paste_deploy_group.name, paste_deploy_opts
|
||||||
yield auth_password_group.name, auth_password_opts
|
yield auth_password_group.name, auth_password_opts
|
||||||
yield revision_group.name, revision_opts
|
yield revision_group.name, revision_opts
|
||||||
yield profiler_group.name, profiler_opts
|
yield profiler.list_opts()[0]
|
||||||
yield 'clients', default_clients_opts
|
yield 'clients', default_clients_opts
|
||||||
|
|
||||||
for client in ('nova', 'swift', 'neutron', 'cinder',
|
for client in ('nova', 'swift', 'neutron', 'cinder',
|
||||||
|
@ -385,7 +376,7 @@ def list_opts():
|
||||||
cfg.CONF.register_group(paste_deploy_group)
|
cfg.CONF.register_group(paste_deploy_group)
|
||||||
cfg.CONF.register_group(auth_password_group)
|
cfg.CONF.register_group(auth_password_group)
|
||||||
cfg.CONF.register_group(revision_group)
|
cfg.CONF.register_group(revision_group)
|
||||||
cfg.CONF.register_group(profiler_group)
|
profiler.set_defaults(cfg.CONF)
|
||||||
|
|
||||||
for group, opts in list_opts():
|
for group, opts in list_opts():
|
||||||
cfg.CONF.register_opts(opts, group=group)
|
cfg.CONF.register_opts(opts, group=group)
|
||||||
|
|
|
@ -21,13 +21,13 @@ from heat.common import context
|
||||||
from heat.common.i18n import _LW
|
from heat.common.i18n import _LW
|
||||||
from heat.common import messaging as rpc_messaging
|
from heat.common import messaging as rpc_messaging
|
||||||
|
|
||||||
cfg.CONF.import_opt('profiler_enabled', 'heat.common.config', group='profiler')
|
cfg.CONF.import_opt('enabled', 'heat.common.config', group='profiler')
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def setup(binary, host):
|
def setup(binary, host):
|
||||||
if cfg.CONF.profiler.profiler_enabled:
|
if cfg.CONF.profiler.enabled:
|
||||||
_notifier = osprofiler.notifier.create(
|
_notifier = osprofiler.notifier.create(
|
||||||
"Messaging", messaging, context.get_admin_context().to_dict(),
|
"Messaging", messaging, context.get_admin_context().to_dict(),
|
||||||
rpc_messaging.TRANSPORT, "heat", binary, host)
|
rpc_messaging.TRANSPORT, "heat", binary, host)
|
||||||
|
@ -41,6 +41,6 @@ def setup(binary, host):
|
||||||
"can trigger profiler, only admin user can retrieve "
|
"can trigger profiler, only admin user can retrieve "
|
||||||
"trace information.\n"
|
"trace information.\n"
|
||||||
"To disable OSprofiler set in heat.conf:\n"
|
"To disable OSprofiler set in heat.conf:\n"
|
||||||
"[profiler]\nprofiler_enabled=false"))
|
"[profiler]\nenabled=false"))
|
||||||
else:
|
else:
|
||||||
osprofiler.web.disable()
|
osprofiler.web.disable()
|
||||||
|
|
|
@ -51,7 +51,7 @@ def get_facade():
|
||||||
|
|
||||||
if not _facade:
|
if not _facade:
|
||||||
_facade = db_session.EngineFacade.from_config(CONF)
|
_facade = db_session.EngineFacade.from_config(CONF)
|
||||||
if CONF.profiler.profiler_enabled:
|
if CONF.profiler.enabled:
|
||||||
if CONF.profiler.trace_sqlalchemy:
|
if CONF.profiler.trace_sqlalchemy:
|
||||||
osprofiler.sqlalchemy.add_tracing(sqlalchemy,
|
osprofiler.sqlalchemy.add_tracing(sqlalchemy,
|
||||||
_facade.get_engine(),
|
_facade.get_engine(),
|
||||||
|
|
Loading…
Reference in New Issue