summary refs log tree commit diff
path: root/synapse/http/server.py
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2015-03-26 10:07:59 +0000
committerKegan Dougal <kegan@matrix.org>2015-03-26 10:07:59 +0000
commit4edcbcee3b9579f4b50ecb97e566edab1a7c4c8b (patch)
tree5ab27c5ebbfc762ee133223fb48e868b85474c79 /synapse/http/server.py
parentSet the service ID as soon as it is known. (diff)
parentAllow a choice of LRU behaviour for Cache() by using LruCache() or OrderedDict() (diff)
downloadsynapse-4edcbcee3b9579f4b50ecb97e566edab1a7c4c8b.tar.xz
Merge branch 'develop' into application-services-txn-reliability
Conflicts:
	synapse/storage/__init__.py
Diffstat (limited to 'synapse/http/server.py')
-rw-r--r--synapse/http/server.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/synapse/http/server.py b/synapse/http/server.py
index f1376ee243..dee49b9e18 100644
--- a/synapse/http/server.py
+++ b/synapse/http/server.py
@@ -46,6 +46,11 @@ outgoing_responses_counter = metrics.register_counter(
     labels=["method", "code"],
 )
 
+response_timer = metrics.register_distribution(
+    "response_time",
+    labels=["method", "servlet"]
+)
+
 
 class HttpServer(object):
     """ Interface for registering callbacks on a HTTP server
@@ -169,6 +174,10 @@ class JsonResource(HttpServer, resource.Resource):
                 code, response = yield callback(request, *args)
 
                 self._send_response(request, code, response)
+                response_timer.inc_by(
+                    self.clock.time_msec() - start, request.method, servlet_classname
+                )
+
                 return
 
             # Huh. No one wanted to handle that? Fiiiiiine. Send 400.