diff --git a/docs/history.rst b/docs/history.rst index 9392e44..610432a 100644 --- a/docs/history.rst +++ b/docs/history.rst @@ -3,6 +3,10 @@ Release History =============== +`1.0.7`_ (14 Sep 2016) +---------------------- +- Have a default content length for responses without one + `1.0.6`_ (14 Sep 2016) ---------------------- - Move to millisecond precision @@ -38,6 +42,7 @@ Release History ---------------------- - Initial release +.. _1.0.7: https://github.com/sprockets/sprockets-influxdb/compare/1.0.6...1.0.7 .. _1.0.6: https://github.com/sprockets/sprockets-influxdb/compare/1.0.5...1.0.6 .. _1.0.5: https://github.com/sprockets/sprockets-influxdb/compare/1.0.4...1.0.5 .. _1.0.4: https://github.com/sprockets/sprockets-influxdb/compare/1.0.3...1.0.4 @@ -45,4 +50,4 @@ Release History .. _1.0.2: https://github.com/sprockets/sprockets-influxdb/compare/1.0.1...1.0.2 .. _1.0.1: https://github.com/sprockets/sprockets-influxdb/compare/1.0.0...1.0.1 .. _1.0.0: https://github.com/sprockets/sprockets-influxdb/compare/0.0.0...1.0.0 -.. _Next Release: https://github.com/sprockets/sprockets-influxdb/compare/1.0.6...master +.. _Next Release: https://github.com/sprockets/sprockets-influxdb/compare/1.0.7...master diff --git a/sprockets_influxdb.py b/sprockets_influxdb.py index 8573a1d..88e9015 100644 --- a/sprockets_influxdb.py +++ b/sprockets_influxdb.py @@ -17,7 +17,7 @@ except ImportError: # pragma: no cover logging.critical('Could not import Tornado') concurrent, httpclient, ioloop = None, None, None -version_info = (1, 0, 6) +version_info = (1, 0, 7) __version__ = '.'.join(str(v) for v in version_info) __all__ = ['__version__', 'version_info', 'add_measurement', 'flush', 'install', 'shutdown', 'Measurement'] @@ -84,13 +84,12 @@ class InfluxDBMixin(object): def on_finish(self): self.influxdb.set_field('content_length', - int(self._headers['Content-Length'])) + int(self._headers.get('Content-Length', 0))) if hasattr(self, 'correlation_id'): self.influxdb.set_field('correlation_id', self.correlation_id) self.influxdb.set_field('duration', self.request.request_time()) self.influxdb.set_tag('status_code', self._status_code) self.influxdb.set_tag('remote_ip', self.request.remote_ip) - self.influxdb.set_tag('remote_ip', self.request.remote_ip) add_measurement(self.influxdb)