diff options
author | Paul "LeoNerd" Evans <paul@matrix.org> | 2015-03-16 18:31:29 +0000 |
---|---|---|
committer | Paul "LeoNerd" Evans <paul@matrix.org> | 2015-03-16 18:31:29 +0000 |
commit | 3f7a31d3663049eeab6fff90e18d060966c51853 (patch) | |
tree | 5add1863d7c79b6395ce68800312243127875b54 | |
parent | Add a metric for the scheduling latency of SQL queries (diff) | |
download | synapse-3f7a31d3663049eeab6fff90e18d060966c51853.tar.xz |
Add a DistributionMetric to HTTP request/response processing time in the server
Diffstat (limited to '')
-rw-r--r-- | synapse/http/server.py | 9 |
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. |