diff --git a/influxdb_iox/src/commands/run/main.rs b/influxdb_iox/src/commands/run/main.rs index 79b4c60b09..30059d50be 100644 --- a/influxdb_iox/src/commands/run/main.rs +++ b/influxdb_iox/src/commands/run/main.rs @@ -132,16 +132,20 @@ pub async fn main( server_type, } = service; - info!(?grpc_bind_address, "Binding gRPC services"); + info!(?grpc_bind_address, ?server_type, "Binding gRPC services"); let grpc_listener = grpc_listener(grpc_bind_address.into()).await?; let http_listener = match http_bind_address { Some(http_bind_address) => { - info!(?http_bind_address, "Completed bind of gRPC, binding http"); + info!( + ?http_bind_address, + ?server_type, + "Completed bind of gRPC, binding http" + ); Some(http_listener(http_bind_address.into()).await?) } None => { - info!("No http server specified"); + info!(?server_type, "No http server specified"); None } }; @@ -151,13 +155,14 @@ pub async fn main( frontend_shutdown, grpc_listener, http_listener, - server_type, + Arc::clone(&server_type), ) .await; info!( ?grpc_bind_address, ?http_bind_address, + ?server_type, "done serving, draining futures" ); if let Some(trace_exporter) = trace_exporter { diff --git a/ioxd_common/src/lib.rs b/ioxd_common/src/lib.rs index 786bc36591..503317f4c5 100644 --- a/ioxd_common/src/lib.rs +++ b/ioxd_common/src/lib.rs @@ -119,12 +119,13 @@ pub async fn serve( frontend_shutdown.clone(), ) .fuse(); - info!("gRPC server listening"); + info!(?server_type, "gRPC server listening"); let captured_server_type = Arc::clone(&server_type); let captured_shutdown = frontend_shutdown.clone(); let http_server = async move { if let Some(http_listener) = http_listener { + info!(server_type=?captured_server_type, "HTTP server listening"); http::serve( http_listener, captured_server_type, @@ -139,10 +140,9 @@ pub async fn serve( Ok(()) } .fuse(); - info!("HTTP server listening"); // Purposefully use log not tokio-tracing to ensure correctly hooked up - log::info!("InfluxDB IOx server ready"); + log::info!("InfluxDB IOx {:?} server ready", server_type); // Get IOx background worker join handle let server_handle = Arc::clone(&server_type).join().fuse(); @@ -192,30 +192,30 @@ pub async fn serve( // registry, don't exit before HTTP and gRPC requests dependent on them while !grpc_server.is_terminated() && !http_server.is_terminated() { futures::select! { - _ = signal => info!("Shutdown requested"), + _ = signal => info!(?server_type, "Shutdown requested"), _ = server_handle => { - error!("server worker shutdown prematurely"); + error!(?server_type, "server worker shutdown prematurely"); res = res.and(Err(Error::LostServer)); }, result = grpc_server => match result { - Ok(_) if frontend_shutdown.is_cancelled() => info!("gRPC server shutdown"), + Ok(_) if frontend_shutdown.is_cancelled() => info!(?server_type, "gRPC server shutdown"), Ok(_) => { - error!("Early gRPC server exit"); + error!(?server_type, "Early gRPC server exit"); res = res.and(Err(Error::LostRpc)); } Err(error) => { - error!(%error, "gRPC server error"); + error!(%error, ?server_type, "gRPC server error"); res = res.and(Err(Error::ServingRpc{source: error})); } }, result = http_server => match result { - Ok(_) if frontend_shutdown.is_cancelled() => info!("HTTP server shutdown"), + Ok(_) if frontend_shutdown.is_cancelled() => info!(?server_type, "HTTP server shutdown"), Ok(_) => { - error!("Early HTTP server exit"); + error!(?server_type, "Early HTTP server exit"); res = res.and(Err(Error::LostHttp)); } Err(error) => { - error!(%error, "HTTP server error"); + error!(%error, ?server_type, "HTTP server error"); res = res.and(Err(Error::ServingHttp{source: error})); } }, @@ -223,13 +223,13 @@ pub async fn serve( frontend_shutdown.cancel() } - info!("frontend shutdown completed"); + info!(?server_type, "frontend shutdown completed"); server_type.shutdown(); if !server_handle.is_terminated() { server_handle.await; } - info!("backend shutdown completed"); + info!(?server_type, "backend shutdown completed"); res } diff --git a/ioxd_compactor/src/lib.rs b/ioxd_compactor/src/lib.rs index b2e813d78e..47a659ae8b 100644 --- a/ioxd_compactor/src/lib.rs +++ b/ioxd_compactor/src/lib.rs @@ -42,12 +42,17 @@ pub enum Error { pub type Result = std::result::Result; -#[derive(Debug)] pub struct CompactorServerType { server: CompactorServer, trace_collector: Option>, } +impl std::fmt::Debug for CompactorServerType { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "Compactor") + } +} + impl CompactorServerType { pub fn new(server: CompactorServer, common_state: &CommonServerState) -> Self { Self { diff --git a/ioxd_ingester/src/lib.rs b/ioxd_ingester/src/lib.rs index bcc4f534df..4b0de10ab0 100644 --- a/ioxd_ingester/src/lib.rs +++ b/ioxd_ingester/src/lib.rs @@ -51,12 +51,17 @@ pub enum Error { pub type Result = std::result::Result; -#[derive(Debug)] pub struct IngesterServerType { server: IngesterServer, trace_collector: Option>, } +impl std::fmt::Debug for IngesterServerType { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "Ingester") + } +} + impl IngesterServerType { pub fn new(server: IngesterServer, common_state: &CommonServerState) -> Self { Self { diff --git a/ioxd_querier/src/lib.rs b/ioxd_querier/src/lib.rs index df6c4b1648..088bba51e7 100644 --- a/ioxd_querier/src/lib.rs +++ b/ioxd_querier/src/lib.rs @@ -27,13 +27,18 @@ use ioxd_common::{ mod rpc; -#[derive(Debug)] pub struct QuerierServerType { database: Arc, server: QuerierServer, trace_collector: Option>, } +impl std::fmt::Debug for QuerierServerType { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "Querier") + } +} + impl QuerierServerType { pub fn new( server: QuerierServer, diff --git a/ioxd_router2/src/lib.rs b/ioxd_router2/src/lib.rs index f1c9864d1f..0030671b4b 100644 --- a/ioxd_router2/src/lib.rs +++ b/ioxd_router2/src/lib.rs @@ -53,7 +53,6 @@ pub enum Error { pub type Result = std::result::Result; -#[derive(Debug)] pub struct RouterServerType { server: RouterServer, shutdown: CancellationToken, @@ -70,6 +69,12 @@ impl RouterServerType { } } +impl std::fmt::Debug for RouterServerType { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "Router2") + } +} + #[async_trait] impl ServerType for RouterServerType where