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

Commit 0acb501

Browse files
authored
More database opentracing (#10136)
Add a couple of extra logs/spans, to give a bit of a better idea.
1 parent b2557cb commit 0acb501

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

changelog.d/10136.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Report OpenTracing spans for database activity.

synapse/storage/database.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,7 @@ def new_transaction(
541541
},
542542
):
543543
r = func(cursor, *args, **kwargs)
544+
opentracing.log_kv({"message": "commit"})
544545
conn.commit()
545546
return r
546547
except self.engine.module.OperationalError as e:
@@ -556,7 +557,8 @@ def new_transaction(
556557
if i < N:
557558
i += 1
558559
try:
559-
conn.rollback()
560+
with opentracing.start_active_span("db.rollback"):
561+
conn.rollback()
560562
except self.engine.module.Error as e1:
561563
transaction_logger.warning("[TXN EROLL] {%s} %s", name, e1)
562564
continue
@@ -569,7 +571,8 @@ def new_transaction(
569571
if i < N:
570572
i += 1
571573
try:
572-
conn.rollback()
574+
with opentracing.start_active_span("db.rollback"):
575+
conn.rollback()
573576
except self.engine.module.Error as e1:
574577
transaction_logger.warning(
575578
"[TXN EROLL] {%s} %s",

0 commit comments

Comments
 (0)