summary refs log tree commit diff
path: root/synapse/storage/_base.py
diff options
context:
space:
mode:
authorMark Haines <mjark@negativecurvature.net>2015-12-08 11:52:35 +0000
committerMark Haines <mjark@negativecurvature.net>2015-12-08 11:52:35 +0000
commit219027f580774dedebf0074cf25500d424b451f3 (patch)
treeb0876351b0c892e23c81ac5a3d85f329d34df7b6 /synapse/storage/_base.py
parentMerge pull request #423 from matrix-org/markjh/archived_flag (diff)
parentTrack the time spent in the database per request. (diff)
downloadsynapse-219027f580774dedebf0074cf25500d424b451f3.tar.xz
Merge pull request #429 from matrix-org/markjh/db_counters
Track the time spent in the database per request.
Diffstat (limited to 'synapse/storage/_base.py')
-rw-r--r--synapse/storage/_base.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py

index 218e708054..17a14e001c 100644 --- a/synapse/storage/_base.py +++ b/synapse/storage/_base.py
@@ -214,7 +214,8 @@ class SQLBaseStore(object): self._clock.looping_call(loop, 10000) - def _new_transaction(self, conn, desc, after_callbacks, func, *args, **kwargs): + def _new_transaction(self, conn, desc, after_callbacks, logging_context, + func, *args, **kwargs): start = time.time() * 1000 txn_id = self._TXN_ID @@ -277,6 +278,9 @@ class SQLBaseStore(object): end = time.time() * 1000 duration = end - start + if logging_context is not None: + logging_context.add_database_transaction(duration) + transaction_logger.debug("[TXN END] {%s} %f", name, duration) self._current_txn_total_time += duration @@ -302,7 +306,8 @@ class SQLBaseStore(object): current_context.copy_to(context) return self._new_transaction( - conn, desc, after_callbacks, func, *args, **kwargs + conn, desc, after_callbacks, current_context, + func, *args, **kwargs ) result = yield preserve_context_over_fn(