mirror of
https://github.com/sprockets/sprockets.mixins.metrics.git
synced 2025-04-03 09:29:00 -09: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)
|
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):
|
def _get_prefixes(self, metric_type):
|
||||||
"""Get prefixes where applicable
|
"""Get prefixes where applicable
|
||||||
|
|
8
tests.py
8
tests.py
|
@ -58,7 +58,7 @@ class StatsdMetricCollectionTests(testing.AsyncHTTPTestCase):
|
||||||
self.assertEqual(response.code, 204)
|
self.assertEqual(response.code, 204)
|
||||||
|
|
||||||
expected = 'testing.timers.{}.SimpleHandler.GET.204'.format(
|
expected = 'testing.timers.{}.SimpleHandler.GET.204'.format(
|
||||||
socket.gethostname())
|
socket.gethostname().replace('.', '-'))
|
||||||
for path, value, stat_type in self.statsd.find_metrics(expected, 'ms'):
|
for path, value, stat_type in self.statsd.find_metrics(expected, 'ms'):
|
||||||
assert_between(250.0, float(value), 500.0)
|
assert_between(250.0, float(value), 500.0)
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ class StatsdMetricCollectionTests(testing.AsyncHTTPTestCase):
|
||||||
self.assertEqual(response.code, 204)
|
self.assertEqual(response.code, 204)
|
||||||
|
|
||||||
prefix = 'testing.counters.{}.request.path'.format(
|
prefix = 'testing.counters.{}.request.path'.format(
|
||||||
socket.gethostname())
|
socket.gethostname().replace('.', '-'))
|
||||||
for path, value, stat_type in self.statsd.find_metrics(prefix, 'c'):
|
for path, value, stat_type in self.statsd.find_metrics(prefix, 'c'):
|
||||||
self.assertEqual(int(value), 1)
|
self.assertEqual(int(value), 1)
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ class StatsdMetricCollectionTests(testing.AsyncHTTPTestCase):
|
||||||
self.assertEqual(response.code, 204)
|
self.assertEqual(response.code, 204)
|
||||||
|
|
||||||
prefix = 'testing.counters.{}.path'.format(
|
prefix = 'testing.counters.{}.path'.format(
|
||||||
socket.gethostname())
|
socket.gethostname().replace('.', '-'))
|
||||||
for path, value, stat_type in self.statsd.find_metrics(prefix, 'c'):
|
for path, value, stat_type in self.statsd.find_metrics(prefix, 'c'):
|
||||||
self.assertEqual(int(value), 5)
|
self.assertEqual(int(value), 5)
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ class StatsdMetricCollectionTests(testing.AsyncHTTPTestCase):
|
||||||
self.assertEqual(response.code, 204)
|
self.assertEqual(response.code, 204)
|
||||||
|
|
||||||
prefix = 'testing.timers.{}.one.two.three'.format(
|
prefix = 'testing.timers.{}.one.two.three'.format(
|
||||||
socket.gethostname())
|
socket.gethostname().replace('.', '-'))
|
||||||
for path, value, stat_type in self.statsd.find_metrics(prefix, 'ms'):
|
for path, value, stat_type in self.statsd.find_metrics(prefix, 'ms'):
|
||||||
assert_between(250.0, float(value), 300.0)
|
assert_between(250.0, float(value), 300.0)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue