Merge "Support new osprofiler API"
This commit is contained in:
commit
42485c7b65
|
@ -12,12 +12,13 @@
|
||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
import oslo_messaging
|
import osprofiler.initializer
|
||||||
import osprofiler.notifier
|
|
||||||
from osprofiler import opts as profiler_opts
|
from osprofiler import opts as profiler_opts
|
||||||
import osprofiler.web
|
import osprofiler.web
|
||||||
|
|
||||||
from neutron._i18n import _LI
|
from neutron._i18n import _LI
|
||||||
|
from neutron import context
|
||||||
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
profiler_opts.set_defaults(CONF)
|
profiler_opts.set_defaults(CONF)
|
||||||
|
@ -33,11 +34,13 @@ def setup(name, host='0.0.0.0'): # nosec
|
||||||
specified host name / address usage is highly recommended.
|
specified host name / address usage is highly recommended.
|
||||||
"""
|
"""
|
||||||
if CONF.profiler.enabled:
|
if CONF.profiler.enabled:
|
||||||
_notifier = osprofiler.notifier.create(
|
osprofiler.initializer.init_from_conf(
|
||||||
"Messaging", oslo_messaging, {},
|
conf=CONF,
|
||||||
oslo_messaging.get_transport(CONF), "neutron", name, host)
|
context=context.get_admin_context(),
|
||||||
osprofiler.notifier.set(_notifier)
|
project="neutron",
|
||||||
osprofiler.web.enable(CONF.profiler.hmac_keys)
|
service=name,
|
||||||
|
host=host
|
||||||
|
)
|
||||||
LOG.info(_LI("OSProfiler is enabled.\n"
|
LOG.info(_LI("OSProfiler is enabled.\n"
|
||||||
"Traces provided from the profiler "
|
"Traces provided from the profiler "
|
||||||
"can only be subscribed to using the same HMAC keys that "
|
"can only be subscribed to using the same HMAC keys that "
|
||||||
|
|
|
@ -33,7 +33,6 @@ from sqlalchemy.orm import exc
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from neutron._i18n import _LE
|
from neutron._i18n import _LE
|
||||||
from neutron.common import profiler # noqa
|
|
||||||
|
|
||||||
|
|
||||||
def set_hook(engine):
|
def set_hook(engine):
|
||||||
|
|
Loading…
Reference in New Issue