InfluxDBMixin: Move status code to a tag.

This commit is contained in:
Dave Shawley 2016-02-01 10:12:12 -05:00
parent 9a68608f0d
commit 5295151ee6
3 changed files with 3 additions and 2 deletions

View file

@ -6,6 +6,7 @@ Release History
`Next Release`_
---------------
- Remove extraneous quotes from InfluxDB tag values.
- Convert HTTP status code from value to a tag in the InfluxDB mix-in.
`0.9.0`_ (27-Jan-2016)
----------------------

View file

@ -133,7 +133,7 @@ class InfluxDBMixin(object):
def on_finish(self):
super(InfluxDBMixin, self).on_finish()
self.__metrics.append('status_code={}'.format(self._status_code))
self.set_metric_tag('status_code', self._status_code)
self.record_timing(self.request.request_time(), 'duration')
self.settings[self.SETTINGS_KEY]['db_connection'].submit(
self.settings[self.SETTINGS_KEY]['measurement'],

View file

@ -149,10 +149,10 @@ class InfluxDbTests(testing.AsyncHTTPTestCase):
'examples.influxdb.SimpleHandler')
self.assertEqual(tag_dict['method'], 'GET')
self.assertEqual(tag_dict['host'], socket.gethostname())
self.assertEqual(tag_dict['status_code'], '204')
value_dict = dict(a.split('=') for a in fields.split(','))
assert_between(0.25, float(value_dict['duration']), 0.3)
self.assertEqual(value_dict['status_code'], '204')
nanos_since_epoch = int(timestamp)
then = nanos_since_epoch / 1000000000