mirror of
https://github.com/rustfs/rustfs.git
synced 2026-09-04 11:15:39 +00:00
feat: Add TONIC_PREFIX prefix matching in ReadinessGateService (#1261)
This commit is contained in:
@@ -45,6 +45,11 @@ pub(crate) const CONSOLE_PREFIX: &str = "/rustfs/console";
|
|||||||
/// This prefix is used for endpoints that handle remote procedure calls (RPC).
|
/// This prefix is used for endpoints that handle remote procedure calls (RPC).
|
||||||
pub(crate) const RPC_PREFIX: &str = "/rustfs/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.
|
/// LOGO art for RustFS server.
|
||||||
pub(crate) const LOGO: &str = r#"
|
pub(crate) const LOGO: &str = r#"
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ use std::pin::Pin;
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::task::{Context, Poll};
|
use std::task::{Context, Poll};
|
||||||
use tower::{Layer, Service};
|
use tower::{Layer, Service};
|
||||||
|
use tracing::debug;
|
||||||
|
|
||||||
/// ReadinessGateLayer ensures that the system components (IAM, Storage)
|
/// ReadinessGateLayer ensures that the system components (IAM, Storage)
|
||||||
/// are fully initialized before allowing any request to proceed.
|
/// are fully initialized before allowing any request to proceed.
|
||||||
@@ -88,6 +89,7 @@ where
|
|||||||
let readiness = self.readiness.clone();
|
let readiness = self.readiness.clone();
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let path = req.uri().path();
|
let path = req.uri().path();
|
||||||
|
debug!("ReadinessGateService: Received request for path: {}", path);
|
||||||
// 1) Exact match: fixed probe/resource path
|
// 1) Exact match: fixed probe/resource path
|
||||||
let is_exact_probe = matches!(
|
let is_exact_probe = matches!(
|
||||||
path,
|
path,
|
||||||
@@ -101,7 +103,8 @@ where
|
|||||||
let is_prefix_probe = path.starts_with(crate::server::RUSTFS_ADMIN_PREFIX)
|
let is_prefix_probe = path.starts_with(crate::server::RUSTFS_ADMIN_PREFIX)
|
||||||
|| path.starts_with(crate::server::CONSOLE_PREFIX)
|
|| path.starts_with(crate::server::CONSOLE_PREFIX)
|
||||||
|| path.starts_with(crate::server::RPC_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;
|
let is_probe = is_exact_probe || is_prefix_probe;
|
||||||
if !is_probe && !readiness.is_ready() {
|
if !is_probe && !readiness.is_ready() {
|
||||||
|
|||||||
+2
-2
@@ -66,8 +66,8 @@ export RUSTFS_CONSOLE_ADDRESS=":9001"
|
|||||||
#export RUSTFS_OBS_METER_INTERVAL=1 # Sampling interval in seconds
|
#export RUSTFS_OBS_METER_INTERVAL=1 # Sampling interval in seconds
|
||||||
#export RUSTFS_OBS_SERVICE_NAME=rustfs # Service name
|
#export RUSTFS_OBS_SERVICE_NAME=rustfs # Service name
|
||||||
#export RUSTFS_OBS_SERVICE_VERSION=0.1.0 # Service version
|
#export RUSTFS_OBS_SERVICE_VERSION=0.1.0 # Service version
|
||||||
export RUSTFS_OBS_ENVIRONMENT=production # Environment name
|
export RUSTFS_OBS_ENVIRONMENT=develop # Environment name
|
||||||
export RUSTFS_OBS_LOGGER_LEVEL=warn # Log level, supports trace, debug, info, warn, error
|
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_STDOUT_ENABLED=false # Whether to enable local stdout logging
|
||||||
export RUSTFS_OBS_LOG_DIRECTORY="$current_dir/deploy/logs" # Log directory
|
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"
|
export RUSTFS_OBS_LOG_ROTATION_TIME="hour" # Log rotation time unit, can be "second", "minute", "hour", "day"
|
||||||
|
|||||||
Reference in New Issue
Block a user