forked from MirrorHub/synapse
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)
|
||||
opentracing.log_kv({"message": "commit"})
|
||||
conn.commit()
|
||||
return r
|
||||
except self.engine.module.OperationalError as e:
|
||||
|
@ -556,7 +557,8 @@ class DatabasePool:
|
|||
if i < N:
|
||||
i += 1
|
||||
try:
|
||||
conn.rollback()
|
||||
with opentracing.start_active_span("db.rollback"):
|
||||
conn.rollback()
|
||||
except self.engine.module.Error as e1:
|
||||
transaction_logger.warning("[TXN EROLL] {%s} %s", name, e1)
|
||||
continue
|
||||
|
@ -569,7 +571,8 @@ class DatabasePool:
|
|||
if i < N:
|
||||
i += 1
|
||||
try:
|
||||
conn.rollback()
|
||||
with opentracing.start_active_span("db.rollback"):
|
||||
conn.rollback()
|
||||
except self.engine.module.Error as e1:
|
||||
transaction_logger.warning(
|
||||
"[TXN EROLL] {%s} %s",
|
||||
|
|
Loading…
Reference in a new issue