mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 11:16:07 -04:00
Add metrics to the threadpools (#11178)
This commit is contained in:
parent
2451003f6f
commit
82d2168a15
4 changed files with 49 additions and 1 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue