mirror of
https://github.com/element-hq/synapse.git
synced 2024-12-14 11:57:44 +00:00
Use the parent's logging context name for runWithConnection. (#9895)
This fixes a regression where the logging context for runWithConnection was reported as runWithConnection instead of the connection name, e.g. "POST-XYZ".
This commit is contained in:
parent
fa6679e794
commit
10a08ab88a
2 changed files with 4 additions and 1 deletions
1
changelog.d/9895.bugfix
Normal file
1
changelog.d/9895.bugfix
Normal file
|
@ -0,0 +1 @@
|
|||
Fix a bug introduced in v1.32.0 where the associated connection was improperly logged for SQL logging statements.
|
|
@ -715,7 +715,9 @@ class DatabasePool:
|
|||
# pool).
|
||||
assert not self.engine.in_transaction(conn)
|
||||
|
||||
with LoggingContext("runWithConnection", parent_context) as context:
|
||||
with LoggingContext(
|
||||
str(curr_context), parent_context=parent_context
|
||||
) as context:
|
||||
sched_duration_sec = monotonic_time() - start_time
|
||||
sql_scheduling_timer.observe(sched_duration_sec)
|
||||
context.add_database_scheduled(sched_duration_sec)
|
||||
|
|
Loading…
Reference in a new issue