diff options
author | Erik Johnston <erik@matrix.org> | 2021-11-01 11:21:36 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-01 11:21:36 +0000 |
commit | 82d2168a15741ed4546c12c06d797627469fb684 (patch) | |
tree | 9db6bc56a7d1c4e35a4eefaf8acb1f4a7fc51bbb /synapse/storage/database.py | |
parent | Test that `ClientIpStore` combines database and in-memory data correctly (#11... (diff) | |
download | synapse-82d2168a15741ed4546c12c06d797627469fb684.tar.xz |
Add metrics to the threadpools (#11178)
Diffstat (limited to 'synapse/storage/database.py')
-rw-r--r-- | synapse/storage/database.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/synapse/storage/database.py b/synapse/storage/database.py index fa4e89d35c..5c71e27518 100644 --- a/synapse/storage/database.py +++ b/synapse/storage/database.py @@ -48,6 +48,7 @@ from synapse.logging.context import ( current_context, make_deferred_yieldable, ) +from synapse.metrics import register_threadpool from synapse.metrics.background_process_metrics import run_as_background_process from synapse.storage.background_updates import BackgroundUpdater from synapse.storage.engines import BaseDatabaseEngine, PostgresEngine, Sqlite3Engine @@ -104,13 +105,17 @@ def make_pool( LoggingDatabaseConnection(conn, engine, "on_new_connection") ) - return adbapi.ConnectionPool( + connection_pool = adbapi.ConnectionPool( db_config.config["name"], cp_reactor=reactor, cp_openfun=_on_new_connection, **db_args, ) + register_threadpool(f"database-{db_config.name}", connection_pool.threadpool) + + return connection_pool + def make_conn( db_config: DatabaseConnectionConfig, |