From c582d17170c7c336619b78a02d33579ad9614e82 Mon Sep 17 00:00:00 2001 From: Alexander Ignatyev Date: Fri, 15 Jul 2016 04:51:19 +0300 Subject: [PATCH] Support new osprofiler API Notifier initialization moved to osprofiler. Added call to init_from_conf method that does it. Fixed osprofiler admin context. Change-Id: Ic5c7bf72cafe077f6a77639fa439a61d39f89126 Depends-On: I77d0d3b5e9e725507916724dcd28d5fbc6f7f5c7 --- neutron/common/profiler.py | 17 ++++++++++------- neutron/db/api.py | 1 - 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/neutron/common/profiler.py b/neutron/common/profiler.py index 4e463921c6f..f029d4fcf5f 100644 --- a/neutron/common/profiler.py +++ b/neutron/common/profiler.py @@ -12,12 +12,13 @@ from oslo_config import cfg from oslo_log import log as logging -import oslo_messaging -import osprofiler.notifier +import osprofiler.initializer from osprofiler import opts as profiler_opts import osprofiler.web from neutron._i18n import _LI +from neutron import context + CONF = cfg.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. """ if CONF.profiler.enabled: - _notifier = osprofiler.notifier.create( - "Messaging", oslo_messaging, {}, - oslo_messaging.get_transport(CONF), "neutron", name, host) - osprofiler.notifier.set(_notifier) - osprofiler.web.enable(CONF.profiler.hmac_keys) + osprofiler.initializer.init_from_conf( + conf=CONF, + context=context.get_admin_context(), + project="neutron", + 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 " diff --git a/neutron/db/api.py b/neutron/db/api.py index 7612bf85091..feb2afc279e 100644 --- a/neutron/db/api.py +++ b/neutron/db/api.py @@ -33,7 +33,6 @@ from sqlalchemy.orm import exc import traceback from neutron._i18n import _LE -from neutron.common import profiler # noqa def set_hook(engine):