diff --git a/doc/source/dev/gmr.rst b/doc/source/dev/gmr.rst index 1658591e..786a7510 100644 --- a/doc/source/dev/gmr.rst +++ b/doc/source/dev/gmr.rst @@ -55,6 +55,10 @@ For example, suppose that ``mogan-api`` was run with Then, ``touch /tmp/guru_report`` will trigger the Guru Meditation report to be printed to ``/var/log/mogan/mogan-api-err.log``. +For uwsgi mode, Guru is only working in second way, so user should use the +'touch' file to generate the Guru report. + + Structure of a GMR ------------------ diff --git a/mogan/api/app.py b/mogan/api/app.py index 9f8ae17b..ab4ed64e 100644 --- a/mogan/api/app.py +++ b/mogan/api/app.py @@ -15,12 +15,15 @@ import sys from oslo_config import cfg +from oslo_reports import guru_meditation_report as gmr +from oslo_reports import opts as gmr_opts import pecan from mogan.api import config from mogan.api import hooks from mogan.api import middleware from mogan.api.middleware import auth_token +from mogan import version def get_pecan_config(): @@ -34,6 +37,9 @@ def setup_app(pecan_config=None, extra_hooks=None): pecan_config = get_pecan_config() pecan.configuration.set_config(dict(pecan_config), overwrite=True) + gmr_opts.set_defaults(cfg.CONF) + gmr.TextGuruMeditation.setup_autorun(version, conf=cfg.CONF) + app_hooks = [hooks.ConfigHook(), hooks.DBHook(), hooks.EngineAPIHook(), diff --git a/requirements.txt b/requirements.txt index 450b301d..34158180 100644 --- a/requirements.txt +++ b/requirements.txt @@ -22,6 +22,7 @@ oslo.log>=3.22.0 # Apache-2.0 oslo.messaging!=5.25.0,>=5.24.2 # Apache-2.0 oslo.middleware>=3.27.0 # Apache-2.0 oslo.policy>=1.23.0 # Apache-2.0 +oslo.reports>=0.6.0 # Apache-2.0 oslo.serialization!=2.19.1,>=1.10.0 # Apache-2.0 oslo.service>=1.10.0 # Apache-2.0 oslo.utils>=3.20.0 # Apache-2.0 diff --git a/tools/config/mogan-config-generator.conf b/tools/config/mogan-config-generator.conf index 18cbc015..761cac59 100644 --- a/tools/config/mogan-config-generator.conf +++ b/tools/config/mogan-config-generator.conf @@ -8,6 +8,7 @@ namespace = oslo.middleware.cors namespace = oslo.concurrency namespace = oslo.policy namespace = oslo.log +namespace = oslo.reports namespace = oslo.service.service namespace = oslo.service.periodic_task namespace = oslo.service.sslutils