Track the database connection acquisition time and pool usage

This commit is contained in:
Quentin Gliech
2023-07-06 18:35:31 +02:00
parent 154162e917
commit 01ba7abc2a
4 changed files with 70 additions and 12 deletions

View File

@@ -141,17 +141,22 @@ impl Options {
let graphql_schema = mas_handlers::graphql_schema(&pool, conn);
let state = AppState {
pool,
templates,
key_store,
encrypter,
url_builder,
homeserver,
policy_factory,
graphql_schema,
http_client_factory,
password_manager,
let state = {
let mut s = AppState {
pool,
templates,
key_store,
encrypter,
url_builder,
homeserver,
policy_factory,
graphql_schema,
http_client_factory,
password_manager,
conn_acquisition_histogram: None,
};
s.init_metrics()?;
s
};
let mut fd_manager = listenfd::ListenFd::from_env();