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".pull/9889/head
parent
fa6679e794
commit
10a08ab88a
|
@ -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).
|
# pool).
|
||||||
assert not self.engine.in_transaction(conn)
|
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
|
sched_duration_sec = monotonic_time() - start_time
|
||||||
sql_scheduling_timer.observe(sched_duration_sec)
|
sql_scheduling_timer.observe(sched_duration_sec)
|
||||||
context.add_database_scheduled(sched_duration_sec)
|
context.add_database_scheduled(sched_duration_sec)
|
||||||
|
|
Loading…
Reference in New Issue