InfluxDBMixin: Remove unnecessary quotes from tags.

It turns out that tag values are always treated as string values so the
quotes are not necessary.
This commit is contained in:
Dave Shawley 2016-01-30 18:33:27 -05:00
parent 1d6c2b7597
commit b9d71dde6b
3 changed files with 9 additions and 7 deletions

View file

@ -3,6 +3,10 @@
Release History
===============
`Next Release`_
---------------
- Remove extraneous quotes from InfluxDB tag values.
`0.9.0`_ (27-Jan-2016)
----------------------
- Add :class:`sprockets.mixins.metrics.StatsdMixin`

View file

@ -137,6 +137,6 @@ class InfluxDBMixin(object):
self.record_timing(self.request.request_time(), 'duration')
self.settings[self.SETTINGS_KEY]['db_connection'].submit(
self.settings[self.SETTINGS_KEY]['measurement'],
('{}="{}"'.format(k, v) for k, v in self.__tags.items()),
('{}={}'.format(k, v) for k, v in self.__tags.items()),
self.__metrics,
)

View file

@ -146,10 +146,9 @@ class InfluxDbTests(testing.AsyncHTTPTestCase):
if key.startswith('my-service,'):
tag_dict = dict(a.split('=') for a in key.split(',')[1:])
self.assertEqual(tag_dict['handler'],
'"examples.influxdb.SimpleHandler"')
self.assertEqual(tag_dict['method'], '"GET"')
self.assertEqual(tag_dict['host'],
'"{}"'.format(socket.gethostname()))
'examples.influxdb.SimpleHandler')
self.assertEqual(tag_dict['method'], 'GET')
self.assertEqual(tag_dict['host'], socket.gethostname())
value_dict = dict(a.split('=') for a in fields.split(','))
assert_between(0.25, float(value_dict['duration']), 0.3)
@ -205,8 +204,7 @@ class InfluxDbTests(testing.AsyncHTTPTestCase):
for key, fields, timestamp in self.influx_messages:
if key.startswith('my-service,'):
tag_dict = dict(a.split('=') for a in key.split(',')[1:])
self.assertEqual(tag_dict['correlation_id'],
'"{}"'.format(cid))
self.assertEqual(tag_dict['correlation_id'], cid)
break
else:
self.fail('Expected to find "request" metric in {!r}'.format(