summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-09-06 11:42:45 +0100
committerGitHub <noreply@github.com>2019-09-06 11:42:45 +0100
commit146af7b47f9c23aaadcc2aaa491193c672e7b9a4 (patch)
tree8792766bdee988a1ef994a828e8520e3fe527c0a
parentAllow Synapse to send registration emails + choose Synapse or an external ser... (diff)
parentUpdate changelog (diff)
downloadsynapse-146af7b47f9c23aaadcc2aaa491193c672e7b9a4.tar.xz
Merge pull request #5991 from matrix-org/erikj/fix_tracing_funcs
Don't assume there is a 'self' arg in @trace decorator
-rw-r--r--changelog.d/5991.bugfix1
-rw-r--r--synapse/logging/opentracing.py10
2 files changed, 6 insertions, 5 deletions
diff --git a/changelog.d/5991.bugfix b/changelog.d/5991.bugfix
new file mode 100644
index 0000000000..5c3597cb53
--- /dev/null
+++ b/changelog.d/5991.bugfix
@@ -0,0 +1 @@
+Fix invalid references to None while opentracing if the log context slips.
diff --git a/synapse/logging/opentracing.py b/synapse/logging/opentracing.py
index 8c574ddd28..7246253018 100644
--- a/synapse/logging/opentracing.py
+++ b/synapse/logging/opentracing.py
@@ -702,15 +702,15 @@ def trace(func=None, opname=None):
         _opname = opname if opname else func.__name__
 
         @wraps(func)
-        def _trace_inner(self, *args, **kwargs):
+        def _trace_inner(*args, **kwargs):
             if opentracing is None:
-                return func(self, *args, **kwargs)
+                return func(*args, **kwargs)
 
             scope = start_active_span(_opname)
             scope.__enter__()
 
             try:
-                result = func(self, *args, **kwargs)
+                result = func(*args, **kwargs)
                 if isinstance(result, defer.Deferred):
 
                     def call_back(result):
@@ -750,13 +750,13 @@ def tag_args(func):
         return func
 
     @wraps(func)
-    def _tag_args_inner(self, *args, **kwargs):
+    def _tag_args_inner(*args, **kwargs):
         argspec = inspect.getargspec(func)
         for i, arg in enumerate(argspec.args[1:]):
             set_tag("ARG_" + arg, args[i])
         set_tag("args", args[len(argspec.args) :])
         set_tag("kwargs", kwargs)
-        return func(self, *args, **kwargs)
+        return func(*args, **kwargs)
 
     return _tag_args_inner