summary refs log tree commit diff
path: root/synapse/logging/opentracing.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2020-07-27 16:20:24 +0100
committerGitHub <noreply@github.com>2020-07-27 16:20:24 +0100
commit1ef9efc1e07d3b7339249a79cd379105f1f335ea (patch)
treeef6771046dae4240534d0416b36b63bea43504b4 /synapse/logging/opentracing.py
parentFix typing replication not being handled on master (#7959) (diff)
downloadsynapse-1ef9efc1e07d3b7339249a79cd379105f1f335ea.tar.xz
Fix error reporting when using `opentracing.trace` (#7961)
Diffstat (limited to 'synapse/logging/opentracing.py')
-rw-r--r--synapse/logging/opentracing.py13
1 files changed, 1 insertions, 12 deletions
diff --git a/synapse/logging/opentracing.py b/synapse/logging/opentracing.py
index 2101517575..21dbd9f415 100644
--- a/synapse/logging/opentracing.py
+++ b/synapse/logging/opentracing.py
@@ -737,24 +737,14 @@ def trace(func=None, opname=None):
 
             @wraps(func)
             async def _trace_inner(*args, **kwargs):
-                if opentracing is None:
+                with start_active_span(_opname):
                     return await func(*args, **kwargs)
 
-                with start_active_span(_opname) as scope:
-                    try:
-                        return await func(*args, **kwargs)
-                    except Exception:
-                        scope.span.set_tag(tags.ERROR, True)
-                        raise
-
         else:
             # The other case here handles both sync functions and those
             # decorated with inlineDeferred.
             @wraps(func)
             def _trace_inner(*args, **kwargs):
-                if opentracing is None:
-                    return func(*args, **kwargs)
-
                 scope = start_active_span(_opname)
                 scope.__enter__()
 
@@ -767,7 +757,6 @@ def trace(func=None, opname=None):
                             return result
 
                         def err_back(result):
-                            scope.span.set_tag(tags.ERROR, True)
                             scope.__exit__(None, None, None)
                             return result