summary refs log tree commit diff
path: root/synapse/http/site.py
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2018-09-18 19:02:45 +0100
committerRichard van der Hoff <richard@matrix.org>2018-09-18 19:02:45 +0100
commit38ead946a9571f1916228c3d96aad48b6b57ef89 (patch)
treecdc68014a0368b266796c83f78b9a02e41c0fe07 /synapse/http/site.py
parenttowncrier (diff)
parentMerge pull request #3879 from matrix-org/matthew/fix-autojoin (diff)
downloadsynapse-38ead946a9571f1916228c3d96aad48b6b57ef89.tar.xz
Merge remote-tracking branch 'origin/develop' into neilj/fix_room_invite_mail_links
Diffstat (limited to 'synapse/http/site.py')
-rw-r--r--synapse/http/site.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/synapse/http/site.py b/synapse/http/site.py
index f0828c6542..9579e8cd0d 100644
--- a/synapse/http/site.py
+++ b/synapse/http/site.py
@@ -82,10 +82,13 @@ class SynapseRequest(Request):
         )
 
     def get_request_id(self):
-        return "%s-%i" % (self.method, self.request_seq)
+        return "%s-%i" % (self.method.decode('ascii'), self.request_seq)
 
     def get_redacted_uri(self):
-        return redact_uri(self.uri)
+        uri = self.uri
+        if isinstance(uri, bytes):
+            uri = self.uri.decode('ascii')
+        return redact_uri(uri)
 
     def get_user_agent(self):
         return self.requestHeaders.getRawHeaders(b"User-Agent", [None])[-1]
@@ -116,7 +119,7 @@ class SynapseRequest(Request):
             # dispatching to the handler, so that the handler
             # can update the servlet name in the request
             # metrics
-            requests_counter.labels(self.method,
+            requests_counter.labels(self.method.decode('ascii'),
                                     self.request_metrics.name).inc()
 
     @contextlib.contextmanager
@@ -277,15 +280,15 @@ class SynapseRequest(Request):
             int(usage.db_txn_count),
             self.sentLength,
             code,
-            self.method,
+            self.method.decode('ascii'),
             self.get_redacted_uri(),
-            self.clientproto,
+            self.clientproto.decode('ascii', errors='replace'),
             user_agent,
             usage.evt_db_fetch_count,
         )
 
         try:
-            self.request_metrics.stop(self.finish_time, self)
+            self.request_metrics.stop(self.finish_time, self.code, self.sentLength)
         except Exception as e:
             logger.warn("Failed to stop metrics: %r", e)