Support Guru in uwsgi way

Now Mogan can support the uwsgi, so should support Guru report
in uwsgi way.

Change-Id: I2724b67cf2817ed76d5f2dee2e9683b011ec9943
Implements: blueprint support-guru-in-uwsgi
This commit is contained in:
wanghao 2017-07-27 16:00:55 +08:00
parent b58a2d26fc
commit b710ffcad4
4 changed files with 12 additions and 0 deletions

View File

@ -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 Then, ``touch /tmp/guru_report`` will trigger the Guru Meditation report to be
printed to ``/var/log/mogan/mogan-api-err.log``. 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 Structure of a GMR
------------------ ------------------

View File

@ -15,12 +15,15 @@
import sys import sys
from oslo_config import cfg from oslo_config import cfg
from oslo_reports import guru_meditation_report as gmr
from oslo_reports import opts as gmr_opts
import pecan import pecan
from mogan.api import config from mogan.api import config
from mogan.api import hooks from mogan.api import hooks
from mogan.api import middleware from mogan.api import middleware
from mogan.api.middleware import auth_token from mogan.api.middleware import auth_token
from mogan import version
def get_pecan_config(): def get_pecan_config():
@ -34,6 +37,9 @@ def setup_app(pecan_config=None, extra_hooks=None):
pecan_config = get_pecan_config() pecan_config = get_pecan_config()
pecan.configuration.set_config(dict(pecan_config), overwrite=True) 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(), app_hooks = [hooks.ConfigHook(),
hooks.DBHook(), hooks.DBHook(),
hooks.EngineAPIHook(), hooks.EngineAPIHook(),

View File

@ -22,6 +22,7 @@ oslo.log>=3.22.0 # Apache-2.0
oslo.messaging!=5.25.0,>=5.24.2 # Apache-2.0 oslo.messaging!=5.25.0,>=5.24.2 # Apache-2.0
oslo.middleware>=3.27.0 # Apache-2.0 oslo.middleware>=3.27.0 # Apache-2.0
oslo.policy>=1.23.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.serialization!=2.19.1,>=1.10.0 # Apache-2.0
oslo.service>=1.10.0 # Apache-2.0 oslo.service>=1.10.0 # Apache-2.0
oslo.utils>=3.20.0 # Apache-2.0 oslo.utils>=3.20.0 # Apache-2.0

View File

@ -8,6 +8,7 @@ namespace = oslo.middleware.cors
namespace = oslo.concurrency namespace = oslo.concurrency
namespace = oslo.policy namespace = oslo.policy
namespace = oslo.log namespace = oslo.log
namespace = oslo.reports
namespace = oslo.service.service namespace = oslo.service.service
namespace = oslo.service.periodic_task namespace = oslo.service.periodic_task
namespace = oslo.service.sslutils namespace = oslo.service.sslutils