Actually drop the metric when not enabled

This commit is contained in:
Gavin M. Roy 2016-10-13 19:42:51 -04:00
parent b7ada3911c
commit f6a9b2071a

View file

@ -20,7 +20,7 @@ except ImportError: # pragma: no cover
logging.critical('Could not import Tornado') logging.critical('Could not import Tornado')
concurrent, httpclient, ioloop = None, None, None concurrent, httpclient, ioloop = None, None, None
version_info = (1, 3, 1) version_info = (1, 3, 2)
__version__ = '.'.join(str(v) for v in version_info) __version__ = '.'.join(str(v) for v in version_info)
__all__ = ['__version__', 'version_info', 'add_measurement', 'flush', __all__ = ['__version__', 'version_info', 'add_measurement', 'flush',
'install', 'shutdown', 'Measurement'] 'install', 'shutdown', 'Measurement']
@ -130,6 +130,8 @@ def add_measurement(measurement):
if not _enabled: if not _enabled:
LOGGER.debug('Discarding measurement for %s while not enabled', LOGGER.debug('Discarding measurement for %s while not enabled',
measurement.database) measurement.database)
return
if _stopping: if _stopping:
LOGGER.warning('Discarding measurement for %s while stopping', LOGGER.warning('Discarding measurement for %s while stopping',
measurement.database) measurement.database)