mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-14 20:13:50 +01:00
More database opentracing (#10136)
Add a couple of extra logs/spans, to give a bit of a better idea.
This commit is contained in:
parent
b2557cbf42
commit
0acb5010ec
2 changed files with 6 additions and 2 deletions
1
changelog.d/10136.feature
Normal file
1
changelog.d/10136.feature
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Report OpenTracing spans for database activity.
|
|
@ -541,6 +541,7 @@ class DatabasePool:
|
||||||
},
|
},
|
||||||
):
|
):
|
||||||
r = func(cursor, *args, **kwargs)
|
r = func(cursor, *args, **kwargs)
|
||||||
|
opentracing.log_kv({"message": "commit"})
|
||||||
conn.commit()
|
conn.commit()
|
||||||
return r
|
return r
|
||||||
except self.engine.module.OperationalError as e:
|
except self.engine.module.OperationalError as e:
|
||||||
|
@ -556,7 +557,8 @@ class DatabasePool:
|
||||||
if i < N:
|
if i < N:
|
||||||
i += 1
|
i += 1
|
||||||
try:
|
try:
|
||||||
conn.rollback()
|
with opentracing.start_active_span("db.rollback"):
|
||||||
|
conn.rollback()
|
||||||
except self.engine.module.Error as e1:
|
except self.engine.module.Error as e1:
|
||||||
transaction_logger.warning("[TXN EROLL] {%s} %s", name, e1)
|
transaction_logger.warning("[TXN EROLL] {%s} %s", name, e1)
|
||||||
continue
|
continue
|
||||||
|
@ -569,7 +571,8 @@ class DatabasePool:
|
||||||
if i < N:
|
if i < N:
|
||||||
i += 1
|
i += 1
|
||||||
try:
|
try:
|
||||||
conn.rollback()
|
with opentracing.start_active_span("db.rollback"):
|
||||||
|
conn.rollback()
|
||||||
except self.engine.module.Error as e1:
|
except self.engine.module.Error as e1:
|
||||||
transaction_logger.warning(
|
transaction_logger.warning(
|
||||||
"[TXN EROLL] {%s} %s",
|
"[TXN EROLL] {%s} %s",
|
||||||
|
|
Loading…
Reference in a new issue