diff options
author | Richard van der Hoff <github@rvanderhoff.org.uk> | 2018-02-05 16:34:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-05 16:34:36 +0100 |
commit | db91e72adee90f7d7bacf25f0ed517074c46e64a (patch) | |
tree | e6e8d43cd2c17bb056fb798c059d72451dd210a8 /tests | |
parent | Fix broken unit test for media storage (diff) | |
parent | report metrics on number of cache evictions (diff) | |
download | synapse-db91e72adee90f7d7bacf25f0ed517074c46e64a.tar.xz |
Merge pull request #2844 from matrix-org/rav/evicted_metrics
montoring metrics for number of cache evictions
Diffstat (limited to 'tests')
-rw-r--r-- | tests/metrics/test_metric.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/metrics/test_metric.py b/tests/metrics/test_metric.py index f85455a5af..39bde6e3f8 100644 --- a/tests/metrics/test_metric.py +++ b/tests/metrics/test_metric.py @@ -141,6 +141,7 @@ class CacheMetricTestCase(unittest.TestCase): 'cache:hits{name="cache_name"} 0', 'cache:total{name="cache_name"} 0', 'cache:size{name="cache_name"} 0', + 'cache:evicted_size{name="cache_name"} 0', ]) metric.inc_misses() @@ -150,6 +151,7 @@ class CacheMetricTestCase(unittest.TestCase): 'cache:hits{name="cache_name"} 0', 'cache:total{name="cache_name"} 1', 'cache:size{name="cache_name"} 1', + 'cache:evicted_size{name="cache_name"} 0', ]) metric.inc_hits() @@ -158,4 +160,14 @@ class CacheMetricTestCase(unittest.TestCase): 'cache:hits{name="cache_name"} 1', 'cache:total{name="cache_name"} 2', 'cache:size{name="cache_name"} 1', + 'cache:evicted_size{name="cache_name"} 0', + ]) + + metric.inc_evictions(2) + + self.assertEquals(metric.render(), [ + 'cache:hits{name="cache_name"} 1', + 'cache:total{name="cache_name"} 2', + 'cache:size{name="cache_name"} 1', + 'cache:evicted_size{name="cache_name"} 2', ]) |