diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2021-06-07 18:01:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-07 18:01:32 +0100 |
commit | 0acb5010eca4a31aad9b3e1537b26c1bb5237c98 (patch) | |
tree | 8a0e23deef315bbd90c3f79195270f9078cdd7a5 | |
parent | opentracing: use a consistent name for background processes (#10135) (diff) | |
download | synapse-0acb5010eca4a31aad9b3e1537b26c1bb5237c98.tar.xz |
More database opentracing (#10136)
Add a couple of extra logs/spans, to give a bit of a better idea.
-rw-r--r-- | changelog.d/10136.feature | 1 | ||||
-rw-r--r-- | synapse/storage/database.py | 7 |
2 files changed, 6 insertions, 2 deletions
diff --git a/changelog.d/10136.feature b/changelog.d/10136.feature new file mode 100644 index 0000000000..2658ab8918 --- /dev/null +++ b/changelog.d/10136.feature @@ -0,0 +1 @@ +Report OpenTracing spans for database activity. diff --git a/synapse/storage/database.py b/synapse/storage/database.py index 974703d13a..b77368a460 100644 --- a/synapse/storage/database.py +++ b/synapse/storage/database.py @@ -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", |