From 6ad0f5db2c12591399555b17ab2510b6b21eb658 Mon Sep 17 00:00:00 2001 From: Ching Kuo Date: Wed, 16 Jun 2021 10:15:01 +0800 Subject: [PATCH 1/5] Make Expose Port Configurable This commit added an integer configuration prometheus_port. This allow user to specify the port number to expose metrics information in prometheus format. Change-Id: I7ee36dc219be9c997647590e847844bfd74bc129 --- oslo_metrics/__main__.py | 6 ++++-- releasenotes/notes/port-config-ac5d9ee247a8ff9b.yaml | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/port-config-ac5d9ee247a8ff9b.yaml diff --git a/oslo_metrics/__main__.py b/oslo_metrics/__main__.py index d35a768..d443494 100644 --- a/oslo_metrics/__main__.py +++ b/oslo_metrics/__main__.py @@ -33,7 +33,9 @@ oslo_metrics_configs = [ cfg.StrOpt('metrics_socket_file', default='/var/tmp/metrics_collector.sock', help='Unix domain socket file to be used' - 'to send rpc related metrics'), + ' to send rpc related metrics'), + cfg.IntOpt('prometheus_port', default=3000, + help='Port number to expose metrics in prometheus format.'), ] cfg.CONF.register_opts(oslo_metrics_configs, group='oslo_metrics') @@ -107,7 +109,7 @@ def main(): app = make_wsgi_app() try: global httpd - httpd = make_server('', 3000, app) + httpd = make_server('', CONF.oslo_metrics.prometheus_port, app) signal.signal(signal.SIGTERM, handle_sigterm) httpd.serve_forever() except KeyboardInterrupt: diff --git a/releasenotes/notes/port-config-ac5d9ee247a8ff9b.yaml b/releasenotes/notes/port-config-ac5d9ee247a8ff9b.yaml new file mode 100644 index 0000000..346148d --- /dev/null +++ b/releasenotes/notes/port-config-ac5d9ee247a8ff9b.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + Port number to expose metrics in Prometheus format is now configurable. -- GitLab From b5328ae74360aafe116b0baf21419dc639e718e0 Mon Sep 17 00:00:00 2001 From: wangzihao Date: Wed, 11 Aug 2021 11:41:36 +0800 Subject: [PATCH 2/5] setup.cfg: Replace dashes with underscores Setuptools v54.1.0 introduces a warning that the use of dash-separated options in 'setup.cfg' will not be supported in a future version [1]. Get ahead of the issue by replacing the dashes with underscores. Without this, we see 'UserWarning' messages like the following on new enough versions of setuptools: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead [1] https://github.com/pypa/setuptools/commit/a2e9ae4cb Change-Id: I39365ad5511672d8fb5803ef09afe47fa867a5d2 --- setup.cfg | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/setup.cfg b/setup.cfg index f333e09..9a8db0d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,12 +1,12 @@ [metadata] name = oslo.metrics author = OpenStack -author-email = openstack-discuss@lists.openstack.org +author_email = openstack-discuss@lists.openstack.org summary = Oslo Metrics API -description-file = +description_file = README.rst -home-page = https://opendev.org/openstack/oslo.metrics -python-requires = >=3.6 +home_page = https://opendev.org/openstack/oslo.metrics +python_requires = >=3.6 classifier = Environment :: OpenStack Intended Audience :: Developers -- GitLab From cb39a351e1775b3e9a86284029c4bea30e522735 Mon Sep 17 00:00:00 2001 From: wangzihao Date: Wed, 11 Aug 2021 11:39:52 +0800 Subject: [PATCH 3/5] Changed minversion in tox to 3.18.0 The patch bumps min version of tox to 3.18.0 in order to replace tox's whitelist_externals by allowlist_externals option: https://github.com/tox-dev/tox/blob/master/docs/changelog.rst#v3180-2020-07-23 Change-Id: I382ca56a7f04aba92fbff060e28df6814712a153 --- tox.ini | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tox.ini b/tox.ini index cda6bea..53eed63 100644 --- a/tox.ini +++ b/tox.ini @@ -1,11 +1,11 @@ [tox] -minversion = 3.2.0 +minversion = 3.18.0 envlist = py3,pep8 ignore_basepython_conflict = True [testenv] basepython = python3 -whitelist_externals = +allowlist_externals = find deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} @@ -24,7 +24,7 @@ commands = commands = {posargs} [testenv:docs] -whitelist_externals = rm +allowlist_externals = rm deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -r{toxinidir}/doc/requirements.txt @@ -52,7 +52,7 @@ exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build import_exceptions = [testenv:releasenotes] -whitelist_externals = +allowlist_externals = rm deps = {[testenv:docs]deps} commands = -- GitLab From e9086be0dcc14f189c4f0aa203547d5deab0ba12 Mon Sep 17 00:00:00 2001 From: OpenStack Release Bot Date: Fri, 10 Sep 2021 14:35:16 +0000 Subject: [PATCH 4/5] Update master for stable/xena Add file to the reno documentation build to show release notes for stable/xena. Use pbr instruction to increment the minor version number automatically so that master versions are higher than the versions on stable/xena. Sem-Ver: feature Change-Id: I2140ba315f0cd83f89fe2b3d7529a5b016b3ce03 --- releasenotes/source/index.rst | 1 + releasenotes/source/xena.rst | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 releasenotes/source/xena.rst diff --git a/releasenotes/source/index.rst b/releasenotes/source/index.rst index 53e10e7..ff3337e 100644 --- a/releasenotes/source/index.rst +++ b/releasenotes/source/index.rst @@ -6,4 +6,5 @@ oslo.metrics Release Notes :maxdepth: 1 unreleased + xena wallaby diff --git a/releasenotes/source/xena.rst b/releasenotes/source/xena.rst new file mode 100644 index 0000000..1be85be --- /dev/null +++ b/releasenotes/source/xena.rst @@ -0,0 +1,6 @@ +========================= +Xena Series Release Notes +========================= + +.. release-notes:: + :branch: stable/xena -- GitLab From b23fb97c97d02615c0eef428ebd223b6baced952 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Thu, 7 Oct 2021 09:57:27 -0400 Subject: [PATCH 5/5] Limit metrics_socket_file permissions This limits the metrics_socket_file permissions to 0o660. Prior to this change, symbolic constants were used, resulting in 0o707 permissions. Closes-Bug: #1945533 Change-Id: I009ffbc10d3400881c6f8b2178494ba180d6549f --- oslo_metrics/__main__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/oslo_metrics/__main__.py b/oslo_metrics/__main__.py index d35a768..704e4fe 100644 --- a/oslo_metrics/__main__.py +++ b/oslo_metrics/__main__.py @@ -17,7 +17,6 @@ import os import select import signal import socket -import stat import sys import threading from wsgiref.simple_server import make_server @@ -97,7 +96,7 @@ def main(): socket_path = cfg.CONF.oslo_metrics.metrics_socket_file m = MetricsListener(socket_path) try: - os.chmod(socket_path, stat.S_IRWXU | stat.S_IRWXO) + os.chmod(socket_path, 0o660) except OSError: LOG.error("Changing the mode of the file failed.... continuing") mt = threading.Thread(target=m.serve) -- GitLab