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-17 16:15:42 +0100
committerRichard van der Hoff <richard@matrix.org>2018-09-17 16:15:42 +0100
commitf00a9d2636211e6762d8c8c627ebee3f6cea05c9 (patch)
tree6279dde60412ee79d88596173526c05914c20b1a /synapse/http/site.py
parentREADME: run python_dependencies with -m (diff)
downloadsynapse-f00a9d2636211e6762d8c8c627ebee3f6cea05c9.tar.xz
Fix some b'abcd' noise in logs and metrics
Python 3 compatibility: make sure that we decode some byte sequences before we
use them to create log lines and metrics labels.
Diffstat (limited to 'synapse/http/site.py')
-rw-r--r--synapse/http/site.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/synapse/http/site.py b/synapse/http/site.py
index e1e53e8ae5..2191de9836 100644
--- a/synapse/http/site.py
+++ b/synapse/http/site.py
@@ -82,7 +82,7 @@ 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):
         uri = self.uri
@@ -119,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
@@ -280,9 +280,9 @@ 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,
         )