diff --git a/nexus-config/src/nexus_config.rs b/nexus-config/src/nexus_config.rs index 588374407b0..3f17d07de4a 100644 --- a/nexus-config/src/nexus_config.rs +++ b/nexus-config/src/nexus_config.rs @@ -254,6 +254,9 @@ pub struct TimeseriesDbConfig { /// The native TCP address of the ClickHouse server. #[serde(default, skip_serializing_if = "Option::is_none")] pub address: Option, + /// The max size of the connection pool. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub max_slots: Option, } /// Configuration for the `Dendrite` dataplane daemon. diff --git a/nexus/src/app/mod.rs b/nexus/src/app/mod.rs index f4cf081305b..1bd699f8677 100644 --- a/nexus/src/app/mod.rs +++ b/nexus/src/app/mod.rs @@ -37,6 +37,8 @@ use omicron_common::api::external::Error; use omicron_common::api::internal::shared::SwitchLocation; use omicron_uuid_kinds::OmicronZoneUuid; use oximeter_producer::Server as ProducerServer; +use qorb::policy::Policy; +use qorb::resolvers::fixed::FixedResolver; use sagas::common_storage::PooledPantryClient; use sagas::common_storage::make_pantry_connection_pool; use slog::Logger; @@ -405,14 +407,19 @@ impl Nexus { .map_err(|e| e.to_string())?; // Client to the ClickHouse database. - let timeseries_client = match &config.pkg.timeseries_db.address { - None => { - let native_resolver = - qorb_resolver.for_service(ServiceName::OximeterReader); - oximeter_db::Client::new_with_resolver(native_resolver, &log) - } - Some(address) => oximeter_db::Client::new(*address, &log), + let timeseries_resolver = match &config.pkg.timeseries_db.address { + Some(address) => Box::new(FixedResolver::new([*address])), + None => qorb_resolver.for_service(ServiceName::OximeterReader), }; + let mut timeseries_policy = Policy::default(); + if let Some(max_slots) = config.pkg.timeseries_db.max_slots { + timeseries_policy.max_slots = max_slots; + } + let timeseries_client = oximeter_db::Client::new_with_pool_policy( + timeseries_resolver, + timeseries_policy, + &log, + ); // TODO-cleanup We may want to make the populator a first-class // background task.