From 92b9c25d82e634269018153cfa7ff20efca1fbde Mon Sep 17 00:00:00 2001 From: Arnaud Morin Date: Wed, 7 Jun 2023 09:50:55 +0200 Subject: [PATCH] Add GMR to cinder wsgi When running cinder under WSGI, we might want to have Guru Meditation Reports as well as when running outside of WSGI. Note that, under WSGI, the GMR can only be trigger via a "touch" on a file, the "signal" way is not working because apache is registering the signal handlers instead of cinder, so it's disabled. Change-Id: I28839e2a97c96b8d71d28dbeb9baa049423fa1c4 Signed-off-by: Arnaud Morin --- cinder/wsgi/wsgi.py | 8 ++++++++ releasenotes/notes/gmr-ca97ba4602ce0831.yaml | 6 ++++++ requirements.txt | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/gmr-ca97ba4602ce0831.yaml diff --git a/cinder/wsgi/wsgi.py b/cinder/wsgi/wsgi.py index 1cc69a34fce..f8a2bac34f0 100644 --- a/cinder/wsgi/wsgi.py +++ b/cinder/wsgi/wsgi.py @@ -18,6 +18,8 @@ warnings.simplefilter('once', DeprecationWarning) from oslo_config import cfg from oslo_log import log as logging +from oslo_reports import guru_meditation_report as gmr +from oslo_reports import opts as gmr_opts from oslo_service import wsgi from cinder import objects # noqa @@ -36,11 +38,17 @@ CONF = cfg.CONF def initialize_application(): objects.register_all() + gmr_opts.set_defaults(CONF) CONF(sys.argv[1:], project='cinder', version=version.version_string()) logging.setup(CONF, "cinder") config.set_middleware_defaults() + # NOTE(amorin): Do not register signal handers because it does not work + # in wsgi applications + gmr.TextGuruMeditation.setup_autorun( + version, conf=CONF, setup_signal=False) + coordination.COORDINATOR.start() rpc.init(CONF) diff --git a/releasenotes/notes/gmr-ca97ba4602ce0831.yaml b/releasenotes/notes/gmr-ca97ba4602ce0831.yaml new file mode 100644 index 00000000000..6e093227ff8 --- /dev/null +++ b/releasenotes/notes/gmr-ca97ba4602ce0831.yaml @@ -0,0 +1,6 @@ +--- +other: + - | + Enabled Guru Meditation Reports on Cinder wsgi. + When running Cinder under WSGI, we might want to have Guru Meditation + Reports as well as when running outside of WSGI. diff --git a/requirements.txt b/requirements.txt index f0bd467b87c..7cf115e5966 100644 --- a/requirements.txt +++ b/requirements.txt @@ -22,7 +22,7 @@ oslo.messaging>=14.1.0 # Apache-2.0 oslo.middleware>=4.1.1 # Apache-2.0 oslo.policy>=3.8.1 # Apache-2.0 oslo.privsep>=2.6.2 # Apache-2.0 -oslo.reports>=2.2.0 # Apache-2.0 +oslo.reports>=3.2.0 # Apache-2.0 oslo.rootwrap>=6.2.0 # Apache-2.0 oslo.serialization>=4.2.0 # Apache-2.0 oslo.service>=2.8.0 # Apache-2.0