From 89c3ae77a4b91f73883365ce9a61e3935f130771 Mon Sep 17 00:00:00 2001 From: houseme Date: Thu, 25 Dec 2025 14:28:07 +0800 Subject: [PATCH] feat: Add TONIC_PREFIX prefix matching in ReadinessGateService (#1261) --- rustfs/src/server/prefix.rs | 5 +++++ rustfs/src/server/readiness.rs | 5 ++++- scripts/run.sh | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/rustfs/src/server/prefix.rs b/rustfs/src/server/prefix.rs index bdb8216ae..2dd920e7e 100644 --- a/rustfs/src/server/prefix.rs +++ b/rustfs/src/server/prefix.rs @@ -45,6 +45,11 @@ pub(crate) const CONSOLE_PREFIX: &str = "/rustfs/console"; /// This prefix is used for endpoints that handle remote procedure calls (RPC). pub(crate) const RPC_PREFIX: &str = "/rustfs/rpc"; +/// Predefined gRPC service prefix for RustFS server. +/// This prefix is used for gRPC service endpoints. +/// For example, the full gRPC method path would be "/node_service.NodeService/MethodName". +pub(crate) const TONIC_PREFIX: &str = "/node_service.NodeService"; + /// LOGO art for RustFS server. pub(crate) const LOGO: &str = r#" diff --git a/rustfs/src/server/readiness.rs b/rustfs/src/server/readiness.rs index a79ad0835..1050fe826 100644 --- a/rustfs/src/server/readiness.rs +++ b/rustfs/src/server/readiness.rs @@ -23,6 +23,7 @@ use std::pin::Pin; use std::sync::Arc; use std::task::{Context, Poll}; use tower::{Layer, Service}; +use tracing::debug; /// ReadinessGateLayer ensures that the system components (IAM, Storage) /// are fully initialized before allowing any request to proceed. @@ -88,6 +89,7 @@ where let readiness = self.readiness.clone(); Box::pin(async move { let path = req.uri().path(); + debug!("ReadinessGateService: Received request for path: {}", path); // 1) Exact match: fixed probe/resource path let is_exact_probe = matches!( path, @@ -101,7 +103,8 @@ where let is_prefix_probe = path.starts_with(crate::server::RUSTFS_ADMIN_PREFIX) || path.starts_with(crate::server::CONSOLE_PREFIX) || path.starts_with(crate::server::RPC_PREFIX) - || path.starts_with(crate::server::ADMIN_PREFIX); + || path.starts_with(crate::server::ADMIN_PREFIX) + || path.starts_with(crate::server::TONIC_PREFIX); let is_probe = is_exact_probe || is_prefix_probe; if !is_probe && !readiness.is_ready() { diff --git a/scripts/run.sh b/scripts/run.sh index 6c268c379..55925a591 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -66,8 +66,8 @@ export RUSTFS_CONSOLE_ADDRESS=":9001" #export RUSTFS_OBS_METER_INTERVAL=1 # Sampling interval in seconds #export RUSTFS_OBS_SERVICE_NAME=rustfs # Service name #export RUSTFS_OBS_SERVICE_VERSION=0.1.0 # Service version -export RUSTFS_OBS_ENVIRONMENT=production # Environment name -export RUSTFS_OBS_LOGGER_LEVEL=warn # Log level, supports trace, debug, info, warn, error +export RUSTFS_OBS_ENVIRONMENT=develop # Environment name +export RUSTFS_OBS_LOGGER_LEVEL=info # Log level, supports trace, debug, info, warn, error export RUSTFS_OBS_LOG_STDOUT_ENABLED=false # Whether to enable local stdout logging export RUSTFS_OBS_LOG_DIRECTORY="$current_dir/deploy/logs" # Log directory export RUSTFS_OBS_LOG_ROTATION_TIME="hour" # Log rotation time unit, can be "second", "minute", "hour", "day"