mirror of
https://github.com/sprockets/sprockets.mixins.metrics.git
synced 2024-11-21 19:28:34 +00:00
Re-add code to replace periods with dashes
This commit is contained in:
parent
41b18a6c92
commit
af62789a96
2 changed files with 6 additions and 5 deletions
|
@ -162,7 +162,8 @@ class StatsDCollector(object):
|
|||
|
||||
"""
|
||||
path = self._get_prefixes(metric_type) + list(path)
|
||||
return '{}.{}'.format(self._namespace, '.'.join(str(p) for p in path))
|
||||
return '{}.{}'.format(self._namespace,
|
||||
'.'.join(str(p).replace('.', '-') for p in path))
|
||||
|
||||
def _get_prefixes(self, metric_type):
|
||||
"""Get prefixes where applicable
|
||||
|
|
8
tests.py
8
tests.py
|
@ -58,7 +58,7 @@ class StatsdMetricCollectionTests(testing.AsyncHTTPTestCase):
|
|||
self.assertEqual(response.code, 204)
|
||||
|
||||
expected = 'testing.timers.{}.SimpleHandler.GET.204'.format(
|
||||
socket.gethostname())
|
||||
socket.gethostname().replace('.', '-'))
|
||||
for path, value, stat_type in self.statsd.find_metrics(expected, 'ms'):
|
||||
assert_between(250.0, float(value), 500.0)
|
||||
|
||||
|
@ -67,7 +67,7 @@ class StatsdMetricCollectionTests(testing.AsyncHTTPTestCase):
|
|||
self.assertEqual(response.code, 204)
|
||||
|
||||
prefix = 'testing.counters.{}.request.path'.format(
|
||||
socket.gethostname())
|
||||
socket.gethostname().replace('.', '-'))
|
||||
for path, value, stat_type in self.statsd.find_metrics(prefix, 'c'):
|
||||
self.assertEqual(int(value), 1)
|
||||
|
||||
|
@ -76,7 +76,7 @@ class StatsdMetricCollectionTests(testing.AsyncHTTPTestCase):
|
|||
self.assertEqual(response.code, 204)
|
||||
|
||||
prefix = 'testing.counters.{}.path'.format(
|
||||
socket.gethostname())
|
||||
socket.gethostname().replace('.', '-'))
|
||||
for path, value, stat_type in self.statsd.find_metrics(prefix, 'c'):
|
||||
self.assertEqual(int(value), 5)
|
||||
|
||||
|
@ -85,7 +85,7 @@ class StatsdMetricCollectionTests(testing.AsyncHTTPTestCase):
|
|||
self.assertEqual(response.code, 204)
|
||||
|
||||
prefix = 'testing.timers.{}.one.two.three'.format(
|
||||
socket.gethostname())
|
||||
socket.gethostname().replace('.', '-'))
|
||||
for path, value, stat_type in self.statsd.find_metrics(prefix, 'ms'):
|
||||
assert_between(250.0, float(value), 300.0)
|
||||
|
||||
|
|
Loading…
Reference in a new issue