1
0

Don't copy scopes from parent span

This commit is contained in:
Erik Johnston
2020-07-14 10:41:16 +01:00
parent b4334ff71a
commit 9fc4231ad8
2 changed files with 6 additions and 5 deletions

View File

@@ -367,15 +367,11 @@ class LoggingContext(object):
# we track the current request
record.request = self.request
# we also track the current scope:
record.scope = self.scope
def copy_to_twisted_log_entry(self, record) -> None:
"""
Copy logging fields from this context to a Twisted log record.
"""
record["request"] = self.request
record["scope"] = self.scope
def start(self, rusage: "Optional[resource._RUsage]") -> None:
"""

View File

@@ -50,7 +50,12 @@ class LogContextScopeManager(ScopeManager):
available.
"""
ctx = current_context()
return ctx.scope
while ctx:
if ctx.scope:
return ctx.scope
ctx = ctx.parent_context
return None
def activate(self, span, finish_on_close):
"""