summary refs log tree commit diff
path: root/tests/metrics/test_metric.py
diff options
context:
space:
mode:
authorMark Haines <mjark@negativecurvature.net>2016-06-03 14:51:33 +0100
committerMark Haines <mjark@negativecurvature.net>2016-06-03 14:51:33 +0100
commitdd6f62ed99033d7c793685b6cce5dfba9d3aff89 (patch)
tree0044c60b4100253a0875be891bbb4ecfce80d47c /tests/metrics/test_metric.py
parentSend updates to the syncing users every ten seconds or immediately if they've... (diff)
parentMerge pull request #833 from matrix-org/markjh/client_ips (diff)
downloadsynapse-dd6f62ed99033d7c793685b6cce5dfba9d3aff89.tar.xz
Merge branch 'develop' into markjh/synchrotronII
Diffstat (limited to 'tests/metrics/test_metric.py')
-rw-r--r--tests/metrics/test_metric.py23
1 files changed, 10 insertions, 13 deletions
diff --git a/tests/metrics/test_metric.py b/tests/metrics/test_metric.py
index f3c1927ce1..f85455a5af 100644
--- a/tests/metrics/test_metric.py
+++ b/tests/metrics/test_metric.py
@@ -61,9 +61,6 @@ class CounterMetricTestCase(unittest.TestCase):
             'vector{method="PUT"} 1',
         ])
 
-        # Check that passing too few values errors
-        self.assertRaises(ValueError, counter.inc)
-
 
 class CallbackMetricTestCase(unittest.TestCase):
 
@@ -138,27 +135,27 @@ class CacheMetricTestCase(unittest.TestCase):
     def test_cache(self):
         d = dict()
 
-        metric = CacheMetric("cache", lambda: len(d))
+        metric = CacheMetric("cache", lambda: len(d), "cache_name")
 
         self.assertEquals(metric.render(), [
-            'cache:hits 0',
-            'cache:total 0',
-            'cache:size 0',
+            'cache:hits{name="cache_name"} 0',
+            'cache:total{name="cache_name"} 0',
+            'cache:size{name="cache_name"} 0',
         ])
 
         metric.inc_misses()
         d["key"] = "value"
 
         self.assertEquals(metric.render(), [
-            'cache:hits 0',
-            'cache:total 1',
-            'cache:size 1',
+            'cache:hits{name="cache_name"} 0',
+            'cache:total{name="cache_name"} 1',
+            'cache:size{name="cache_name"} 1',
         ])
 
         metric.inc_hits()
 
         self.assertEquals(metric.render(), [
-            'cache:hits 1',
-            'cache:total 2',
-            'cache:size 1',
+            'cache:hits{name="cache_name"} 1',
+            'cache:total{name="cache_name"} 2',
+            'cache:size{name="cache_name"} 1',
         ])