summary refs log tree commit diff
path: root/synapse/http/server.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2018-04-06 15:49:12 +0100
committerGitHub <noreply@github.com>2018-04-06 15:49:12 +0100
commite8b03cab1b435e36772cf0e3ac85f2fd31ab6262 (patch)
tree8fdf7d24cd0a8ae3b776769363ed1e5e6008cf1b /synapse/http/server.py
parentMerge pull request #3072 from matrix-org/rav/fix_port_script (diff)
parentAdd response size metrics (diff)
downloadsynapse-e8b03cab1b435e36772cf0e3ac85f2fd31ab6262.tar.xz
Merge pull request #3071 from matrix-org/erikj/resp_size_metrics
Add response size metrics
Diffstat (limited to 'synapse/http/server.py')
-rw-r--r--synapse/http/server.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/synapse/http/server.py b/synapse/http/server.py
index 02c7e46f08..ac75206ef5 100644
--- a/synapse/http/server.py
+++ b/synapse/http/server.py
@@ -87,6 +87,11 @@ response_db_sched_duration = metrics.register_counter(
     "response_db_sched_duration_seconds", labels=["method", "servlet", "tag"]
 )
 
+# size in bytes of the response written
+response_size = metrics.register_counter(
+    "response_size", labels=["method", "servlet", "tag"]
+)
+
 _next_request_id = 0
 
 
@@ -400,6 +405,8 @@ class RequestMetrics(object):
             context.db_sched_duration_ms / 1000., request.method, self.name, tag
         )
 
+        response_size.inc_by(request.sentLength, request.method, self.name, tag)
+
 
 class RootRedirect(resource.Resource):
     """Redirects the root '/' path to another path."""