| 1 |
.. |
| 2 |
Copyright (c) 2014 OpenStack Foundation |
| 3 |
|
| 4 |
Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 5 |
not use this file except in compliance with the License. You may obtain |
| 6 |
a copy of the License at |
| 7 |
|
| 8 |
http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
|
| 10 |
Unless required by applicable law or agreed to in writing, software |
| 11 |
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 12 |
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 13 |
License for the specific language governing permissions and limitations |
| 14 |
under the License. |
| 15 |
|
| 16 |
Guru Meditation Reports |
| 17 |
======================= |
| 18 |
|
| 19 |
Ceilometer contains a mechanism whereby developers and system administrators |
| 20 |
can generate a report about the state of a running Ceilometer executable. This |
| 21 |
report is called a *Guru Meditation Report* (*GMR* for short). |
| 22 |
|
| 23 |
Generating a GMR |
| 24 |
---------------- |
| 25 |
|
| 26 |
A *GMR* can be generated by sending the *USR1* signal to any Ceilometer process |
| 27 |
with support (see below). The *GMR* will then be outputted standard error for |
| 28 |
that particular process. |
| 29 |
|
| 30 |
For example, suppose that ``ceilometer-polling`` has process id ``8675``, and |
| 31 |
was run with ``2>/var/log/ceilometer/ceilometer-polling.log``. Then, |
| 32 |
``kill -USR1 8675`` will trigger the Guru Meditation report to be printed to |
| 33 |
``/var/log/ceilometer/ceilometer-polling.log``. |
| 34 |
|
| 35 |
Structure of a GMR |
| 36 |
------------------ |
| 37 |
|
| 38 |
The *GMR* is designed to be extensible; any particular executable may add its |
| 39 |
own sections. However, the base *GMR* consists of several sections: |
| 40 |
|
| 41 |
Package |
| 42 |
Shows information about the package to which this process belongs, including |
| 43 |
version information |
| 44 |
|
| 45 |
Threads |
| 46 |
Shows stack traces and thread ids for each of the threads within this process |
| 47 |
|
| 48 |
Green Threads |
| 49 |
Shows stack traces for each of the green threads within this process (green |
| 50 |
threads don't have thread ids) |
| 51 |
|
| 52 |
Configuration |
| 53 |
Lists all the configuration options currently accessible via the CONF object |
| 54 |
for the current process |
| 55 |
|
| 56 |
Adding Support for GMRs to New Executables |
| 57 |
------------------------------------------ |
| 58 |
|
| 59 |
Adding support for a *GMR* to a given executable is fairly easy. |
| 60 |
|
| 61 |
First import the module, as well as the Ceilometer version module: |
| 62 |
|
| 63 |
.. code-block:: python |
| 64 |
|
| 65 |
from oslo_reports import guru_meditation_report as gmr |
| 66 |
from ceilometer import version |
| 67 |
|
| 68 |
Then, register any additional sections (optional): |
| 69 |
|
| 70 |
.. code-block:: python |
| 71 |
|
| 72 |
TextGuruMeditation.register_section('Some Special Section', |
| 73 |
some_section_generator) |
| 74 |
|
| 75 |
Finally (under main), before running the "main loop" of the executable (usually |
| 76 |
``service.server(server)`` or something similar), register the *GMR* hook: |
| 77 |
|
| 78 |
.. code-block:: python |
| 79 |
|
| 80 |
TextGuruMeditation.setup_autorun(version) |
| 81 |
|
| 82 |
Extending the GMR |
| 83 |
----------------- |
| 84 |
|
| 85 |
As mentioned above, additional sections can be added to the GMR for a |
| 86 |
particular executable. For more information, see the inline documentation |
| 87 |
about oslo.reports: |
| 88 |
`oslo.reports <https://docs.openstack.org/oslo.reports/latest/>`_ |