././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1708678712.4181643 ceilometermiddleware-3.3.1/0000775000175000017500000000000000000000000015727 5ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/.coveragerc0000664000175000017500000000016500000000000020052 0ustar00zuulzuul00000000000000[run] branch = True source = ceilometermiddleware omit = ceilometermiddleware/tests/* [report] ignore_errors = True ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/.stestr.conf0000664000175000017500000000007500000000000020202 0ustar00zuulzuul00000000000000[DEFAULT] test_path=./ceilometermiddleware/tests top_dir=./ ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/.zuul.yaml0000664000175000017500000000076200000000000017675 0ustar00zuulzuul00000000000000- job: name: ceilometermiddleware-integration parent: telemetry-dsvm-integration required-projects: - openstack/ceilometermiddleware vars: devstack_localrc: GLOBAL_VENV: False - project: templates: - openstack-python3-jobs - publish-openstack-docs-pti - release-notes-jobs-python3 - check-requirements check: jobs: - ceilometermiddleware-integration gate: jobs: - ceilometermiddleware-integration ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678712.0 ceilometermiddleware-3.3.1/AUTHORS0000664000175000017500000000326300000000000017003 0ustar00zuulzuul00000000000000Andreas Jaeger Andrew Smith Cao Xuan Hoang Chris Dent Clément Contini Corey Bryant Darren Hague Doug Hellmann Erno Kuvaja Flavio Percoco Ghanshyam Mann Hanxi Liu Julien Danjou Le Hou Mehdi Abaakouk Monty Taylor Nadya Privalova OpenStack Release Bot Rohit Jaiswal Romain LE DISEZ Romain Soufflet Romain de Joux Sean McGinnis Steve Lewis Swapnil Kulkarni (coolsvap) Takashi Kajinami Takashi Kajinami Thomas Bechtold Tom Cocozzello Tony Breeds Vu Cong Tuan Yandong Xuan Yuanbin.Chen ZhiQiang Fan aditi gengchc2 gord chung gordon chung niuke prankul mahajan sonu.kumar venkatamahesh xiaozhuangqing xuanyandong zhangboye zhurong ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/CONTRIBUTING.rst0000664000175000017500000000104700000000000020372 0ustar00zuulzuul00000000000000If you would like to contribute to the development of OpenStack, you must follow the steps in this page: http://docs.openstack.org/infra/manual/developers.html Once those steps have been completed, changes to OpenStack should be submitted for review via the Gerrit tool, following the workflow documented at: http://docs.openstack.org/infra/manual/developers.html#development-workflow Pull requests submitted through GitHub will be ignored. Bugs should be filed on Launchpad, not GitHub: https://bugs.launchpad.net/ceilometermiddleware ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678712.0 ceilometermiddleware-3.3.1/ChangeLog0000664000175000017500000001301400000000000017500 0ustar00zuulzuul00000000000000CHANGES ======= 3.3.1 ----- * Fix releasenotes build of yoga moved to unmaintained * Bump hacking 3.3.0 ----- * Update python classifier in setup.cfg * Remove unused six library * Ignore .eggs directory * Disable global venv on the integration job * Update master for stable/2023.1 * Update master for stable/2023.2 3.2.0 ----- * Add 'check\_requirements' to CI 3.1.0 ----- * Switch to 2023.1 Python3 unit tests and generic template name * Update master for stable/zed 3.0.0 ----- * remove unicode from code * Update python testing as per zed cycle testing runtime * Add Python 3.9 support to classifiers * Update master for stable/yoga 2.4.1 ----- * Add Python3 yoga unit tests 2.4.0 ----- * Update master for stable/xena * setup.cfg: Replace dashes with underscores * Add Python3 xena unit tests 2.3.0 ----- * Update master for stable/wallaby * Replace the following items with Python 3 style code 2.2.0 ----- * Add Python3 wallaby unit tests * Update master for stable/victoria 2.1.0 ----- * Switch to newer openstackdocstheme and reno versions * Further Cleanup py27 support * Bump default tox env from py37 to py38 * Add py38 package metadata * Use unittest.mock instead of third party mock * Add Python3 victoria unit tests * Update master for stable/ussuri * Use swift.backend\_path from Swift/s3api to extract account/container * Cleanup py27 support 2.0.0 ----- * Replace lib-forward-testing-plugin * Drop python 2.7 support and testing * Switch to Ussuri jobs * Drop oslosphinx and use openstackdocstheme * Update master for stable/train 1.5.0 ----- * Fix a socket leak in case of broken connection * Fix py37 test error * Add Python 3 Train unit tests * Use opendev repository * OpenDev Migration Patch * Dropping the py35 testing * Update master for stable/stein * Change openstack-dev to openstack-discuss 1.4.0 ----- * add python 3.6 unit test job * switch documentation job to new PTI * import zuul job settings from project-config * Switch to stestr 1.3.0 ----- * fix tox python3 overrides * Update reno for stable/queens 1.2.0 ----- * Fix documentation url 404 error * Remove setting of version/release from releasenotes * Update reno for stable/pike * Fix default service project to "service" * retrieve project id to ignore from keystone 1.1.0 ----- * Switch to get\_notification\_transport for Notifier 1.0.1 ----- * Trivial: remove support for py34 * switch to topics when declaring notifier * Update reno for stable/ocata * Fix releasenotes branches * Use https instead of http for git.openstack.org * Remove link to modindex * [doc] Note lack of constraints is a choice * Revert "Show team and repo badges on README" * Show team and repo badges on README * Bump hacking to 0.12 1.0.0 ----- * Convert nonblocking\_notify value from string to boolean * No reason to start with '\_' define a general variable * Enable release notes translation * Clean imports in code * Bump the oslo.messaging version * clean up oslo-incubator related stuff * Add release note for background thread notifier * Delete openstack/common from the exclude list of flake8 in tox * Add reno for release notes management * Avoid useless dependency on oslo\_utils * Update the home-page with developer documentation * Fix bug in background sending * Add support for Python 3.5 * Remove py33 from tox envlist 0.5.0 ----- * Add background thread notifier sending ability * Upgrade hacking * Updated from global requirements * Only install hacking in pep8 * Remove oslo.context dependency * Remove unused requirements * Add missing requirements for mock * Updated from global requirements * [Trivial] Remove executable privilege of doc/source/conf.py * Updated from global requirements * Updated from global requirements * use path as resource id when missing RESELLER prefix 0.4.0 ----- * Updated from global requirements * Updated from global requirements * Updated from global requirements * Updated from global requirements * Updated from global requirements * Updated from global requirements * Use assertTrue/False instead of assertEqual(T/F) * Updated from global requirements * Removes MANIFEST.in as it is not needed explicitely by PBR * Remove py26 support from ceilometermiddleware * Updated from global requirements * Updated from global requirements * Updated from global requirements * Updated from global requirements * swift: upgrade messaging to v2 * Updated from global requirements * Updated from global requirements * Fix the mistakes in .gitignore file * Change ignore-errors to ignore\_errors 0.3.0 ----- * Ignore request with swift.source in env * Updated from global requirements * Fixes parsing req path for account HEAD/GET * HTTP\_X\_TENANT\_ID is deprecated and replaced by HTTP\_X\_PROJECT\_ID * Updated from global requirements * Activate pep8 check that \_ is imported * Updated from global requirements * Drop use of 'oslo' namespace package * Updated from global requirements * Add test which asserts non-empty target\_id * Updated from global requirements * add support to skip event/meter generation for certain projects * Set correct config choice for transport url 0.2.0 ----- * Updated from global requirements * Drop use of 'oslo' namespace package * Update README to work with release tools * Updated from global requirements * Add \*paste.filter\_factory\* entry point * use pycadf helper module to assign action * Updated from global requirements * remove gitignore files 0.1.0 ----- * add README template * add options to configure messaging * ignore changelog * fix py34 tests * fix gitignore * fix gitignore * initial checkin * initial checkin * Initial commit ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/HACKING.rst0000664000175000017500000000025400000000000017526 0ustar00zuulzuul00000000000000ceilometermiddleware Style Commandments =============================================== Read the OpenStack Style Commandments http://docs.openstack.org/developer/hacking/ ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/LICENSE0000664000175000017500000002363700000000000016747 0ustar00zuulzuul00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1708678712.4181643 ceilometermiddleware-3.3.1/PKG-INFO0000664000175000017500000000344700000000000017034 0ustar00zuulzuul00000000000000Metadata-Version: 1.2 Name: ceilometermiddleware Version: 3.3.1 Summary: OpenStack Telemetry middleware for generating metrics Home-page: https://docs.openstack.org/ceilometermiddleware/latest/ Author: OpenStack Author-email: openstack-discuss@lists.openstack.org License: UNKNOWN Description: =============================================== Middleware for OpenStack Telemetry (Ceilometer) =============================================== This library provides middleware modules designed to enable metric and event data generation to be consumed by Ceilometer. For information on contributing, see ``CONTRIBUTING.rst``. * License: Apache License, Version 2.0 * Documentation: https://docs.openstack.org/ceilometermiddleware/latest/ * Source: http://opendev.org/openstack/ceilometermiddleware * Bugs: http://bugs.launchpad.net/ceilometermiddleware For any other information, refer to the parent project, Ceilometer: https://opendev.org/openstack/ceilometer Platform: UNKNOWN Classifier: Environment :: OpenStack Classifier: Intended Audience :: Information Technology Classifier: Intended Audience :: System Administrators Classifier: License :: OSI Approved :: Apache Software License Classifier: Operating System :: POSIX :: Linux Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: 3 :: Only Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Requires-Python: >=3.8 ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/README.rst0000664000175000017500000000123700000000000017421 0ustar00zuulzuul00000000000000=============================================== Middleware for OpenStack Telemetry (Ceilometer) =============================================== This library provides middleware modules designed to enable metric and event data generation to be consumed by Ceilometer. For information on contributing, see ``CONTRIBUTING.rst``. * License: Apache License, Version 2.0 * Documentation: https://docs.openstack.org/ceilometermiddleware/latest/ * Source: http://opendev.org/openstack/ceilometermiddleware * Bugs: http://bugs.launchpad.net/ceilometermiddleware For any other information, refer to the parent project, Ceilometer: https://opendev.org/openstack/ceilometer ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1708678712.4101644 ceilometermiddleware-3.3.1/ceilometermiddleware/0000775000175000017500000000000000000000000022115 5ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/ceilometermiddleware/__init__.py0000664000175000017500000000124400000000000024227 0ustar00zuulzuul00000000000000# -*- coding: utf-8 -*- # 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( 'ceilometermiddleware').version_string() ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/ceilometermiddleware/swift.py0000664000175000017500000003532200000000000023630 0ustar00zuulzuul00000000000000# # Copyright 2012 eNovance # # 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. """ Telemetry Middleware for Swift Proxy Configuration: In /etc/swift/proxy-server.conf on the main pipeline add "ceilometer" just before "proxy-server" and add the following filter in the file: .. code-block:: python [filter:ceilometer] paste.filter_factory = ceilometermiddleware.swift:filter_factory # Some optional configuration this allow to publish additional metadata metadata_headers = X-TEST # Set reseller prefix (defaults to "AUTH_" if not set) reseller_prefix = AUTH_ # Set control_exchange to publish to. control_exchange = swift # Set transport url url = rabbit://me:passwd@host:5672/virtual_host # set messaging driver driver = messagingv2 # set topic topic = notifications # skip metering of requests from listed project ids ignore_projects = , , # Whether to send events to messaging driver in a background thread nonblocking_notify = False # Queue size for sending notifications in background thread (0=unlimited). # New notifications will be discarded if the queue is full. send_queue_size = 1000 # Logging level control log_level = WARNING # All keystoneauth1 options can be set to query project name for # ignore_projects option, here is just a example: auth_type = password auth_url = https://[::1]:5000 project_name = service project_domain_name = Default username = user user_domain_name = Default password = a_big_secret interface = public """ import datetime import functools import logging from keystoneauth1 import exceptions as ksa_exc from keystoneauth1.loading import adapter as ksa_adapter from keystoneauth1.loading import base as ksa_base from keystoneauth1.loading import session as ksa_session from keystoneclient.v3 import client as ks_client from oslo_config import cfg import oslo_messaging from oslo_utils import strutils from pycadf import event as cadf_event from pycadf.helper import api from pycadf import measurement as cadf_measurement from pycadf import metric as cadf_metric from pycadf import resource as cadf_resource import queue import threading import urllib.parse as urlparse LOG = logging.getLogger(__name__) def list_from_csv(comma_separated_str): if comma_separated_str: return list( filter(lambda x: x, map(lambda x: x.strip(), comma_separated_str.split(',')))) return [] def _log_and_ignore_error(fn): @functools.wraps(fn) def wrapper(*args, **kwargs): try: return fn(*args, **kwargs) except Exception as e: LOG.exception('An exception occurred processing ' 'the API call: %s ', e) return wrapper class InputProxy(object): """File-like object that counts bytes read. To be swapped in for wsgi.input for accounting purposes. Borrowed from swift.common.utils. Duplicated here to avoid dependency on swift package. """ def __init__(self, wsgi_input): self.wsgi_input = wsgi_input self.bytes_received = 0 def read(self, *args, **kwargs): """Pass read request to the underlying file-like object Add bytes read to total. """ chunk = self.wsgi_input.read(*args, **kwargs) self.bytes_received += len(chunk) return chunk def readline(self, *args, **kwargs): """Pass readline request to the underlying file-like object Add bytes read to total. """ line = self.wsgi_input.readline(*args, **kwargs) self.bytes_received += len(line) return line def close(self): close_method = getattr(self.wsgi_input, 'close', None) if callable(close_method): close_method() class KeystoneClientLoader(ksa_adapter.Adapter): """Keystone client adapter loader. Keystone client and Keystoneauth1 adapter take exactly the same options, so it's safe to create a keystone client with keystoneauth adapter options. """ @property def plugin_class(self): return ks_client.Client class Swift(object): """Swift middleware used for counting requests.""" event_queue = None threadLock = threading.Lock() DEFAULT_IGNORE_PROJECT_NAMES = ['service'] def __init__(self, app, conf): self._app = app self.ignore_projects = self._get_ignore_projects(conf) oslo_messaging.set_transport_defaults(conf.get('control_exchange', 'swift')) self._notifier = oslo_messaging.Notifier( oslo_messaging.get_notification_transport(cfg.CONF, url=conf.get('url')), publisher_id='ceilometermiddleware', driver=conf.get('driver', 'messagingv2'), topics=[conf.get('topic', 'notifications')]) self.metadata_headers = [h.strip().replace('-', '_').lower() for h in conf.get( "metadata_headers", "").split(",") if h.strip()] self.reseller_prefix = conf.get('reseller_prefix', 'AUTH_') if self.reseller_prefix and self.reseller_prefix[-1] != '_': self.reseller_prefix += '_' LOG.setLevel(getattr(logging, conf.get('log_level', 'WARNING'))) # NOTE: If the background thread's send queue fills up, the event will # be discarded # # For backward compatibility we default to False and therefore wait for # sending to complete. This causes swift proxy to hang if the # destination is unavailable. self.nonblocking_notify = strutils.bool_from_string( conf.get('nonblocking_notify', False)) # Initialize the sending queue and thread, but only once if self.nonblocking_notify and Swift.event_queue is None: Swift.threadLock.acquire() if Swift.event_queue is None: send_queue_size = int(conf.get('send_queue_size', 1000)) Swift.event_queue = queue.Queue(send_queue_size) self.start_sender_thread() Swift.threadLock.release() def _get_ignore_projects(self, conf): if 'auth_type' not in conf: LOG.info("'auth_type' is not set assuming ignore_projects are " "only project uuid.") return list_from_csv(conf.get('ignore_projects')) if 'ignore_projects' in conf: ignore_projects = list_from_csv(conf.get('ignore_projects')) else: ignore_projects = self.DEFAULT_IGNORE_PROJECT_NAMES if not ignore_projects: return [] def opt_getter(opt): # TODO(sileht): This method does not support deprecated opt names val = conf.get(opt.name) if val is None: val = conf.get(opt.dest) return val auth_type = conf.get('auth_type') plugin = ksa_base.get_plugin_loader(auth_type) auth = plugin.load_from_options_getter(opt_getter) session = ksa_session.Session().load_from_options_getter( opt_getter, auth=auth) client = KeystoneClientLoader().load_from_options_getter( opt_getter, session=session) projects = [] for name_or_id in ignore_projects: projects.extend(self._get_keystone_projects(client, name_or_id)) return projects @staticmethod def _get_keystone_projects(client, name_or_id): try: return [client.projects.get(name_or_id)] except ksa_exc.NotFound: pass if isinstance(name_or_id, bytes): name_or_id = name_or_id.decode('utf-8', 'strict') projects = client.projects.list(name=name_or_id) if not projects: LOG.warning("fail to find project '%s' in keystone", name_or_id) return [p.id for p in projects] def __call__(self, env, start_response): start_response_args = [None] input_proxy = InputProxy(env['wsgi.input']) env['wsgi.input'] = input_proxy def my_start_response(status, headers, exc_info=None): start_response_args[0] = (status, list(headers), exc_info) def iter_response(iterable): iterator = iter(iterable) try: chunk = next(iterator) while not chunk: chunk = next(iterator) except StopIteration: chunk = '' if start_response_args[0]: start_response(*start_response_args[0]) bytes_sent = 0 try: while chunk: bytes_sent += len(chunk) yield chunk try: chunk = next(iterator) except StopIteration: chunk = '' finally: close_method = getattr(iterable, 'close', None) if callable(close_method): close_method() self.emit_event(env, input_proxy.bytes_received, bytes_sent) try: iterable = self._app(env, my_start_response) except Exception: self.emit_event(env, input_proxy.bytes_received, 0, 'failure') raise else: return iter_response(iterable) @_log_and_ignore_error def emit_event(self, env, bytes_received, bytes_sent, outcome='success'): if ( (env.get('HTTP_X_SERVICE_PROJECT_ID') or env.get('HTTP_X_PROJECT_ID') or env.get('HTTP_X_TENANT_ID')) in self.ignore_projects or env.get('swift.source') is not None): return path = urlparse.quote(env.get('swift.backend_path', env['PATH_INFO'])) method = env['REQUEST_METHOD'] headers = {} for header in env: if header.startswith('HTTP_') and env[header]: key = header[5:] if isinstance(env[header], str): headers[key] = str(env[header]) else: headers[key] = str(env[header]) try: container = obj = None path = path.replace('/', '', 1) version, account, remainder = path.split('/', 2) except ValueError: try: version, account = path.split('/', 1) remainder = None except ValueError: return try: if not version or not account: raise ValueError('Invalid path: %s' % path) if remainder: if '/' in remainder: container, obj = remainder.split('/', 1) else: container = remainder except ValueError: return now = datetime.datetime.utcnow().isoformat() resource_metadata = { "path": path, "version": version, "container": container, "object": obj, } for header in self.metadata_headers: if header.upper() in headers: resource_metadata['http_header_%s' % header] = headers.get( header.upper()) # build object store details target = cadf_resource.Resource( typeURI='service/storage/object', id=account.partition(self.reseller_prefix)[2] or path) target.metadata = resource_metadata target.action = method.lower() # build user details initiator = cadf_resource.Resource( typeURI='service/security/account/user', id=env.get('HTTP_X_USER_ID')) initiator.project_id = (env.get('HTTP_X_PROJECT_ID') or env.get('HTTP_X_TENANT_ID')) # build notification body event = cadf_event.Event(eventTime=now, outcome=outcome, action=api.convert_req_action(method), initiator=initiator, target=target, observer=cadf_resource.Resource(id='target')) # measurements if bytes_received: event.add_measurement(cadf_measurement.Measurement( result=bytes_received, metric=cadf_metric.Metric( name='storage.objects.incoming.bytes', unit='B'))) if bytes_sent: event.add_measurement(cadf_measurement.Measurement( result=bytes_sent, metric=cadf_metric.Metric( name='storage.objects.outgoing.bytes', unit='B'))) if self.nonblocking_notify: try: Swift.event_queue.put(event, False) if not Swift.event_sender.is_alive(): Swift.threadLock.acquire() self.start_sender_thread() Swift.threadLock.release() except queue.Full: LOG.warning('Send queue FULL: Event %s not added', event.id) else: Swift.send_notification(self._notifier, event) def start_sender_thread(self): Swift.event_sender = SendEventThread(self._notifier) Swift.event_sender.daemon = True Swift.event_sender.start() @staticmethod def send_notification(notifier, event): notifier.info({}, 'objectstore.http.request', event.as_dict()) class SendEventThread(threading.Thread): def __init__(self, notifier): super(SendEventThread, self).__init__() self.notifier = notifier def run(self): """Send events without blocking swift proxy.""" while True: try: LOG.debug('Wait for event from send queue') event = Swift.event_queue.get() LOG.debug('Got event %s from queue - now send it', event.id) Swift.send_notification(self.notifier, event) LOG.debug('Event %s sent.', event.id) except BaseException: LOG.exception("SendEventThread loop exception") def filter_factory(global_conf, **local_conf): conf = global_conf.copy() conf.update(local_conf) def filter(app): return Swift(app, conf) return filter ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1708678712.4141643 ceilometermiddleware-3.3.1/ceilometermiddleware/tests/0000775000175000017500000000000000000000000023257 5ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/ceilometermiddleware/tests/__init__.py0000664000175000017500000000000000000000000025356 0ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/ceilometermiddleware/tests/base.py0000664000175000017500000000143200000000000024543 0ustar00zuulzuul00000000000000# -*- coding: utf-8 -*- # Copyright 2010-2011 OpenStack Foundation # Copyright (c) 2013 Hewlett-Packard Development Company, L.P. # # 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. from oslotest import base class TestCase(base.BaseTestCase): """Test case base class for all unit tests.""" ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1708678712.4141643 ceilometermiddleware-3.3.1/ceilometermiddleware/tests/data/0000775000175000017500000000000000000000000024170 5ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/ceilometermiddleware/tests/data/list_projects.yaml0000664000175000017500000003450500000000000027747 0ustar00zuulzuul00000000000000http_interactions: - recorded_at: '2017-05-15T07:49:52' request: body: encoding: utf-8 string: |- { "auth": { "tenantName": "dummy", "passwordCredentials": { "username": "dummy", "password": "********" } } } headers: Accept: - application/json Accept-Encoding: - gzip, deflate Connection: - keep-alive Content-Length: - '107' Content-Type: - application/json User-Agent: - run.py keystoneauth1/2.20.0 python-requests/2.14.2 CPython/2.7.13 method: POST uri: https://[::1]:5000/v2.0/tokens response: body: encoding: null string: |- { "access": { "serviceCatalog": [ { "type": "compute", "endpoints_links": [], "name": "nova", "endpoints": [ { "internalURL": "https://[::1]:8774/v2.1", "adminURL": "https://[::1]:8774/v2.1", "id": "1e879ab434b54b8abfd275feeb2ef9f3", "region": "RegionOne", "publicURL": "https://[::1]:8774/v2.1" } ] }, { "type": "network", "endpoints_links": [], "name": "neutron", "endpoints": [ { "internalURL": "http://[::1]:9696", "adminURL": "http://[::1]:9696", "id": "83fcb786f646437f9a61cef72a9e43d7", "region": "RegionOne", "publicURL": "http://[::1]:9696" } ] }, { "type": "volumev2", "endpoints_links": [], "name": "cinderv2", "endpoints": [ { "internalURL": "https://[::1]:8776/v2/ed980105f9d047e2bee738b3f261f126", "adminURL": "https://[::1]:8776/v2/ed980105f9d047e2bee738b3f261f126", "id": "973ef665c2ea4ec3b5c3d48932fad7a4", "region": "RegionOne", "publicURL": "https://[::1]:8776/v2/ed980105f9d047e2bee738b3f261f126" } ] }, { "type": "volumev3", "endpoints_links": [], "name": "cinderv3", "endpoints": [ { "internalURL": "https://[::1]:8776/v3/ed980105f9d047e2bee738b3f261f126", "adminURL": "https://[::1]:8776/v3/ed980105f9d047e2bee738b3f261f126", "id": "0e80fe643d4d44729db99d0a5c882d1b", "region": "RegionOne", "publicURL": "https://[::1]:8776/v3/ed980105f9d047e2bee738b3f261f126" } ] }, { "type": "image", "endpoints_links": [], "name": "glance", "endpoints": [ { "internalURL": "http://[::1]:9292", "adminURL": "http://[::1]:9292", "id": "7aad24b660a94254adc3546e4de4d668", "region": "RegionOne", "publicURL": "http://[::1]:9292" } ] }, { "type": "volume", "endpoints_links": [], "name": "cinder", "endpoints": [ { "internalURL": "https://[::1]:8776/v1/ed980105f9d047e2bee738b3f261f126", "adminURL": "https://[::1]:8776/v1/ed980105f9d047e2bee738b3f261f126", "id": "8191ee00b695483796a9531bca70279b", "region": "RegionOne", "publicURL": "https://[::1]:8776/v1/ed980105f9d047e2bee738b3f261f126" } ] }, { "type": "identity", "endpoints_links": [], "name": "keystone", "endpoints": [ { "internalURL": "https://[::1]:5000", "adminURL": "https://[::1]:35357", "id": "24ab268f1a7b47d4af493c4c74cd6130", "region": "RegionOne", "publicURL": "https://[::1]:5000" } ] } ], "user": { "username": "dummy", "roles_links": [], "id": "f18b121edda04346b86610fa23983a0e", "roles": [ { "name": "admin" } ], "name": "dummy" }, "token": { "issued_at": "2017-05-15T07:49:52.000000Z", "tenant": { "enabled": true, "id": "ed980105f9d047e2bee738b3f261f126", "name": "dummy", "description": "admin tenant" }, "audit_ids": [ "VzK7yoNFT0qlUWg5KhDuMQ" ], "expires": "9999-12-31T23:59:59Z", "id": "gAAAAABZGV2gZwV0SlycA_OIohX7kRAmTp84SnzsAYD5Uhey7RTzCf0NvxNRxLk5RsjRSMncSdro7eWgtMrSblZJCPl485IvHANL3E3gsxFJP9TjebqDiF4DtGhQmc4mHPB3kOBNzg3v2FrHB2hK77Cc4M7V1Pm_-nWBHxYxVNopVhrd80Y4-2c" }, "metadata": { "is_admin": 0, "roles": [ "d3b61a4656d64cbbbdb0f13690e2ffe4" ] } } } headers: Connection: - Keep-Alive Content-Length: - '3183' Content-Type: - application/json Date: - Mon, 15 May 2017 07:49:51 GMT Keep-Alive: - timeout=3, max=100 Server: - Apache/2.4.18 (Ubuntu) Strict-Transport-Security: - max-age=15768000 Vary: - X-Auth-Token X-Distribution: - Ubuntu x-openstack-request-id: - req-84cb5714-49dc-4bab-93ba-2b66ba566c30 status: code: 200 message: OK url: https://[::1]:5000/v2.0/tokens - recorded_at: '2017-05-15T07:49:53' request: body: encoding: utf-8 string: '' headers: Accept: - application/json Accept-Encoding: - gzip, deflate Connection: - keep-alive User-Agent: - run.py keystoneauth1/2.20.0 python-requests/2.14.2 CPython/2.7.13 method: GET uri: https://[::1]:35357/ response: body: encoding: null string: |- { "versions": { "values": [ { "status": "stable", "updated": "2016-10-06T00:00:00Z", "id": "v3.7", "links": [ { "rel": "self", "href": "https://[::1]:35357/v3/" } ], "media-types": [ { "type": "application/vnd.openstack.identity-v3+json", "base": "application/json" } ] }, { "status": "deprecated", "updated": "2016-08-04T00:00:00Z", "id": "v2.0", "links": [ { "rel": "self", "href": "https://[::1]:35357/v2.0/" }, { "type": "text/html", "rel": "describedby", "href": "http://docs.openstack.org/" } ], "media-types": [ { "type": "application/vnd.openstack.identity-v2.0+json", "base": "application/json" } ] } ] } } headers: Connection: - Keep-Alive Content-Length: - '627' Content-Type: - application/json Date: - Mon, 15 May 2017 07:49:52 GMT Keep-Alive: - timeout=3, max=100 Server: - Apache/2.4.18 (Ubuntu) Strict-Transport-Security: - max-age=15768000 Vary: - X-Auth-Token X-Distribution: - Ubuntu status: code: 300 message: Multiple Choices url: https://[::1]:35357/ - recorded_at: '2017-05-15T07:49:53' request: body: encoding: utf-8 string: '' headers: Accept: - application/json Accept-Encoding: - gzip, deflate Connection: - keep-alive User-Agent: - python-keystoneclient X-Auth-Token: - gAAAAABZGV2gZwV0SlycA_OIohX7kRAmTp84SnzsAYD5Uhey7RTzCf0NvxNRxLk5RsjRSMncSdro7eWgtMrSblZJCPl485IvHANL3E3gsxFJP9TjebqDiF4DtGhQmc4mHPB3kOBNzg3v2FrHB2hK77Cc4M7V1Pm_-nWBHxYxVNopVhrd80Y4-2c method: GET uri: https://[::1]:35357/v3/projects/service response: body: encoding: null string: |- { "error": { "code": 404, "title": "Not Found", "message": "Could not find project: service" } } headers: Connection: - Keep-Alive Content-Length: - '93' Content-Type: - application/json Date: - Mon, 15 May 2017 07:49:53 GMT Keep-Alive: - timeout=3, max=99 Server: - Apache/2.4.18 (Ubuntu) Strict-Transport-Security: - max-age=15768000 Vary: - X-Auth-Token X-Distribution: - Ubuntu x-openstack-request-id: - req-6107025c-e09e-437a-90c2-61a559154d32 status: code: 404 message: Not Found url: https://[::1]:35357/v3/projects/service - recorded_at: '2017-05-15T07:49:53' request: body: encoding: utf-8 string: '' headers: Accept: - application/json Accept-Encoding: - gzip, deflate Connection: - keep-alive User-Agent: - python-keystoneclient X-Auth-Token: - gAAAAABZGV2gZwV0SlycA_OIohX7kRAmTp84SnzsAYD5Uhey7RTzCf0NvxNRxLk5RsjRSMncSdro7eWgtMrSblZJCPl485IvHANL3E3gsxFJP9TjebqDiF4DtGhQmc4mHPB3kOBNzg3v2FrHB2hK77Cc4M7V1Pm_-nWBHxYxVNopVhrd80Y4-2c method: GET uri: https://[::1]:35357/v3/projects?name=service response: body: encoding: null string: |- { "projects": [ { "enabled": true, "id": "147cc0a9263c4964926f3ee7b6ba3685", "domain_id": "default", "parent_id": "default", "is_domain": false, "name": "service", "links": { "self": "https://[::1]:5000/v3/projects/147cc0a9263c4964926f3ee7b6ba3685" }, "description": "Tenant for the openstack service" } ], "links": { "self": "https://[::1]:5000/v3/projects?name=service", "next": null, "previous": null } } headers: Connection: - Keep-Alive Content-Length: - '440' Content-Type: - application/json Date: - Mon, 15 May 2017 07:49:53 GMT Keep-Alive: - timeout=3, max=98 Server: - Apache/2.4.18 (Ubuntu) Strict-Transport-Security: - max-age=15768000 Vary: - X-Auth-Token X-Distribution: - Ubuntu x-openstack-request-id: - req-1915b2be-f116-4831-a7c3-5ba0a32d416f status: code: 200 message: OK url: https://[::1]:35357/v3/projects?name=service - recorded_at: '2017-05-15T07:49:53' request: body: encoding: utf-8 string: '' headers: Accept: - application/json Accept-Encoding: - gzip, deflate Connection: - keep-alive User-Agent: - python-keystoneclient X-Auth-Token: - gAAAAABZGV2gZwV0SlycA_OIohX7kRAmTp84SnzsAYD5Uhey7RTzCf0NvxNRxLk5RsjRSMncSdro7eWgtMrSblZJCPl485IvHANL3E3gsxFJP9TjebqDiF4DtGhQmc4mHPB3kOBNzg3v2FrHB2hK77Cc4M7V1Pm_-nWBHxYxVNopVhrd80Y4-2c method: GET uri: https://[::1]:35357/v3/projects/gnocchi response: body: encoding: null string: |- { "error": { "code": 404, "title": "Not Found", "message": "Could not find project: gnocchi" } } headers: Connection: - Keep-Alive Content-Length: - '92' Content-Type: - application/json Date: - Mon, 15 May 2017 07:49:53 GMT Keep-Alive: - timeout=3, max=97 Server: - Apache/2.4.18 (Ubuntu) Strict-Transport-Security: - max-age=15768000 Vary: - X-Auth-Token X-Distribution: - Ubuntu x-openstack-request-id: - req-b23e72d3-742e-4e10-b9a7-d1161f1eeab4 status: code: 404 message: Not Found url: https://[::1]:35357/v3/projects/gnocchi - recorded_at: '2017-05-15T07:49:53' request: body: encoding: utf-8 string: '' headers: Accept: - application/json Accept-Encoding: - gzip, deflate Connection: - keep-alive User-Agent: - python-keystoneclient X-Auth-Token: - gAAAAABZGV2gZwV0SlycA_OIohX7kRAmTp84SnzsAYD5Uhey7RTzCf0NvxNRxLk5RsjRSMncSdro7eWgtMrSblZJCPl485IvHANL3E3gsxFJP9TjebqDiF4DtGhQmc4mHPB3kOBNzg3v2FrHB2hK77Cc4M7V1Pm_-nWBHxYxVNopVhrd80Y4-2c method: GET uri: https://[::1]:35357/v3/projects?name=gnocchi response: body: encoding: null string: |- { "projects": [], "links": { "self": "https://[::1]:5000/v3/projects?name=gnocchi", "next": null, "previous": null } } headers: Connection: - Keep-Alive Content-Length: - '134' Content-Type: - application/json Date: - Mon, 15 May 2017 07:49:53 GMT Keep-Alive: - timeout=3, max=96 Server: - Apache/2.4.18 (Ubuntu) Strict-Transport-Security: - max-age=15768000 Vary: - X-Auth-Token X-Distribution: - Ubuntu x-openstack-request-id: - req-fdeed726-18a4-4e73-bf8d-d24a5b56246e status: code: 200 message: OK url: https://[::1]:35357/v3/projects?name=gnocchi recorded_with: betamax/0.8.0 ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/ceilometermiddleware/tests/test_swift.py0000664000175000017500000005426600000000000026041 0ustar00zuulzuul00000000000000# # Copyright 2012 eNovance # # 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. from io import StringIO import threading import unittest from unittest import mock from oslo_config import cfg from ceilometermiddleware import swift from ceilometermiddleware.tests import base as tests_base from keystoneauth1.fixture import keystoneauth_betamax as betamax class FakeApp(object): def __init__(self, body=None): self.body = body or ['This string is 28 bytes long'] def __call__(self, env, start_response): yield start_response('200 OK', [ ('Content-Type', 'text/plain'), ('Content-Length', str(sum(map(len, self.body)))) ]) while env['wsgi.input'].read(5): pass for line in self.body: yield line class FakeRequest(object): """A bare bones request object The middleware will inspect this for request method, wsgi.input and headers. """ def __init__(self, path, environ=None, headers=None): environ = environ or {} headers = headers or {} environ['PATH_INFO'] = path if 'wsgi.input' not in environ: environ['wsgi.input'] = StringIO('') for header, value in headers.items(): environ['HTTP_%s' % header.upper()] = value self.environ = environ @mock.patch('oslo_messaging.get_transport', mock.MagicMock()) class TestSwift(tests_base.TestCase): def setUp(self): super(TestSwift, self).setUp() cfg.CONF([], project='ceilometermiddleware') self.addCleanup(cfg.CONF.reset) @staticmethod def start_response(*args): pass def get_request(self, path, environ=None, headers=None): return FakeRequest(path, environ=environ, headers=headers) def test_get(self): app = swift.Swift(FakeApp(), {}) req = self.get_request('/1.0/account/container/obj', environ={'REQUEST_METHOD': 'GET'}) with mock.patch('oslo_messaging.Notifier.info') as notify: resp = app(req.environ, self.start_response) self.assertEqual(["This string is 28 bytes long"], list(resp)) self.assertEqual(1, len(notify.call_args_list)) data = notify.call_args_list[0][0] self.assertEqual('objectstore.http.request', data[1]) self.assertEqual(28, data[2]['measurements'][0]['result']) self.assertEqual('storage.objects.outgoing.bytes', data[2]['measurements'][0]['metric']['name']) metadata = data[2]['target']['metadata'] self.assertEqual('1.0', metadata['version']) self.assertEqual('container', metadata['container']) self.assertEqual('obj', metadata['object']) self.assertEqual('get', data[2]['target']['action']) def test_get_background(self): notified = threading.Event() app = swift.Swift(FakeApp(), {"nonblocking_notify": "True", "send_queue_size": "1"}) req = self.get_request('/1.0/account/container/obj', environ={'REQUEST_METHOD': 'GET'}) with mock.patch('oslo_messaging.Notifier.info', side_effect=lambda *args, **kwargs: notified.set() ) as notify: resp = app(req.environ, self.start_response) self.assertEqual(["This string is 28 bytes long"], list(resp)) notified.wait() self.assertEqual(1, len(notify.call_args_list)) data = notify.call_args_list[0][0] self.assertEqual('objectstore.http.request', data[1]) self.assertEqual(28, data[2]['measurements'][0]['result']) self.assertEqual('storage.objects.outgoing.bytes', data[2]['measurements'][0]['metric']['name']) metadata = data[2]['target']['metadata'] self.assertEqual('1.0', metadata['version']) self.assertEqual('container', metadata['container']) self.assertEqual('obj', metadata['object']) self.assertEqual('get', data[2]['target']['action']) def test_put(self): app = swift.Swift(FakeApp(body=['']), {}) req = self.get_request( '/1.0/account/container/obj', environ={'REQUEST_METHOD': 'PUT', 'wsgi.input': StringIO('some stuff')}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(1, len(notify.call_args_list)) data = notify.call_args_list[0][0] self.assertEqual('objectstore.http.request', data[1]) self.assertEqual(10, data[2]['measurements'][0]['result']) self.assertEqual('storage.objects.incoming.bytes', data[2]['measurements'][0]['metric']['name']) metadata = data[2]['target']['metadata'] self.assertEqual('1.0', metadata['version']) self.assertEqual('container', metadata['container']) self.assertEqual('obj', metadata['object']) self.assertEqual('put', data[2]['target']['action']) def test_post(self): app = swift.Swift(FakeApp(body=['']), {}) req = self.get_request( '/1.0/account/container/obj', environ={'REQUEST_METHOD': 'POST', 'wsgi.input': StringIO('some other stuff')}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(1, len(notify.call_args_list)) data = notify.call_args_list[0][0] self.assertEqual('objectstore.http.request', data[1]) self.assertEqual(16, data[2]['measurements'][0]['result']) self.assertEqual('storage.objects.incoming.bytes', data[2]['measurements'][0]['metric']['name']) metadata = data[2]['target']['metadata'] self.assertEqual('1.0', metadata['version']) self.assertEqual('container', metadata['container']) self.assertEqual('obj', metadata['object']) self.assertEqual('post', data[2]['target']['action']) def test_head(self): app = swift.Swift(FakeApp(body=['']), {}) req = self.get_request('/1.0/account/container/obj', environ={'REQUEST_METHOD': 'HEAD'}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(1, len(notify.call_args_list)) data = notify.call_args_list[0][0] self.assertEqual('objectstore.http.request', data[1]) self.assertIsNone(data[2].get('measurements')) metadata = data[2]['target']['metadata'] self.assertEqual('1.0', metadata['version']) self.assertEqual('container', metadata['container']) self.assertEqual('obj', metadata['object']) self.assertEqual('head', data[2]['target']['action']) def test_bogus_request(self): """Test even for arbitrary request method, this will still work.""" app = swift.Swift(FakeApp(body=['']), {}) req = self.get_request('/1.0/account/container/obj', environ={'REQUEST_METHOD': 'BOGUS'}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(1, len(notify.call_args_list)) data = notify.call_args_list[0][0] self.assertEqual('objectstore.http.request', data[1]) self.assertIsNone(data[2].get('measurements')) metadata = data[2]['target']['metadata'] self.assertEqual('1.0', metadata['version']) self.assertEqual('container', metadata['container']) self.assertEqual('obj', metadata['object']) self.assertEqual('bogus', data[2]['target']['action']) def test_get_container(self): app = swift.Swift(FakeApp(), {}) req = self.get_request('/1.0/account/container', environ={'REQUEST_METHOD': 'GET'}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(1, len(notify.call_args_list)) data = notify.call_args_list[0][0] self.assertEqual('objectstore.http.request', data[1]) self.assertEqual(28, data[2]['measurements'][0]['result']) self.assertEqual('storage.objects.outgoing.bytes', data[2]['measurements'][0]['metric']['name']) metadata = data[2]['target']['metadata'] self.assertEqual('1.0', metadata['version']) self.assertEqual('container', metadata['container']) self.assertIsNone(metadata['object']) self.assertEqual('get', data[2]['target']['action']) def test_no_metadata_headers(self): app = swift.Swift(FakeApp(), {}) req = self.get_request('/1.0/account/container', environ={'REQUEST_METHOD': 'GET'}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(1, len(notify.call_args_list)) data = notify.call_args_list[0][0] self.assertEqual('objectstore.http.request', data[1]) metadata = data[2]['target']['metadata'] self.assertEqual('1.0', metadata['version']) self.assertEqual('container', metadata['container']) self.assertIsNone(metadata['object']) self.assertEqual('get', data[2]['target']['action']) http_headers = [k for k in metadata.keys() if k.startswith('http_header_')] self.assertEqual(0, len(http_headers)) def test_metadata_headers(self): app = swift.Swift(FakeApp(), { 'metadata_headers': 'X_VAR1, x-var2, x-var3, token' }) req = self.get_request('/1.0/account/container', environ={'REQUEST_METHOD': 'GET'}, headers={'X_VAR1': 'value1', 'X_VAR2': 'value2', 'TOKEN': 'token'}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(1, len(notify.call_args_list)) data = notify.call_args_list[0][0] self.assertEqual('objectstore.http.request', data[1]) metadata = data[2]['target']['metadata'] self.assertEqual('1.0', metadata['version']) self.assertEqual('container', metadata['container']) self.assertIsNone(metadata['object']) self.assertEqual('get', data[2]['target']['action']) http_headers = [k for k in metadata.keys() if k.startswith('http_header_')] self.assertEqual(3, len(http_headers)) self.assertEqual('value1', metadata['http_header_x_var1']) self.assertEqual('value2', metadata['http_header_x_var2']) self.assertEqual('token', metadata['http_header_token']) self.assertNotIn('http_header_x_var3', metadata) def test_metadata_headers_unicode(self): app = swift.Swift(FakeApp(), { 'metadata_headers': 'unicode' }) uni = u'\xef\xbd\xa1\xef\xbd\xa5' req = self.get_request('/1.0/account/container', environ={'REQUEST_METHOD': 'GET'}, headers={'UNICODE': uni}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(1, len(notify.call_args_list)) data = notify.call_args_list[0][0] self.assertEqual('objectstore.http.request', data[1]) metadata = data[2]['target']['metadata'] self.assertEqual('1.0', metadata['version']) self.assertEqual('container', metadata['container']) self.assertIsNone(metadata['object']) self.assertEqual('get', data[2]['target']['action']) http_headers = [k for k in metadata.keys() if k.startswith('http_header_')] self.assertEqual(1, len(http_headers)) self.assertEqual(str(uni), metadata['http_header_unicode']) def test_metadata_headers_on_not_existing_header(self): app = swift.Swift(FakeApp(), { 'metadata_headers': 'x-var3' }) req = self.get_request('/1.0/account/container', environ={'REQUEST_METHOD': 'GET'}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(1, len(notify.call_args_list)) data = notify.call_args_list[0][0] self.assertEqual('objectstore.http.request', data[1]) metadata = data[2]['target']['metadata'] self.assertEqual('1.0', metadata['version']) self.assertEqual('container', metadata['container']) self.assertIsNone(metadata['object']) self.assertEqual('get', data[2]['target']['action']) http_headers = [k for k in metadata.keys() if k.startswith('http_header_')] self.assertEqual(0, len(http_headers)) def test_bogus_path(self): app = swift.Swift(FakeApp(), {}) req = FakeRequest('/5.0//', environ={'REQUEST_METHOD': 'GET'}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(0, len(notify.call_args_list)) def test_missing_resource_id(self): app = swift.Swift(FakeApp(), {}) req = FakeRequest('/v1/', environ={'REQUEST_METHOD': 'GET'}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(0, len(notify.call_args_list)) @mock.patch('urllib.parse.quote') def test_emit_event_fail(self, mocked_func): mocked_func.side_effect = Exception("a exception") app = swift.Swift(FakeApp(body=["test"]), {}) req = self.get_request('/1.0/account/container', environ={'REQUEST_METHOD': 'GET'}) with mock.patch('oslo_messaging.Notifier.info') as notify: resp = list(app(req.environ, self.start_response)) self.assertEqual(0, len(notify.call_args_list)) self.assertEqual(["test"], resp) def test_reseller_prefix(self): app = swift.Swift(FakeApp(), {}) req = self.get_request('/1.0/AUTH_account/container/obj', environ={'REQUEST_METHOD': 'GET'}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(1, len(notify.call_args_list)) data = notify.call_args_list[0][0] self.assertEqual("account", data[2]['target']['id']) def test_custom_prefix(self): app = swift.Swift(FakeApp(), {'reseller_prefix': 'CUSTOM_'}) req = FakeRequest('/1.0/CUSTOM_account/container/obj', environ={'REQUEST_METHOD': 'GET'}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(1, len(notify.call_args_list)) data = notify.call_args_list[0][0] self.assertEqual("account", data[2]['target']['id']) def test_incomplete_reseller_prefix(self): # Custom reseller prefix set, but without trailing underscore app = swift.Swift( FakeApp(), {'reseller_prefix': 'CUSTOM'}) req = FakeRequest('/1.0/CUSTOM_account/container/obj', environ={'REQUEST_METHOD': 'GET'}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(1, len(notify.call_args_list)) data = notify.call_args_list[0][0] self.assertEqual("account", data[2]['target']['id']) def test_invalid_reseller_prefix(self): app = swift.Swift( FakeApp(), {'reseller_prefix': 'AUTH_'}) req = FakeRequest('/1.0/admin/bucket', environ={'REQUEST_METHOD': 'GET'}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(1, len(notify.call_args_list)) data = notify.call_args_list[0][0] self.assertEqual("1.0/admin/bucket", data[2]['target']['id']) def test_ignore_requests_from_project(self): app = swift.Swift(FakeApp(), {'ignore_projects': 'skip_proj'}) for proj_attr in ['HTTP_X_SERVICE_PROJECT_ID', 'HTTP_X_PROJECT_ID', 'HTTP_X_TENANT_ID']: for proj, calls in [('good', 1), ('skip_proj', 0)]: req = FakeRequest('/1.0/CUSTOM_account/container/obj', environ={'REQUEST_METHOD': 'GET', proj_attr: proj}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(calls, len(notify.call_args_list)) def test_ignore_requests_from_multiple_projects(self): app = swift.Swift(FakeApp(), {'ignore_projects': 'skip_proj, ignore'}) for proj_attr in ['HTTP_X_SERVICE_PROJECT_ID', 'HTTP_X_PROJECT_ID', 'HTTP_X_TENANT_ID']: for proj, calls in [('good', 1), ('skip_proj', 0), ('also_good', 1), ('ignore', 0)]: req = FakeRequest('/1.0/CUSTOM_account/container/obj', environ={'REQUEST_METHOD': 'GET', proj_attr: proj}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(calls, len(notify.call_args_list)) def test_empty_reseller_prefix(self): app = swift.Swift( FakeApp(), {'reseller_prefix': 'CUSTOM'}) req = FakeRequest('/1.0/CUSTOM/container/obj', environ={'REQUEST_METHOD': 'GET'}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) data = notify.call_args_list[0][0] self.assertIsNot(0, len(data[2]['target']['id'])) def test_head_account(self): app = swift.Swift(FakeApp(body=['']), {}) req = FakeRequest('/1.0/account', environ={'REQUEST_METHOD': 'HEAD'}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertEqual(1, len(notify.call_args_list)) data = notify.call_args_list[0][0] self.assertEqual('objectstore.http.request', data[1]) self.assertIsNone(data[2].get('measurements')) metadata = data[2]['target']['metadata'] self.assertEqual('1.0', metadata['version']) self.assertIsNone(metadata['container']) self.assertIsNone(metadata['object']) self.assertEqual('head', data[2]['target']['action']) def test_put_with_swift_source(self): app = swift.Swift(FakeApp(), {}) req = FakeRequest( '/1.0/account/container/obj', environ={'REQUEST_METHOD': 'PUT', 'wsgi.input': StringIO('some stuff'), 'swift.source': 'RL'}) with mock.patch('oslo_messaging.Notifier.info') as notify: list(app(req.environ, self.start_response)) self.assertFalse(notify.called) def test_ignore_projects_without_keystone(self): app = swift.Swift(FakeApp(), { 'ignore_projects': 'cf0356aaac7c42bba5a744339a6169fa,' '18157dd635bb413c9e27686fee93c583', }) self.assertEqual(["cf0356aaac7c42bba5a744339a6169fa", "18157dd635bb413c9e27686fee93c583"], app.ignore_projects) @unittest.skip("fixme: needs to add missing mock coverage") @mock.patch.object(swift.LOG, 'warning') def test_ignore_projects_with_keystone(self, warning): self.useFixture(betamax.BetamaxFixture( cassette_name='list_projects', cassette_library_dir='ceilometermiddleware/tests/data', )) app = swift.Swift(FakeApp(), { 'auth_type': 'v2password', 'auth_url': 'https://[::1]:5000/v2.0', 'username': 'admin', 'tenant_name': 'admin', 'password': 'secret', 'ignore_projects': 'service,gnocchi', }) self.assertEqual(["147cc0a9263c4964926f3ee7b6ba3685"], app.ignore_projects) warning.assert_called_once_with( "fail to find project '%s' in keystone", "gnocchi") class TestSwiftS3Api(TestSwift): def get_request(self, path, environ=None, headers=None): # Add Swift Path in environ, provided by swift s3api middleware environ['swift.backend_path'] = path # Emulate S3 api PATH_INFO by removing /v1 and account parts path = '/' + path.split('/', 3)[-1] return FakeRequest(path, environ=environ, headers=headers) ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1708678712.4101644 ceilometermiddleware-3.3.1/ceilometermiddleware.egg-info/0000775000175000017500000000000000000000000023607 5ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678712.0 ceilometermiddleware-3.3.1/ceilometermiddleware.egg-info/PKG-INFO0000664000175000017500000000344700000000000024714 0ustar00zuulzuul00000000000000Metadata-Version: 1.2 Name: ceilometermiddleware Version: 3.3.1 Summary: OpenStack Telemetry middleware for generating metrics Home-page: https://docs.openstack.org/ceilometermiddleware/latest/ Author: OpenStack Author-email: openstack-discuss@lists.openstack.org License: UNKNOWN Description: =============================================== Middleware for OpenStack Telemetry (Ceilometer) =============================================== This library provides middleware modules designed to enable metric and event data generation to be consumed by Ceilometer. For information on contributing, see ``CONTRIBUTING.rst``. * License: Apache License, Version 2.0 * Documentation: https://docs.openstack.org/ceilometermiddleware/latest/ * Source: http://opendev.org/openstack/ceilometermiddleware * Bugs: http://bugs.launchpad.net/ceilometermiddleware For any other information, refer to the parent project, Ceilometer: https://opendev.org/openstack/ceilometer Platform: UNKNOWN Classifier: Environment :: OpenStack Classifier: Intended Audience :: Information Technology Classifier: Intended Audience :: System Administrators Classifier: License :: OSI Approved :: Apache Software License Classifier: Operating System :: POSIX :: Linux Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: 3 :: Only Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Requires-Python: >=3.8 ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678712.0 ceilometermiddleware-3.3.1/ceilometermiddleware.egg-info/SOURCES.txt0000664000175000017500000000337400000000000025502 0ustar00zuulzuul00000000000000.coveragerc .stestr.conf .zuul.yaml AUTHORS CONTRIBUTING.rst ChangeLog HACKING.rst LICENSE README.rst requirements.txt setup.cfg setup.py test-requirements.txt tox.ini ceilometermiddleware/__init__.py ceilometermiddleware/swift.py ceilometermiddleware.egg-info/PKG-INFO ceilometermiddleware.egg-info/SOURCES.txt ceilometermiddleware.egg-info/dependency_links.txt ceilometermiddleware.egg-info/entry_points.txt ceilometermiddleware.egg-info/not-zip-safe ceilometermiddleware.egg-info/pbr.json ceilometermiddleware.egg-info/requires.txt ceilometermiddleware.egg-info/top_level.txt ceilometermiddleware/tests/__init__.py ceilometermiddleware/tests/base.py ceilometermiddleware/tests/test_swift.py ceilometermiddleware/tests/data/list_projects.yaml doc/source/conf.py doc/source/contributing.rst doc/source/index.rst doc/source/installation.rst doc/source/readme.rst doc/source/usage.rst releasenotes/notes/.placeholder releasenotes/notes/background-thread-notifier-21b36a5f5c8dec0e.yaml releasenotes/notes/bug-1679196-ab9d6bb2134120e0.yaml releasenotes/notes/drop-py-2-7-21178ddd27b28806.yaml releasenotes/notes/drop-python-3-6-and-3-7-a7bb45e8a4be299a.yaml releasenotes/source/2023.1.rst releasenotes/source/2023.2.rst releasenotes/source/conf.py releasenotes/source/index.rst releasenotes/source/mitaka.rst releasenotes/source/newton.rst releasenotes/source/ocata.rst releasenotes/source/pike.rst releasenotes/source/queens.rst releasenotes/source/stein.rst releasenotes/source/train.rst releasenotes/source/unreleased.rst releasenotes/source/ussuri.rst releasenotes/source/victoria.rst releasenotes/source/wallaby.rst releasenotes/source/xena.rst releasenotes/source/yoga.rst releasenotes/source/zed.rst releasenotes/source/_static/.placeholder releasenotes/source/_templates/.placeholder././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678712.0 ceilometermiddleware-3.3.1/ceilometermiddleware.egg-info/dependency_links.txt0000664000175000017500000000000100000000000027655 0ustar00zuulzuul00000000000000 ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678712.0 ceilometermiddleware-3.3.1/ceilometermiddleware.egg-info/entry_points.txt0000664000175000017500000000011200000000000027077 0ustar00zuulzuul00000000000000[paste.filter_factory] swift = ceilometermiddleware.swift:filter_factory ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678712.0 ceilometermiddleware-3.3.1/ceilometermiddleware.egg-info/not-zip-safe0000664000175000017500000000000100000000000026035 0ustar00zuulzuul00000000000000 ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678712.0 ceilometermiddleware-3.3.1/ceilometermiddleware.egg-info/pbr.json0000664000175000017500000000005600000000000025266 0ustar00zuulzuul00000000000000{"git_version": "cf086a0", "is_release": true}././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678712.0 ceilometermiddleware-3.3.1/ceilometermiddleware.egg-info/requires.txt0000664000175000017500000000021500000000000026205 0ustar00zuulzuul00000000000000keystoneauth1>=2.18.0 oslo.config>=3.9.0 oslo.messaging>=5.2.0 oslo.utils>=4.7.0 pbr>=1.6 pycadf!=2.0.0,>=1.1.0 python-keystoneclient>=3.8.0 ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678712.0 ceilometermiddleware-3.3.1/ceilometermiddleware.egg-info/top_level.txt0000664000175000017500000000002500000000000026336 0ustar00zuulzuul00000000000000ceilometermiddleware ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1708678712.4061644 ceilometermiddleware-3.3.1/doc/0000775000175000017500000000000000000000000016474 5ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1708678712.4141643 ceilometermiddleware-3.3.1/doc/source/0000775000175000017500000000000000000000000017774 5ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/doc/source/conf.py0000664000175000017500000000514300000000000021276 0ustar00zuulzuul00000000000000# -*- coding: utf-8 -*- # 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 os import sys sys.path.insert(0, os.path.abspath('../..')) # -- General configuration ---------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [ 'sphinx.ext.autodoc', #'sphinx.ext.intersphinx', 'openstackdocstheme' ] # autodoc generation is a bit aggressive and a nuisance when doing heavy # text edit cycles. # execute "export SPHINX_DEBUG=1" in your terminal to disable # The suffix of source filenames. source_suffix = '.rst' # The master toctree document. master_doc = 'index' # General information about the project. project = 'ceilometermiddleware' copyright = '2013, OpenStack Foundation' # If true, '()' will be appended to :func: etc. cross-reference text. add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). add_module_names = True # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'native' # -- Options for HTML output -------------------------------------------------- # The theme to use for HTML and HTML Help pages. Major themes that come with # Sphinx are currently 'default' and 'sphinxdoc'. # html_theme_path = ["."] # html_theme = '_theme' # html_static_path = ['static'] html_theme = 'openstackdocs' # Output file base name for HTML help builder. htmlhelp_basename = '%sdoc' % project # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass # [howto/manual]). latex_documents = [ ('index', '%s.tex' % project, '%s Documentation' % project, 'OpenStack Foundation', 'manual'), ] # Example configuration for intersphinx: refer to the Python standard library. #intersphinx_mapping = {'http://docs.python.org/': None} # openstackdocstheme options openstackdocs_repo_name = 'openstack/ceilometermiddleware' openstackdocs_auto_name = False openstackdocs_use_storyboard = True ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/doc/source/contributing.rst0000664000175000017500000000011300000000000023230 0ustar00zuulzuul00000000000000============ Contributing ============ .. include:: ../../CONTRIBUTING.rst ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/doc/source/index.rst0000664000175000017500000000077100000000000021642 0ustar00zuulzuul00000000000000.. ceilometermiddleware documentation master file, created by sphinx-quickstart on Tue Jul 9 22:26:36 2013. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. Welcome to ceilometermiddleware's documentation! ======================================================== Contents: .. toctree:: :maxdepth: 2 readme installation usage contributing Indices and tables ================== * :ref:`genindex` * :ref:`search` ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/doc/source/installation.rst0000664000175000017500000000034500000000000023231 0ustar00zuulzuul00000000000000============ Installation ============ At the command line:: $ pip install ceilometermiddleware Or, if you have virtualenvwrapper installed:: $ mkvirtualenv ceilometermiddleware $ pip install ceilometermiddleware ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/doc/source/readme.rst0000664000175000017500000000003600000000000021762 0ustar00zuulzuul00000000000000.. include:: ../../README.rst ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/doc/source/usage.rst0000664000175000017500000000014500000000000021632 0ustar00zuulzuul00000000000000======== Usage ======== To use ceilometermiddleware in a project:: import ceilometermiddleware ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1708678712.4061644 ceilometermiddleware-3.3.1/releasenotes/0000775000175000017500000000000000000000000020420 5ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1708678712.4141643 ceilometermiddleware-3.3.1/releasenotes/notes/0000775000175000017500000000000000000000000021550 5ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/releasenotes/notes/.placeholder0000664000175000017500000000000000000000000024021 0ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/releasenotes/notes/background-thread-notifier-21b36a5f5c8dec0e.yaml0000664000175000017500000000113300000000000032203 0ustar00zuulzuul00000000000000--- features: - Introduced option to send notifications from a background thread instead of blocking the service response to send the notification. This option is disabled by default, retaining previous behavior. Enable by setting ``nonblocking_notify`` to ``True`` in the middleware configuration. When enabled notifications will be queued for delivery in a single thread. Set ``send_queue_size`` to customize the length of this delivery queue (default size 1000). - Introduced option to customize the logging level using the ``log_level`` option (default WARNING). ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/releasenotes/notes/bug-1679196-ab9d6bb2134120e0.yaml0000664000175000017500000000026200000000000026246 0ustar00zuulzuul00000000000000--- fixes: - Corrects retrieval of (notification) transport_url for oslo.messaging. Issue would occur when oslo.messaging RPC and Notification backends were separated. ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/releasenotes/notes/drop-py-2-7-21178ddd27b28806.yaml0000664000175000017500000000034600000000000026413 0ustar00zuulzuul00000000000000--- upgrade: - | Python 2.7 support has been dropped. Last release of ceilometermiddleware to support python 2.7 is OpenStack Train. The minimum version of Python now supported by ceilometermiddleware is Python 3.6. ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/releasenotes/notes/drop-python-3-6-and-3-7-a7bb45e8a4be299a.yaml0000664000175000017500000000020100000000000030637 0ustar00zuulzuul00000000000000--- upgrade: - | Python 3.6 & 3.7 support has been dropped. The minimum version of Python now supported is Python 3.8. ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1708678712.4181643 ceilometermiddleware-3.3.1/releasenotes/source/0000775000175000017500000000000000000000000021720 5ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/releasenotes/source/2023.1.rst0000664000175000017500000000020200000000000023171 0ustar00zuulzuul00000000000000=========================== 2023.1 Series Release Notes =========================== .. release-notes:: :branch: stable/2023.1 ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/releasenotes/source/2023.2.rst0000664000175000017500000000020200000000000023172 0ustar00zuulzuul00000000000000=========================== 2023.2 Series Release Notes =========================== .. release-notes:: :branch: stable/2023.2 ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1708678712.4181643 ceilometermiddleware-3.3.1/releasenotes/source/_static/0000775000175000017500000000000000000000000023346 5ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/releasenotes/source/_static/.placeholder0000664000175000017500000000000000000000000025617 0ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1708678712.4181643 ceilometermiddleware-3.3.1/releasenotes/source/_templates/0000775000175000017500000000000000000000000024055 5ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/releasenotes/source/_templates/.placeholder0000664000175000017500000000000000000000000026326 0ustar00zuulzuul00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/releasenotes/source/conf.py0000664000175000017500000002124200000000000023220 0ustar00zuulzuul00000000000000#!/usr/bin/env python3 # 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. # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # sys.path.insert(0, os.path.abspath('.')) # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. # needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ 'openstackdocstheme', 'reno.sphinxext', ] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. # source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. author = 'Ceilometer Middleware Contributors' category = 'Miscellaneous' copyright = u'2016, Ceilometer Middleware Developers' project = u'Ceilometer Middleware Release Notes' description = 'Ceilometer Middleware publishes traffic measures for Swift.' title = 'Ceilometer Middleware Release Notes' target_name = 'ceilometermiddleware' # Release notes do not need a version number in the title, they # cover multiple releases. # The full version, including alpha/beta/rc tags. release = '' # The short X.Y version. version = '' # openstackdocstheme options openstackdocs_repo_name = 'openstack/ceilometermiddleware' openstackdocs_use_storyboard = True openstackdocs_auto_name = False # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: # today = '' # Else, today_fmt is used as the format for a strftime call. # today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = [] # The reST default role (used for this markup: `text`) to use for all # documents. # default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. # add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). # add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. # show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'native' # A list of ignored prefixes for module index sorting. # modindex_common_prefix = [] # If true, keep warnings as "system message" paragraphs in the built documents. # keep_warnings = False # -- Options for HTML output ---------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'openstackdocs' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. # html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. # html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". # html_title = None # A shorter title for the navigation bar. Default is the same as html_title. # html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. # html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. # html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. # html_extra_path = [] # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. # html_use_smartypants = True # Custom sidebar templates, maps document names to template names. # html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. # html_additional_pages = {} # If false, no module index is generated. # html_domain_indices = True # If false, no index is generated. # html_use_index = True # If true, the index is split into individual pages for each letter. # html_split_index = False # If true, links to the reST sources are added to the pages. # html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. # html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. # html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. # html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). # html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = target_name + '-docs' # -- Options for LaTeX output --------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). # 'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). # 'pointsize': '10pt', # Additional stuff for the LaTeX preamble. # 'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ (master_doc, target_name + '.tex', title, author, 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. # latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. # latex_use_parts = False # If true, show page references after internal links. # latex_show_pagerefs = False # If true, show URL addresses after external links. # latex_show_urls = False # Documents to append as an appendix to all manuals. # latex_appendices = [] # If false, no module index is generated. # latex_domain_indices = True # -- Options for manual page output --------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ (master_doc, target_name, title, [author], 1), ] # If true, show URL addresses after external links. # man_show_urls = False # -- Options for Texinfo output ------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ (master_doc, target_name, title, author, project, description, category), ] # Documents to append as an appendix to all manuals. # texinfo_appendices = [] # If false, no module index is generated. # texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. # texinfo_show_urls = 'footnote' # If true, do not generate a @detailmenu in the "Top" node's menu. # texinfo_no_detailmenu = False # -- Options for Internationalization output ------------------------------ locale_dirs = ['locale/'] ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/releasenotes/source/index.rst0000664000175000017500000000047300000000000023565 0ustar00zuulzuul00000000000000==================================== Ceilometer Middleware Release Notes ==================================== .. toctree:: :maxdepth: 1 unreleased 2023.2 2023.1 zed yoga xena wallaby victoria ussuri train stein queens pike ocata newton mitaka ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/releasenotes/source/mitaka.rst0000664000175000017500000000022200000000000023714 0ustar00zuulzuul00000000000000============================== Mikata Series Release Notes ============================== .. release-notes:: :branch: origin/stable/mitaka ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/releasenotes/source/newton.rst0000664000175000017500000000022200000000000023760 0ustar00zuulzuul00000000000000============================== Newton Series Release Notes ============================== .. release-notes:: :branch: origin/stable/newton ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/releasenotes/source/ocata.rst0000664000175000017500000000023000000000000023534 0ustar00zuulzuul00000000000000=================================== Ocata Series Release Notes =================================== .. release-notes:: :branch: origin/stable/ocata ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/releasenotes/source/pike.rst0000664000175000017500000000021700000000000023402 0ustar00zuulzuul00000000000000=================================== Pike Series Release Notes =================================== .. release-notes:: :branch: stable/pike ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/releasenotes/source/queens.rst0000664000175000017500000000022300000000000023747 0ustar00zuulzuul00000000000000=================================== Queens Series Release Notes =================================== .. release-notes:: :branch: stable/queens ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/releasenotes/source/stein.rst0000664000175000017500000000022100000000000023567 0ustar00zuulzuul00000000000000=================================== Stein Series Release Notes =================================== .. release-notes:: :branch: stable/stein ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/releasenotes/source/train.rst0000664000175000017500000000017600000000000023573 0ustar00zuulzuul00000000000000========================== Train Series Release Notes ========================== .. release-notes:: :branch: stable/train ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/releasenotes/source/unreleased.rst0000664000175000017500000000016000000000000024576 0ustar00zuulzuul00000000000000============================== Current Series Release Notes ============================== .. release-notes:: ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/releasenotes/source/ussuri.rst0000664000175000017500000000020200000000000023776 0ustar00zuulzuul00000000000000=========================== Ussuri Series Release Notes =========================== .. release-notes:: :branch: stable/ussuri ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/releasenotes/source/victoria.rst0000664000175000017500000000021200000000000024265 0ustar00zuulzuul00000000000000============================= Victoria Series Release Notes ============================= .. release-notes:: :branch: stable/victoria ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/releasenotes/source/wallaby.rst0000664000175000017500000000020600000000000024103 0ustar00zuulzuul00000000000000============================ Wallaby Series Release Notes ============================ .. release-notes:: :branch: stable/wallaby ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/releasenotes/source/xena.rst0000664000175000017500000000017200000000000023405 0ustar00zuulzuul00000000000000========================= Xena Series Release Notes ========================= .. release-notes:: :branch: stable/xena ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/releasenotes/source/yoga.rst0000664000175000017500000000020000000000000023401 0ustar00zuulzuul00000000000000========================= Yoga Series Release Notes ========================= .. release-notes:: :branch: unmaintained/yoga ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/releasenotes/source/zed.rst0000664000175000017500000000016600000000000023237 0ustar00zuulzuul00000000000000======================== Zed Series Release Notes ======================== .. release-notes:: :branch: stable/zed ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/requirements.txt0000664000175000017500000000067500000000000021223 0ustar00zuulzuul00000000000000# The order of packages is significant, because pip processes them in the order # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. oslo.config>=3.9.0 # Apache-2.0 oslo.messaging>=5.2.0 # Apache-2.0 oslo.utils>=4.7.0 # Apache-2.0 pbr>=1.6 # Apache-2.0 pycadf!=2.0.0,>=1.1.0 # Apache-2.0 keystoneauth1>=2.18.0 # Apache-2.0 python-keystoneclient>=3.8.0 # Apache-2.0 ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1708678712.4181643 ceilometermiddleware-3.3.1/setup.cfg0000664000175000017500000000177600000000000017563 0ustar00zuulzuul00000000000000[metadata] name = ceilometermiddleware summary = OpenStack Telemetry middleware for generating metrics description_file = README.rst author = OpenStack author_email = openstack-discuss@lists.openstack.org home_page = https://docs.openstack.org/ceilometermiddleware/latest/ python_requires = >=3.8 classifier = Environment :: OpenStack Intended Audience :: Information Technology Intended Audience :: System Administrators License :: OSI Approved :: Apache Software License Operating System :: POSIX :: Linux Programming Language :: Python Programming Language :: Python :: Implementation :: CPython Programming Language :: Python :: 3 :: Only Programming Language :: Python :: 3 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 [files] packages = ceilometermiddleware [entry_points] paste.filter_factory = swift = ceilometermiddleware.swift:filter_factory [egg_info] tag_build = tag_date = 0 ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/setup.py0000664000175000017500000000126700000000000017447 0ustar00zuulzuul00000000000000# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. # # 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 setuptools setuptools.setup( setup_requires=['pbr>=1.8'], pbr=True) ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/test-requirements.txt0000664000175000017500000000070700000000000022174 0ustar00zuulzuul00000000000000# The order of packages is significant, because pip processes them in the order # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. coverage>=3.6 # Apache-2.0 python-subunit>=0.0.18 # Apache-2.0/BSD sphinx>=2.0.0,!=2.1.0 # BSD openstackdocstheme>=2.2.1 # Apache-2.0 oslotest>=1.10.0 # Apache-2.0 stestr>=2.0.0 # Apache-2.0 reno>=3.1.0 # Apache-2.0 betamax>=0.7.0 # Apache-2.0 ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1708678688.0 ceilometermiddleware-3.3.1/tox.ini0000664000175000017500000000221600000000000017243 0ustar00zuulzuul00000000000000[tox] minversion = 3.1.1 envlist = py38,py39,pypy,pep8,releasenotes skipsdist = True ignore_basepython_conflict = True [testenv] basepython = python3 usedevelop = True setenv = VIRTUAL_ENV={envdir} deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands = stestr run --slowest {posargs} [testenv:pep8] deps = hacking>=6.1.0,<6.2.0 commands = flake8 [testenv:venv] commands = {posargs} [testenv:cover] setenv = PYTHON=coverage run --source $project --parallel-mode commands = stestr run '{posargs}' coverage combine coverage html -d cover coverage xml -o cover/coverage.xml [testenv:docs] commands = sphinx-build -W -b html -d doc/build/doctrees doc/source doc/build/html [testenv:debug] commands = oslo_debug_helper {posargs} [testenv:releasenotes] commands = sphinx-build -a -E -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html [flake8] show-source = True # W503 line break before binary operator ignore = W503 exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build