More database opentracing (#10136)

Add a couple of extra logs/spans, to give a bit of a better idea.
This commit is contained in:
Richard van der Hoff 2021-06-07 18:01:32 +01:00 committed by GitHub
parent b2557cbf42
commit 0acb5010ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -0,0 +1 @@
Report OpenTracing spans for database activity.

View File

@ -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",