From 37a21c76f02a64a73b6c88c0f0fefade7552b1a6 Mon Sep 17 00:00:00 2001 From: David Pacheco Date: Thu, 25 May 2023 19:44:47 -0700 Subject: [PATCH 1/3] use bb8 error sink to log more errors --- nexus/db-queries/src/db/collection_attach.rs | 20 +++--- nexus/db-queries/src/db/collection_detach.rs | 12 ++-- .../src/db/collection_detach_many.rs | 16 ++--- nexus/db-queries/src/db/collection_insert.rs | 4 +- nexus/db-queries/src/db/datastore/mod.rs | 6 +- nexus/db-queries/src/db/explain.rs | 4 +- nexus/db-queries/src/db/pagination.rs | 8 +-- nexus/db-queries/src/db/pool.rs | 63 +++++++++++++++---- .../db-queries/src/db/queries/external_ip.rs | 2 +- nexus/db-queries/src/db/queries/next_item.rs | 2 +- nexus/db-queries/src/db/queries/vpc_subnet.rs | 2 +- nexus/db-queries/src/db/saga_recovery.rs | 2 +- nexus/src/context.rs | 2 +- nexus/src/populate.rs | 5 +- 14 files changed, 94 insertions(+), 54 deletions(-) diff --git a/nexus/db-queries/src/db/collection_attach.rs b/nexus/db-queries/src/db/collection_attach.rs index 84a4073df0..c88054795d 100644 --- a/nexus/db-queries/src/db/collection_attach.rs +++ b/nexus/db-queries/src/db/collection_attach.rs @@ -854,7 +854,7 @@ mod test { dev::test_setup_log("test_attach_missing_collection_fails"); let mut db = test_setup_database(&logctx.log).await; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = db::Pool::new(&cfg); + let pool = db::Pool::new(&logctx.log, &cfg); setup_db(&pool).await; @@ -883,7 +883,7 @@ mod test { let logctx = dev::test_setup_log("test_attach_missing_resource_fails"); let mut db = test_setup_database(&logctx.log).await; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = db::Pool::new(&cfg); + let pool = db::Pool::new(&logctx.log, &cfg); setup_db(&pool).await; @@ -920,7 +920,7 @@ mod test { let logctx = dev::test_setup_log("test_attach_once"); let mut db = test_setup_database(&logctx.log).await; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = db::Pool::new(&cfg); + let pool = db::Pool::new(&logctx.log, &cfg); setup_db(&pool).await; @@ -968,7 +968,7 @@ mod test { let logctx = dev::test_setup_log("test_attach_once_synchronous"); let mut db = test_setup_database(&logctx.log).await; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = db::Pool::new(&cfg); + let pool = db::Pool::new(&logctx.log, &cfg); setup_db(&pool).await; @@ -1028,7 +1028,7 @@ mod test { let logctx = dev::test_setup_log("test_attach_multiple_times"); let mut db = test_setup_database(&logctx.log).await; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = db::Pool::new(&cfg); + let pool = db::Pool::new(&logctx.log, &cfg); setup_db(&pool).await; @@ -1084,7 +1084,7 @@ mod test { let logctx = dev::test_setup_log("test_attach_beyond_capacity_fails"); let mut db = test_setup_database(&logctx.log).await; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = db::Pool::new(&cfg); + let pool = db::Pool::new(&logctx.log, &cfg); setup_db(&pool).await; @@ -1148,7 +1148,7 @@ mod test { let logctx = dev::test_setup_log("test_attach_while_already_attached"); let mut db = test_setup_database(&logctx.log).await; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = db::Pool::new(&cfg); + let pool = db::Pool::new(&logctx.log, &cfg); setup_db(&pool).await; @@ -1255,7 +1255,7 @@ mod test { let logctx = dev::test_setup_log("test_attach_once"); let mut db = test_setup_database(&logctx.log).await; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = db::Pool::new(&cfg); + let pool = db::Pool::new(&logctx.log, &cfg); setup_db(&pool).await; @@ -1310,7 +1310,7 @@ mod test { let logctx = dev::test_setup_log("test_attach_deleted_resource_fails"); let mut db = test_setup_database(&logctx.log).await; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = db::Pool::new(&cfg); + let pool = db::Pool::new(&logctx.log, &cfg); setup_db(&pool).await; @@ -1355,7 +1355,7 @@ mod test { let logctx = dev::test_setup_log("test_attach_without_update_filter"); let mut db = test_setup_database(&logctx.log).await; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = db::Pool::new(&cfg); + let pool = db::Pool::new(&logctx.log, &cfg); setup_db(&pool).await; diff --git a/nexus/db-queries/src/db/collection_detach.rs b/nexus/db-queries/src/db/collection_detach.rs index c4ae237062..04894ecb21 100644 --- a/nexus/db-queries/src/db/collection_detach.rs +++ b/nexus/db-queries/src/db/collection_detach.rs @@ -775,7 +775,7 @@ mod test { dev::test_setup_log("test_detach_missing_collection_fails"); let mut db = test_setup_database(&logctx.log).await; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = db::Pool::new(&cfg); + let pool = db::Pool::new(&logctx.log, &cfg); setup_db(&pool).await; @@ -803,7 +803,7 @@ mod test { let logctx = dev::test_setup_log("test_detach_missing_resource_fails"); let mut db = test_setup_database(&logctx.log).await; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = db::Pool::new(&cfg); + let pool = db::Pool::new(&logctx.log, &cfg); setup_db(&pool).await; @@ -839,7 +839,7 @@ mod test { let logctx = dev::test_setup_log("test_detach_once"); let mut db = test_setup_database(&logctx.log).await; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = db::Pool::new(&cfg); + let pool = db::Pool::new(&logctx.log, &cfg); setup_db(&pool).await; @@ -879,7 +879,7 @@ mod test { let logctx = dev::test_setup_log("test_detach_while_already_detached"); let mut db = test_setup_database(&logctx.log).await; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = db::Pool::new(&cfg); + let pool = db::Pool::new(&logctx.log, &cfg); setup_db(&pool).await; @@ -943,7 +943,7 @@ mod test { let logctx = dev::test_setup_log("test_detach_deleted_resource_fails"); let mut db = test_setup_database(&logctx.log).await; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = db::Pool::new(&cfg); + let pool = db::Pool::new(&logctx.log, &cfg); setup_db(&pool).await; @@ -987,7 +987,7 @@ mod test { let logctx = dev::test_setup_log("test_detach_without_update_filter"); let mut db = test_setup_database(&logctx.log).await; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = db::Pool::new(&cfg); + let pool = db::Pool::new(&logctx.log, &cfg); setup_db(&pool).await; diff --git a/nexus/db-queries/src/db/collection_detach_many.rs b/nexus/db-queries/src/db/collection_detach_many.rs index caef0eaa53..3418296568 100644 --- a/nexus/db-queries/src/db/collection_detach_many.rs +++ b/nexus/db-queries/src/db/collection_detach_many.rs @@ -773,7 +773,7 @@ mod test { dev::test_setup_log("test_detach_missing_collection_fails"); let mut db = test_setup_database(&logctx.log).await; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = db::Pool::new(&cfg); + let pool = db::Pool::new(&logctx.log, &cfg); setup_db(&pool).await; @@ -803,7 +803,7 @@ mod test { dev::test_setup_log("test_detach_missing_resource_succeeds"); let mut db = test_setup_database(&logctx.log).await; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = db::Pool::new(&cfg); + let pool = db::Pool::new(&logctx.log, &cfg); setup_db(&pool).await; @@ -844,7 +844,7 @@ mod test { let logctx = dev::test_setup_log("test_detach_once"); let mut db = test_setup_database(&logctx.log).await; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = db::Pool::new(&cfg); + let pool = db::Pool::new(&logctx.log, &cfg); setup_db(&pool).await; @@ -887,7 +887,7 @@ mod test { let logctx = dev::test_setup_log("test_detach_once_synchronous"); let mut db = test_setup_database(&logctx.log).await; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = db::Pool::new(&cfg); + let pool = db::Pool::new(&logctx.log, &cfg); setup_db(&pool).await; @@ -942,7 +942,7 @@ mod test { let logctx = dev::test_setup_log("test_detach_while_already_detached"); let mut db = test_setup_database(&logctx.log).await; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = db::Pool::new(&cfg); + let pool = db::Pool::new(&logctx.log, &cfg); setup_db(&pool).await; @@ -998,7 +998,7 @@ mod test { let logctx = dev::test_setup_log("test_detach_filter_collection"); let mut db = test_setup_database(&logctx.log).await; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = db::Pool::new(&cfg); + let pool = db::Pool::new(&logctx.log, &cfg); setup_db(&pool).await; @@ -1049,7 +1049,7 @@ mod test { let logctx = dev::test_setup_log("test_detach_deleted_resource"); let mut db = test_setup_database(&logctx.log).await; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = db::Pool::new(&cfg); + let pool = db::Pool::new(&logctx.log, &cfg); setup_db(&pool).await; @@ -1107,7 +1107,7 @@ mod test { let logctx = dev::test_setup_log("test_detach_many"); let mut db = test_setup_database(&logctx.log).await; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = db::Pool::new(&cfg); + let pool = db::Pool::new(&logctx.log, &cfg); setup_db(&pool).await; diff --git a/nexus/db-queries/src/db/collection_insert.rs b/nexus/db-queries/src/db/collection_insert.rs index 647e3e443d..1076f8eb29 100644 --- a/nexus/db-queries/src/db/collection_insert.rs +++ b/nexus/db-queries/src/db/collection_insert.rs @@ -548,7 +548,7 @@ mod test { let logctx = dev::test_setup_log("test_collection_not_present"); let mut db = test_setup_database(&logctx.log).await; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = db::Pool::new(&cfg); + let pool = db::Pool::new(&logctx.log, &cfg); setup_db(&pool).await; @@ -578,7 +578,7 @@ mod test { let logctx = dev::test_setup_log("test_collection_present"); let mut db = test_setup_database(&logctx.log).await; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = db::Pool::new(&cfg); + let pool = db::Pool::new(&logctx.log, &cfg); setup_db(&pool).await; diff --git a/nexus/db-queries/src/db/datastore/mod.rs b/nexus/db-queries/src/db/datastore/mod.rs index cf06f23aef..56d27d8c9d 100644 --- a/nexus/db-queries/src/db/datastore/mod.rs +++ b/nexus/db-queries/src/db/datastore/mod.rs @@ -244,7 +244,7 @@ pub async fn datastore_test( use crate::authn; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = Arc::new(db::Pool::new(&cfg)); + let pool = Arc::new(db::Pool::new(&logctx.log, &cfg)); let datastore = Arc::new(DataStore::new(pool)); // Create an OpContext with the credentials of "db-init" just for the @@ -895,7 +895,7 @@ mod test { dev::test_setup_log("test_queries_do_not_require_full_table_scan"); let mut db = test_setup_database(&logctx.log).await; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = db::Pool::new(&cfg); + let pool = db::Pool::new(&logctx.log, &cfg); let datastore = DataStore::new(Arc::new(pool)); let explanation = DataStore::get_allocated_regions_query(Uuid::nil()) @@ -944,7 +944,7 @@ mod test { let logctx = dev::test_setup_log("test_sled_ipv6_address_allocation"); let mut db = test_setup_database(&logctx.log).await; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = Arc::new(db::Pool::new(&cfg)); + let pool = Arc::new(db::Pool::new(&logctx.log, &cfg)); let datastore = Arc::new(DataStore::new(Arc::clone(&pool))); let opctx = OpContext::for_tests(logctx.log.new(o!()), datastore.clone()); diff --git a/nexus/db-queries/src/db/explain.rs b/nexus/db-queries/src/db/explain.rs index 6bb1b31d6b..de834eb301 100644 --- a/nexus/db-queries/src/db/explain.rs +++ b/nexus/db-queries/src/db/explain.rs @@ -166,7 +166,7 @@ mod test { let logctx = dev::test_setup_log("test_explain_async"); let mut db = test_setup_database(&logctx.log).await; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = db::Pool::new(&cfg); + let pool = db::Pool::new(&logctx.log, &cfg); create_schema(&pool).await; @@ -189,7 +189,7 @@ mod test { let logctx = dev::test_setup_log("test_explain_full_table_scan"); let mut db = test_setup_database(&logctx.log).await; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = db::Pool::new(&cfg); + let pool = db::Pool::new(&logctx.log, &cfg); create_schema(&pool).await; diff --git a/nexus/db-queries/src/db/pagination.rs b/nexus/db-queries/src/db/pagination.rs index 86b2466cf6..50da36c156 100644 --- a/nexus/db-queries/src/db/pagination.rs +++ b/nexus/db-queries/src/db/pagination.rs @@ -263,7 +263,7 @@ mod test { dev::test_setup_log("test_paginated_single_column_ascending"); let mut db = test_setup_database(&logctx.log).await; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = db::Pool::new(&cfg); + let pool = db::Pool::new(&logctx.log, &cfg); use schema::test_users::dsl; @@ -298,7 +298,7 @@ mod test { dev::test_setup_log("test_paginated_single_column_descending"); let mut db = test_setup_database(&logctx.log).await; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = db::Pool::new(&cfg); + let pool = db::Pool::new(&logctx.log, &cfg); use schema::test_users::dsl; @@ -333,7 +333,7 @@ mod test { dev::test_setup_log("test_paginated_multicolumn_ascending"); let mut db = test_setup_database(&logctx.log).await; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = db::Pool::new(&cfg); + let pool = db::Pool::new(&logctx.log, &cfg); use schema::test_users::dsl; @@ -387,7 +387,7 @@ mod test { dev::test_setup_log("test_paginated_multicolumn_descending"); let mut db = test_setup_database(&logctx.log).await; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = db::Pool::new(&cfg); + let pool = db::Pool::new(&logctx.log, &cfg); use schema::test_users::dsl; diff --git a/nexus/db-queries/src/db/pool.rs b/nexus/db-queries/src/db/pool.rs index b8ceb26768..ccca757bd3 100644 --- a/nexus/db-queries/src/db/pool.rs +++ b/nexus/db-queries/src/db/pool.rs @@ -44,21 +44,35 @@ pub struct Pool { } impl Pool { - pub fn new(db_config: &DbConfig) -> Self { - let manager = - ConnectionManager::::new(&db_config.url.url()); - let pool = bb8::Builder::new() - .connection_customizer(Box::new(DisallowFullTableScans {})) - .build_unchecked(manager); - Pool { pool } + pub fn new(log: &slog::Logger, db_config: &DbConfig) -> Self { + Self::new_builder(log, db_config, bb8::Builder::new()) + } + + pub fn new_failfast_for_tests( + log: &slog::Logger, + db_config: &DbConfig, + ) -> Self { + Self::new_builder( + log, + db_config, + bb8::Builder::new() + .connection_timeout(std::time::Duration::from_millis(1)), + ) } - pub fn new_failfast_for_tests(db_config: &DbConfig) -> Self { - let manager = - ConnectionManager::::new(&db_config.url.url()); - let pool = bb8::Builder::new() + fn new_builder( + log: &slog::Logger, + db_config: &DbConfig, + builder: bb8::Builder>, + ) -> Self { + let url = db_config.url.url(); + let log = log.new(o!("database_url" => url.clone())); + info!(&log, "database connection pool"; "url" => url.clone()); + let error_sink = LoggingErrorSink::new(log); + let manager = ConnectionManager::::new(url); + let pool = builder .connection_customizer(Box::new(DisallowFullTableScans {})) - .connection_timeout(std::time::Duration::from_millis(1)) + .error_sink(Box::new(error_sink)) .build_unchecked(manager); Pool { pool } } @@ -85,3 +99,28 @@ impl CustomizeConnection, ConnectionError> conn.batch_execute_async(DISALLOW_FULL_TABLE_SCAN_SQL).await } } + +#[derive(Clone, Debug)] +struct LoggingErrorSink { + log: slog::Logger, +} + +impl LoggingErrorSink { + fn new(log: slog::Logger) -> LoggingErrorSink { + LoggingErrorSink { log } + } +} + +impl bb8::ErrorSink for LoggingErrorSink { + fn sink(&self, error: ConnectionError) { + error!( + &self.log, + "database connection error"; + "error_message" => #%error + ); + } + + fn boxed_clone(&self) -> Box> { + Box::new(self.clone()) + } +} diff --git a/nexus/db-queries/src/db/queries/external_ip.rs b/nexus/db-queries/src/db/queries/external_ip.rs index caba23caae..be13775d46 100644 --- a/nexus/db-queries/src/db/queries/external_ip.rs +++ b/nexus/db-queries/src/db/queries/external_ip.rs @@ -850,7 +850,7 @@ mod tests { let db = test_setup_database(&log).await; crate::db::datastore::datastore_test(&logctx, &db).await; let cfg = crate::db::Config { url: db.pg_config().clone() }; - let pool = Arc::new(crate::db::Pool::new(&cfg)); + let pool = Arc::new(crate::db::Pool::new(&logctx.log, &cfg)); let db_datastore = Arc::new(crate::db::DataStore::new(Arc::clone(&pool))); let opctx = diff --git a/nexus/db-queries/src/db/queries/next_item.rs b/nexus/db-queries/src/db/queries/next_item.rs index d7486e369d..3ba09788a0 100644 --- a/nexus/db-queries/src/db/queries/next_item.rs +++ b/nexus/db-queries/src/db/queries/next_item.rs @@ -592,7 +592,7 @@ mod tests { let log = logctx.log.new(o!()); let mut db = test_setup_database(&log).await; let cfg = crate::db::Config { url: db.pg_config().clone() }; - let pool = Arc::new(crate::db::Pool::new(&cfg)); + let pool = Arc::new(crate::db::Pool::new(&logctx.log, &cfg)); // We're going to operate on a separate table, for simplicity. setup_test_schema(&pool).await; diff --git a/nexus/db-queries/src/db/queries/vpc_subnet.rs b/nexus/db-queries/src/db/queries/vpc_subnet.rs index b0ed18d58a..c76d8cac91 100644 --- a/nexus/db-queries/src/db/queries/vpc_subnet.rs +++ b/nexus/db-queries/src/db/queries/vpc_subnet.rs @@ -443,7 +443,7 @@ mod test { let log = logctx.log.new(o!()); let mut db = test_setup_database(&log).await; let cfg = crate::db::Config { url: db.pg_config().clone() }; - let pool = Arc::new(crate::db::Pool::new(&cfg)); + let pool = Arc::new(crate::db::Pool::new(&logctx.log, &cfg)); let db_datastore = Arc::new(crate::db::DataStore::new(Arc::clone(&pool))); diff --git a/nexus/db-queries/src/db/saga_recovery.rs b/nexus/db-queries/src/db/saga_recovery.rs index ba5928e0d0..6c4a539be7 100644 --- a/nexus/db-queries/src/db/saga_recovery.rs +++ b/nexus/db-queries/src/db/saga_recovery.rs @@ -328,7 +328,7 @@ mod test { ) -> (dev::db::CockroachInstance, Arc) { let db = test_setup_database(&log).await; let cfg = crate::db::Config { url: db.pg_config().clone() }; - let pool = Arc::new(db::Pool::new(&cfg)); + let pool = Arc::new(db::Pool::new(log, &cfg)); let db_datastore = Arc::new(db::DataStore::new(Arc::clone(&pool))); (db, db_datastore) } diff --git a/nexus/src/context.rs b/nexus/src/context.rs index 3232e0f00e..871f7ed2bb 100644 --- a/nexus/src/context.rs +++ b/nexus/src/context.rs @@ -160,7 +160,7 @@ impl ServerContext { .map_err(|e| format!("Cannot parse Postgres URL: {}", e))? } }; - let pool = db::Pool::new(&db::Config { url }); + let pool = db::Pool::new(&log, &db::Config { url }); let nexus = Nexus::new_with_id( rack_id, log.new(o!("component" => "nexus")), diff --git a/nexus/src/populate.rs b/nexus/src/populate.rs index c077e14c4f..be2ab47d6f 100644 --- a/nexus/src/populate.rs +++ b/nexus/src/populate.rs @@ -341,7 +341,7 @@ mod test { let logctx = dev::test_setup_log("test_populator"); let mut db = test_setup_database(&logctx.log).await; let cfg = db::Config { url: db.pg_config().clone() }; - let pool = Arc::new(db::Pool::new(&cfg)); + let pool = Arc::new(db::Pool::new(&logctx.log, &cfg)); let datastore = Arc::new(db::DataStore::new(pool)); let opctx = OpContext::for_background( logctx.log.clone(), @@ -387,7 +387,8 @@ mod test { // // Anyway, if we try again with a broken database, we should get a // ServiceUnavailable error, which indicates a transient failure. - let pool = Arc::new(db::Pool::new_failfast_for_tests(&cfg)); + let pool = + Arc::new(db::Pool::new_failfast_for_tests(&logctx.log, &cfg)); let datastore = Arc::new(db::DataStore::new(pool)); let opctx = OpContext::for_background( logctx.log.clone(), From f1a5b45ddd291b4ee2824af25adfe193e8b75e69 Mon Sep 17 00:00:00 2001 From: David Pacheco Date: Thu, 25 May 2023 19:53:52 -0700 Subject: [PATCH 2/3] that was redundant --- nexus/db-queries/src/db/pool.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nexus/db-queries/src/db/pool.rs b/nexus/db-queries/src/db/pool.rs index ccca757bd3..9a739a4472 100644 --- a/nexus/db-queries/src/db/pool.rs +++ b/nexus/db-queries/src/db/pool.rs @@ -67,7 +67,7 @@ impl Pool { ) -> Self { let url = db_config.url.url(); let log = log.new(o!("database_url" => url.clone())); - info!(&log, "database connection pool"; "url" => url.clone()); + info!(&log, "database connection pool"); let error_sink = LoggingErrorSink::new(log); let manager = ConnectionManager::::new(url); let pool = builder From 4f11059edb8f5bde19339d5edf559a3c16b7b5b5 Mon Sep 17 00:00:00 2001 From: David Pacheco Date: Thu, 25 May 2023 20:05:21 -0700 Subject: [PATCH 3/3] add component --- nexus/db-queries/src/db/pool.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nexus/db-queries/src/db/pool.rs b/nexus/db-queries/src/db/pool.rs index 9a739a4472..6311121bd1 100644 --- a/nexus/db-queries/src/db/pool.rs +++ b/nexus/db-queries/src/db/pool.rs @@ -66,7 +66,10 @@ impl Pool { builder: bb8::Builder>, ) -> Self { let url = db_config.url.url(); - let log = log.new(o!("database_url" => url.clone())); + let log = log.new(o!( + "database_url" => url.clone(), + "component" => "db::Pool" + )); info!(&log, "database connection pool"); let error_sink = LoggingErrorSink::new(log); let manager = ConnectionManager::::new(url);