Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
More database opentracing (#10136)
Browse files Browse the repository at this point in the history
Add a couple of extra logs/spans, to give a bit of a better idea.
  • Loading branch information
richvdh authored Jun 7, 2021
1 parent b2557cb commit 0acb501
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.d/10136.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Report OpenTracing spans for database activity.
7 changes: 5 additions & 2 deletions synapse/storage/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,7 @@ def new_transaction(
},
):
r = func(cursor, *args, **kwargs)
opentracing.log_kv({"message": "commit"})
conn.commit()
return r
except self.engine.module.OperationalError as e:
Expand All @@ -556,7 +557,8 @@ def new_transaction(
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
Expand All @@ -569,7 +571,8 @@ def new_transaction(
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",
Expand Down

0 comments on commit 0acb501

Please sign in to comment.