Make tagging the hostname optional

This commit is contained in:
Gavin M. Roy 2016-10-13 21:13:49 -04:00
parent f6a9b2071a
commit 7405312a5e
3 changed files with 32 additions and 25 deletions

View file

@ -27,29 +27,31 @@ documentation.
The following table details the environment variable configuration options.
+-------------------------------+-------------------------------------------------+---------------+
| Variable | Definition | Default |
+===============================+=================================================+===============+
| ``INFLUXDB_SCHEME`` | The URL request scheme for making HTTP requests | ``https`` |
+-------------------------------+-------------------------------------------------+---------------+
| ``INFLUXDB_HOST`` | The InfluxDB server hostname | ``localhost`` |
+-------------------------------+-------------------------------------------------+---------------+
| ``INFLUXDB_PORT`` | The InfluxDB server port | ``8086`` |
+-------------------------------+-------------------------------------------------+---------------+
| ``INFLUXDB_USER`` | The InfluxDB server username | |
+-------------------------------+-------------------------------------------------+---------------+
| ``INFLUXDB_PASSWORD`` | The InfluxDB server password | |
+-------------------------------+-------------------------------------------------+---------------+
| ``INFLUXDB_ENABLED`` | Set to ``false`` to disable InfluxDB support | ``true`` |
+-------------------------------+-------------------------------------------------+---------------+
| ``INFLUXDB_INTERVAL`` | How often to submit measurements to InfluxDB in | ``5000`` |
| | milliseconds. | |
+-------------------------------+-------------------------------------------------+---------------+
| ``INFLUXDB_MAX_BATCH_SIZE`` | Max # of measurements to submit in a batch | ``5000`` |
+-------------------------------+-------------------------------------------------+---------------+
| ``INFLUXDB_MAX_BUFFER_SIZE`` | Limit of measurements in a buffer before new | ``20000`` |
| | measurements are discarded. | |
+-------------------------------+-------------------------------------------------+---------------+
+-------------------------------+--------------------------------------------------+---------------+
| Variable | Definition | Default |
+===============================+==================================================+===============+
| ``INFLUXDB_SCHEME`` | The URL request scheme for making HTTP requests | ``https`` |
+-------------------------------+--------------------------------------------------+---------------+
| ``INFLUXDB_HOST`` | The InfluxDB server hostname | ``localhost`` |
+-------------------------------+--------------------------------------------------+---------------+
| ``INFLUXDB_PORT`` | The InfluxDB server port | ``8086`` |
+-------------------------------+--------------------------------------------------+---------------+
| ``INFLUXDB_USER`` | The InfluxDB server username | |
+-------------------------------+--------------------------------------------------+---------------+
| ``INFLUXDB_PASSWORD`` | The InfluxDB server password | |
+-------------------------------+--------------------------------------------------+---------------+
| ``INFLUXDB_ENABLED`` | Set to ``false`` to disable InfluxDB support | ``true`` |
+-------------------------------+--------------------------------------------------+---------------+
| ``INFLUXDB_INTERVAL`` | How often to submit measurements to InfluxDB in | ``5000`` |
| | milliseconds. | |
+-------------------------------+--------------------------------------------------+---------------+
| ``INFLUXDB_MAX_BATCH_SIZE`` | Max # of measurements to submit in a batch | ``5000`` |
+-------------------------------+--------------------------------------------------+---------------+
| ``INFLUXDB_MAX_BUFFER_SIZE`` | Limit of measurements in a buffer before new | ``20000`` |
| | measurements are discarded. | |
+-------------------------------+--------------------------------------------------+---------------+
| ``INFLUXDB_TAG_HOSTNAME`` | Include the hostname as a tag in the measurement | ``true`` |
+-------------------------------+--------------------------------------------------+---------------+
Mixin Configuration
^^^^^^^^^^^^^^^^^^^

View file

@ -3,6 +3,10 @@
Release History
===============
`1.4.0`_ (12 Oct 2016)
----------------------
- Make the hostname tag optional
`1.3.0`_ (12 Oct 2016)
----------------------
- Add a flag to disable submission

View file

@ -20,7 +20,7 @@ except ImportError: # pragma: no cover
logging.critical('Could not import Tornado')
concurrent, httpclient, ioloop = None, None, None
version_info = (1, 3, 2)
version_info = (1, 4, 0)
__version__ = '.'.join(str(v) for v in version_info)
__all__ = ['__version__', 'version_info', 'add_measurement', 'flush',
'install', 'shutdown', 'Measurement']
@ -248,7 +248,8 @@ def install(url=None, auth_username=None, auth_password=None, io_loop=None,
_on_periodic_callback, interval, _io_loop)
# Set the base tags
_base_tags.setdefault('hostname', socket.gethostname())
if os.environ.get('INFLUXDB_TAG_HOSTNAME', 'true') == 'true':
_base_tags.setdefault('hostname', socket.gethostname())
if os.environ.get('ENVIRONMENT'):
_base_tags.setdefault('environment', os.environ['ENVIRONMENT'])
_base_tags.update(base_tags or {})