Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maunium
synapse
Commits
1ef9efc1
Unverified
Commit
1ef9efc1
authored
4 years ago
by
Erik Johnston
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix error reporting when using `opentracing.trace` (#7961)
parent
84d099ae
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
changelog.d/7961.bugfix
+1
-0
1 addition, 0 deletions
changelog.d/7961.bugfix
synapse/logging/opentracing.py
+1
-12
1 addition, 12 deletions
synapse/logging/opentracing.py
synapse/logging/scopecontextmanager.py
+2
-0
2 additions, 0 deletions
synapse/logging/scopecontextmanager.py
with
4 additions
and
12 deletions
changelog.d/7961.bugfix
0 → 100644
+
1
−
0
View file @
1ef9efc1
Fix a long standing bug where the tracing of async functions with opentracing was broken.
This diff is collapsed.
Click to expand it.
synapse/logging/opentracing.py
+
1
−
12
View file @
1ef9efc1
...
@@ -737,24 +737,14 @@ def trace(func=None, opname=None):
...
@@ -737,24 +737,14 @@ def trace(func=None, opname=None):
@wraps
(
func
)
@wraps
(
func
)
async
def
_trace_inner
(
*
args
,
**
kwargs
):
async
def
_trace_inner
(
*
args
,
**
kwargs
):
if
opentracing
is
None
:
with
start_active_span
(
_opname
)
:
return
await
func
(
*
args
,
**
kwargs
)
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
:
else
:
# The other case here handles both sync functions and those
# The other case here handles both sync functions and those
# decorated with inlineDeferred.
# decorated with inlineDeferred.
@wraps
(
func
)
@wraps
(
func
)
def
_trace_inner
(
*
args
,
**
kwargs
):
def
_trace_inner
(
*
args
,
**
kwargs
):
if
opentracing
is
None
:
return
func
(
*
args
,
**
kwargs
)
scope
=
start_active_span
(
_opname
)
scope
=
start_active_span
(
_opname
)
scope
.
__enter__
()
scope
.
__enter__
()
...
@@ -767,7 +757,6 @@ def trace(func=None, opname=None):
...
@@ -767,7 +757,6 @@ def trace(func=None, opname=None):
return
result
return
result
def
err_back
(
result
):
def
err_back
(
result
):
scope
.
span
.
set_tag
(
tags
.
ERROR
,
True
)
scope
.
__exit__
(
None
,
None
,
None
)
scope
.
__exit__
(
None
,
None
,
None
)
return
result
return
result
...
...
This diff is collapsed.
Click to expand it.
synapse/logging/scopecontextmanager.py
+
2
−
0
View file @
1ef9efc1
...
@@ -116,6 +116,8 @@ class _LogContextScope(Scope):
...
@@ -116,6 +116,8 @@ class _LogContextScope(Scope):
if
self
.
_enter_logcontext
:
if
self
.
_enter_logcontext
:
self
.
logcontext
.
__enter__
()
self
.
logcontext
.
__enter__
()
return
self
def
__exit__
(
self
,
type
,
value
,
traceback
):
def
__exit__
(
self
,
type
,
value
,
traceback
):
if
type
==
twisted
.
internet
.
defer
.
_DefGen_Return
:
if
type
==
twisted
.
internet
.
defer
.
_DefGen_Return
:
super
(
_LogContextScope
,
self
).
__exit__
(
None
,
None
,
None
)
super
(
_LogContextScope
,
self
).
__exit__
(
None
,
None
,
None
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment