Support file watcher to trigger GMR report

Allow generating GMR report upon file trigger in addition to a signal.

The feature has been available in oslo.reports since 1.11.0[1] but it
can't be used in octavia without proper initialization.

[1] d23e0a65b23dc77d0104075d2313de6ca22b5cae

Change-Id: Ifa08d1175a696263fea2c0e434f1e8e4d76395fe
Signed-off-by: Takashi Kajinami <kajinamit@oss.nttdata.com>
This commit is contained in:
Takashi Kajinami
2024-10-13 12:12:14 +09:00
parent 00599cb91c
commit 0236947f47
7 changed files with 25 additions and 9 deletions

View File

@@ -11,6 +11,7 @@ namespace = oslo.middleware.http_proxy_to_wsgi
namespace = oslo.middleware.healthcheck
namespace = oslo.middleware.sizelimit
namespace = oslo.policy
namespace = oslo.reports
namespace = keystonemiddleware.audit
namespace = keystonemiddleware.auth_token
namespace = cotyledon

View File

@@ -21,6 +21,7 @@ import sys
import gunicorn.app.base
from oslo_config import cfg
from oslo_reports import guru_meditation_report as gmr
from oslo_reports import opts as gmr_opts
from octavia.amphorae.backends.agent.api_server import server
from octavia.amphorae.backends.health_daemon import health_daemon
@@ -54,7 +55,8 @@ def main():
# comment out to improve logging
service.prepare_service(sys.argv)
gmr.TextGuruMeditation.setup_autorun(version)
gmr_opts.set_defaults(CONF)
gmr.TextGuruMeditation.setup_autorun(version, conf=CONF)
health_sender_proc = multiproc.Process(name='HM_sender',
target=health_daemon.run_sender,

View File

@@ -18,25 +18,30 @@ from wsgiref import simple_server
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 octavia.api import app as api_app
from octavia.common import constants
from octavia import version
CONF = cfg.CONF
LOG = logging.getLogger(__name__)
def main():
gmr.TextGuruMeditation.setup_autorun(version)
# TODO(tkajinam): We should consider adding this to wsgi app too so that
# GMR can be used even when api is run by uwsgi/mod_wsgi/etc.
gmr_opts.set_defaults(CONF)
gmr.TextGuruMeditation.setup_autorun(version, conf=CONF)
app = api_app.setup_app(argv=sys.argv)
host = cfg.CONF.api_settings.bind_host
port = cfg.CONF.api_settings.bind_port
host = CONF.api_settings.bind_host
port = CONF.api_settings.bind_port
LOG.info("Starting API server on %(host)s:%(port)s",
{"host": host, "port": port})
if cfg.CONF.api_settings.auth_strategy != constants.KEYSTONE:
if CONF.api_settings.auth_strategy != constants.KEYSTONE:
LOG.warning('Octavia configuration [api_settings] auth_strategy is '
'not set to "keystone". This is not a normal '
'configuration and you may get "Missing project ID" '

View File

@@ -22,6 +22,7 @@ import time
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
import setproctitle
from stevedore import enabled as stevedore_enabled
@@ -96,7 +97,8 @@ def main():
LOG.debug('Full set of CONF:')
CONF.log_opt_values(LOG, logging.DEBUG)
gmr.TextGuruMeditation.setup_autorun(version)
gmr_opts.set_defaults(CONF)
gmr.TextGuruMeditation.setup_autorun(version, conf=CONF)
processes = []
exit_event = multiprocessing.Event()

View File

@@ -24,6 +24,7 @@ from futurist import periodics
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 octavia.amphorae.drivers.health import heartbeat_udp
from octavia.common import service
@@ -90,7 +91,8 @@ def main():
LOG.debug('Full set of CONF:')
CONF.log_opt_values(LOG, logging.DEBUG)
gmr.TextGuruMeditation.setup_autorun(version)
gmr_opts.set_defaults(CONF)
gmr.TextGuruMeditation.setup_autorun(version, conf=CONF)
processes = []
exit_event = multiprocessing.Event()

View File

@@ -20,6 +20,7 @@ import threading
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_utils import timeutils
from octavia.common import service
@@ -81,7 +82,8 @@ def main():
LOG.debug('Full set of CONF:')
CONF.log_opt_values(LOG, logging.DEBUG)
gmr.TextGuruMeditation.setup_autorun(version)
gmr_opts.set_defaults(CONF)
gmr.TextGuruMeditation.setup_autorun(version, conf=CONF)
timestamp = str(timeutils.utcnow())
LOG.info("Starting house keeping at %s", timestamp)

View File

@@ -18,6 +18,7 @@ import cotyledon
from cotyledon import oslo_config_glue
from oslo_config import cfg
from oslo_reports import guru_meditation_report as gmr
from oslo_reports import opts as gmr_opts
from octavia.common import service as octavia_service
from octavia.controller.queue.v2 import consumer as consumer_v2
@@ -29,7 +30,8 @@ CONF = cfg.CONF
def main():
octavia_service.prepare_service(sys.argv)
gmr.TextGuruMeditation.setup_autorun(version)
gmr_opts.set_defaults(CONF)
gmr.TextGuruMeditation.setup_autorun(version, conf=CONF)
sm = cotyledon.ServiceManager()
sm.add(consumer_v2.ConsumerService,