oslo_reports.guru_meditation_report
Module¶Provides Guru Meditation Report
This module defines the actual OpenStack Guru Meditation Report class.
This can be used in the OpenStack command definition files. For example, in a nova command module (under nova/cmd):
from oslo_config import cfg
from oslo_log import log as oslo_logging
from oslo_reports import opts as gmr_opts
from oslo_reports import guru_meditation_report as gmr
CONF = cfg.CONF
# maybe import some options here...
def main():
oslo_logging.register_options(CONF)
gmr_opts.set_defaults(CONF)
CONF(sys.argv[1:], default_config_files=['myapp.conf'])
oslo_logging.setup(CONF, 'myapp')
gmr.TextGuruMeditation.register_section('Some Special Section',
special_section_generator)
gmr.TextGuruMeditation.setup_autorun(version_object, conf=CONF)
server = service.Service.create(binary='some-service',
topic=CONF.some_service_topic)
service.serve(server)
service.wait()
Then, you can do
$ kill -USR2 $SERVICE_PID
and get a Guru Meditation Report in the file or terminal where stderr is logged for that given service.
oslo_reports.guru_meditation_report.
GuruMeditation
(version_obj, sig_handler_tb=None, *args, **kwargs)¶Bases: object
A Guru Meditation Report Mixin/Base Class
This class is a base class for Guru Meditation Reports. It provides facilities for registering sections and setting up functionality to auto-run the report on a certain signal or use file modification events.
This class should always be used in conjunction with a Report class via multiple inheritance. It should always come first in the class list to ensure the MRO is correct.
handle_signal
(version, service_name, log_dir, frame)¶The Signal Handler
This method (indirectly) handles receiving a registered signal and dumping the Guru Meditation Report to stderr or a file in a given dir. If service name and log dir are not None, the report will be dumped to a file named $service_name_gurumeditation_$current_time in the log_dir directory. This method is designed to be curried into a proper signal handler by currying out the version parameter.
Parameters: |
|
---|
register_section
(section_title, generator)¶Register a New Section
This method registers a persistent section for the current class.
Parameters: |
|
---|
run
()¶setup_autorun
(version, service_name=None, log_dir=None, signum=None, conf=None)¶Set Up Auto-Run
This method sets up the Guru Meditation Report to automatically get dumped to stderr or a file in a given dir when the given signal is received. It can also use file modification events instead of signals.
Parameters: |
|
---|
timestamp_fmt
= '%Y%m%d%H%M%S'¶oslo_reports.guru_meditation_report.
TextGuruMeditation
(version_obj, traceback=None)¶Bases: oslo_reports.guru_meditation_report.GuruMeditation
, oslo_reports.report.TextReport
A Text Guru Meditation Report
This report is the basic human-readable Guru Meditation Report
It contains the following sections by default (in addition to any registered persistent sections):
Parameters: |
|
---|
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.