Implement Guru meditation reports

Guru Meditation report can log runtime configuration of a given process,
along with thread status and greenthread status.
It greatly helps to check the process runtime status.

The usage is simple:
kill -SIGUSR2 {process-id}

With this we can show report of kuryr-kubernetes

Change-Id: I4cb2314bd25d3200781582b1e188139751666fd3
Implements: blueprint oslo-gmr
This commit is contained in:
Janonymous 2017-03-21 08:11:41 +00:00 committed by Jaivish Kothari(janonymous)
parent b0072c5816
commit bb46102a03
5 changed files with 49 additions and 20 deletions

View File

@ -1,17 +0,0 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import pbr.version
__version__ = pbr.version.VersionInfo(
'kuryr_kubernetes').version_string()

View File

@ -0,0 +1,28 @@
# Copyright 2017 NEC Corporation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import logging as sys_logging
from oslo_reports import guru_meditation_report as gmr
from kuryr_kubernetes import version
# During the call to gmr.TextGuruMeditation.setup_autorun(), Guru Meditation
# Report tries to start logging. Set a handler here to accommodate this.
logger = sys_logging.getLogger(None)
if not logger.handlers:
logger.addHandler(sys_logging.StreamHandler())
_version_string = version.version_info.release_string()
gmr.TextGuruMeditation.setup_autorun(version=_version_string)

View File

@ -16,7 +16,8 @@ from kuryr.lib._i18n import _
from kuryr.lib import config as lib_config
from oslo_config import cfg
from oslo_log import log as logging
import pbr.version
from kuryr_kubernetes import version
LOG = logging.getLogger(__name__)
@ -95,7 +96,7 @@ logging.register_options(CONF)
def init(args, **kwargs):
version_k8s = pbr.version.VersionInfo('kuryr-kubernetes').version_string()
version_k8s = version.version_info.version_string()
CONF(args=args, project='kuryr-k8s', version=version_k8s, **kwargs)
@ -103,7 +104,7 @@ def setup_logging():
logging.setup(CONF, 'kuryr-kubernetes')
logging.set_defaults(default_log_levels=logging.get_default_log_levels())
version_k8s = pbr.version.VersionInfo('kuryr-kubernetes').version_string()
version_k8s = version.version_info.version_string()
LOG.info("Logging enabled!")
LOG.info("%(prog)s version %(version)s",
{'prog': sys.argv[0], 'version': version_k8s})

View File

@ -0,0 +1,16 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import pbr.version
version_info = pbr.version.VersionInfo(
'kuryr_kubernetes')

View File

@ -8,6 +8,7 @@ requests!=2.12.2,!=2.13.0,>=2.10.0 # Apache-2.0
eventlet!=0.18.3,>=0.18.2 # MIT
oslo.config>=3.22.0 # Apache-2.0
oslo.log>=3.22.0 # Apache-2.0
oslo.reports>=0.6.0 # Apache-2.0
oslo.serialization>=1.10.0 # Apache-2.0
oslo.service>=1.10.0 # Apache-2.0
oslo.utils>=3.20.0 # Apache-2.0