summary refs log tree commit diff
path: root/synapse/metrics
diff options
context:
space:
mode:
authorPaul "LeoNerd" Evans <paul@matrix.org>2015-03-12 16:24:38 +0000
committerPaul "LeoNerd" Evans <paul@matrix.org>2015-03-12 16:24:51 +0000
commit128cf2daf76e5b05a4e577b60ea406fdbb6986bf (patch)
tree1eeda21c7b8af0d08a57f46a2ec2c81f4fe3f326 /synapse/metrics
parentOption to serve metrics from their own localhost-only TCP port instead of mux... (diff)
downloadsynapse-128cf2daf76e5b05a4e577b60ea406fdbb6986bf.tar.xz
Appease pep8
Diffstat (limited to 'synapse/metrics')
-rw-r--r--synapse/metrics/__init__.py3
-rw-r--r--synapse/metrics/metric.py11
-rw-r--r--synapse/metrics/resource.py2
3 files changed, 9 insertions, 7 deletions
diff --git a/synapse/metrics/__init__.py b/synapse/metrics/__init__.py
index 94164974fc..7b9c9c8bab 100644
--- a/synapse/metrics/__init__.py
+++ b/synapse/metrics/__init__.py
@@ -85,7 +85,7 @@ def render_all():
             strs += ["# FAILED to render %s" % name]
             logger.exception("Failed to render %s metric", name)
 
-    strs.append("") # to generate a final CRLF
+    strs.append("")  # to generate a final CRLF
 
     return "\n".join(strs)
 
@@ -96,6 +96,7 @@ def render_all():
 rusage = None
 PAGE_SIZE = getpagesize()
 
+
 def update_resource_metrics():
     global rusage
     rusage = getrusage(RUSAGE_SELF)
diff --git a/synapse/metrics/metric.py b/synapse/metrics/metric.py
index 12460c99c3..21b37748f6 100644
--- a/synapse/metrics/metric.py
+++ b/synapse/metrics/metric.py
@@ -27,7 +27,7 @@ class BaseMetric(object):
 
     def __init__(self, name, labels=[]):
         self.name = name
-        self.labels = labels # OK not to clone as we never write it
+        self.labels = labels  # OK not to clone as we never write it
 
     def dimension(self):
         return len(self.labels)
@@ -66,8 +66,8 @@ class CounterMetric(BaseMetric):
 
     def inc_by(self, incr, *values):
         if len(values) != self.dimension():
-            raise ValueError("Expected as many values to inc() as labels (%d)" %
-                (self.dimension())
+            raise ValueError(
+                "Expected as many values to inc() as labels (%d)" % (self.dimension())
             )
 
         # TODO: should assert that the tag values are all strings
@@ -135,10 +135,11 @@ class CacheMetric(object):
     def __init__(self, name, size_callback, labels=[]):
         self.name = name
 
-        self.hits  = CounterMetric(name + ":hits",  labels=labels)
+        self.hits = CounterMetric(name + ":hits", labels=labels)
         self.total = CounterMetric(name + ":total", labels=labels)
 
-        self.size = CallbackMetric(name + ":size",
+        self.size = CallbackMetric(
+            name + ":size",
             callback=size_callback,
             labels=labels,
         )
diff --git a/synapse/metrics/resource.py b/synapse/metrics/resource.py
index ff7baab018..97ea797bf5 100644
--- a/synapse/metrics/resource.py
+++ b/synapse/metrics/resource.py
@@ -26,7 +26,7 @@ class MetricsResource(Resource):
     isLeaf = True
 
     def __init__(self, hs):
-        Resource.__init__(self) # Resource is old-style, so no super()
+        Resource.__init__(self)  # Resource is old-style, so no super()
 
         self.hs = hs