mirror of
https://github.com/sprockets/sprockets.mixins.metrics.git
synced 2024-11-22 03:00:25 +00:00
Merge pull request #7 from sprockets/remove-quotes
InfluxDBMixin: Remove unnecessary quotes from tags.
This commit is contained in:
commit
9a68608f0d
3 changed files with 9 additions and 7 deletions
|
@ -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`
|
||||
|
|
|
@ -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,
|
||||
)
|
||||
|
|
10
tests.py
10
tests.py
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue