From f345526f723e473801875e20d3218dc2834dede2 Mon Sep 17 00:00:00 2001 From: "Gavin M. Roy" Date: Wed, 5 Oct 2016 14:32:16 -0400 Subject: [PATCH] Bug Fixes - Construct the proper InfluxDB base URL - Fix the mixin __init__ signature to support the new kwargs - Remove overly verbose logging --- rejected/__init__.py | 2 +- rejected/mixins.py | 9 +++++---- rejected/process.py | 5 ++--- setup.py | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/rejected/__init__.py b/rejected/__init__.py index 54f0094..af4b2d6 100644 --- a/rejected/__init__.py +++ b/rejected/__init__.py @@ -4,7 +4,7 @@ """ __author__ = 'Gavin M. Roy ' __since__ = '2009-09-10' -__version__ = '3.13.0' +__version__ = '3.13.1' import logging from logging import NullHandler diff --git a/rejected/mixins.py b/rejected/mixins.py index 602fda7..1cc99a5 100644 --- a/rejected/mixins.py +++ b/rejected/mixins.py @@ -16,10 +16,11 @@ class GarbageCollectorMixin(object): """ DEFAULT_GC_FREQUENCY = 10000 - def __init__(self, settings, process): - self._collection_cycle = settings.get('gc_collection_frequency', - self.DEFAULT_GC_FREQUENCY) - super(GarbageCollectorMixin, self).__init__(settings, process) + def __init__(self, *args, **kwargs): + self._collection_cycle = \ + kwargs.get('settings', {}).get('gc_collection_frequency', + self.DEFAULT_GC_FREQUENCY) + super(GarbageCollectorMixin, self).__init__(*args, **kwargs) self._cycles_left = self.collection_cycle @property diff --git a/rejected/process.py b/rejected/process.py index dd43c38..f8dd4c9 100644 --- a/rejected/process.py +++ b/rejected/process.py @@ -524,7 +524,6 @@ def on_processed(self, message, result, start_time): self.counters[self.PROCESSED] += 1 self.maybe_submit_measurement() self.reset_state() - LOGGER.info('Exiting on_processed: %s', self.state_description) def on_processing_error(self): """Called when message processing failure happens due to a @@ -854,7 +853,7 @@ def setup_influxdb(self, config): if key in os.environ: base_tags[key.lower()] = os.environ[key] influxdb.install( - '{}://{}:{}'.format( + '{}://{}:{}/write'.format( config.get('scheme', os.environ.get('INFLUXDB_SCHEME', 'http')), config.get('host', @@ -892,7 +891,7 @@ def setup_instrumentation(self, config): # InfluxDB support if influxdb and config['stats'].get('influxdb'): self.influxdb = self.setup_influxdb(config['stats']['influxdb']) - LOGGER.debug('InfluxDB measurements configured') + LOGGER.debug('InfluxDB measurements configured: %r', self.influxdb) def setup_sighandlers(self): """Setup the stats and stop signal handlers.""" diff --git a/setup.py b/setup.py index 9ae159f..15ecfa0 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup setup(name='rejected', - version='3.13.0', + version='3.13.1', description='Rejected is a Python RabbitMQ Consumer Framework and ' 'Controller Daemon', long_description=open('README.rst').read(),