mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-29 08:27:06 +00:00
Generated
+6
-5
@@ -1244,9 +1244,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "block-buffer"
|
name = "block-buffer"
|
||||||
version = "0.11.0-rc.5"
|
version = "0.11.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e9ef36a6fcdb072aa548f3da057640ec10859eb4e91ddf526ee648d50c76a949"
|
checksum = "96eb4cdd6cf1b31d671e9efe75c5d1ec614776856cefbe109ca373554a6d514f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hybrid-array",
|
"hybrid-array",
|
||||||
]
|
]
|
||||||
@@ -1455,9 +1455,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.2.44"
|
version = "1.2.45"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "37521ac7aabe3d13122dc382493e20c9416f299d2ccd5b3a5340a2570cdeb0f3"
|
checksum = "35900b6c8d709fb1d854671ae27aeaa9eec2f8b01b364e1619a40da3e6fe2afe"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"find-msvc-tools",
|
"find-msvc-tools",
|
||||||
"jobserver",
|
"jobserver",
|
||||||
@@ -2953,7 +2953,7 @@ version = "0.11.0-pre.10"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6c478574b20020306f98d61c8ca3322d762e1ff08117422ac6106438605ea516"
|
checksum = "6c478574b20020306f98d61c8ca3322d762e1ff08117422ac6106438605ea516"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"block-buffer 0.11.0-rc.5",
|
"block-buffer 0.11.0",
|
||||||
"const-oid 0.10.1",
|
"const-oid 0.10.1",
|
||||||
"crypto-common 0.2.0-rc.5",
|
"crypto-common 0.2.0-rc.5",
|
||||||
"subtle",
|
"subtle",
|
||||||
@@ -3375,6 +3375,7 @@ dependencies = [
|
|||||||
"regex",
|
"regex",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
|
"serde_json",
|
||||||
"thiserror 2.0.17",
|
"thiserror 2.0.17",
|
||||||
"toml",
|
"toml",
|
||||||
"tracing",
|
"tracing",
|
||||||
|
|||||||
+1
-1
@@ -185,7 +185,7 @@ datafusion = "50.3.0"
|
|||||||
derive_builder = "0.20.2"
|
derive_builder = "0.20.2"
|
||||||
enumset = "1.1.10"
|
enumset = "1.1.10"
|
||||||
flate2 = "1.1.5"
|
flate2 = "1.1.5"
|
||||||
flexi_logger = { version = "0.31.7", features = ["trc", "dont_minimize_extra_stacks", "compress", "kv"] }
|
flexi_logger = { version = "0.31.7", features = ["trc", "dont_minimize_extra_stacks", "compress", "kv", "json"] }
|
||||||
glob = "0.3.3"
|
glob = "0.3.3"
|
||||||
google-cloud-storage = "1.2.0"
|
google-cloud-storage = "1.2.0"
|
||||||
google-cloud-auth = "1.1.0"
|
google-cloud-auth = "1.1.0"
|
||||||
|
|||||||
@@ -13,10 +13,10 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
use rustfs_config::observability::{
|
use rustfs_config::observability::{
|
||||||
ENV_OBS_ENDPOINT, ENV_OBS_ENVIRONMENT, ENV_OBS_LOG_DIRECTORY, ENV_OBS_LOG_ENDPOINT, ENV_OBS_LOG_FILENAME,
|
DEFAULT_OBS_ENVIRONMENT_PRODUCTION, ENV_OBS_ENDPOINT, ENV_OBS_ENVIRONMENT, ENV_OBS_LOG_DIRECTORY, ENV_OBS_LOG_ENDPOINT,
|
||||||
ENV_OBS_LOG_KEEP_FILES, ENV_OBS_LOG_ROTATION_SIZE_MB, ENV_OBS_LOG_ROTATION_TIME, ENV_OBS_LOG_STDOUT_ENABLED,
|
ENV_OBS_LOG_FILENAME, ENV_OBS_LOG_KEEP_FILES, ENV_OBS_LOG_ROTATION_SIZE_MB, ENV_OBS_LOG_ROTATION_TIME,
|
||||||
ENV_OBS_LOGGER_LEVEL, ENV_OBS_METER_INTERVAL, ENV_OBS_METRIC_ENDPOINT, ENV_OBS_SAMPLE_RATIO, ENV_OBS_SERVICE_NAME,
|
ENV_OBS_LOG_STDOUT_ENABLED, ENV_OBS_LOGGER_LEVEL, ENV_OBS_METER_INTERVAL, ENV_OBS_METRIC_ENDPOINT, ENV_OBS_SAMPLE_RATIO,
|
||||||
ENV_OBS_SERVICE_VERSION, ENV_OBS_TRACE_ENDPOINT, ENV_OBS_USE_STDOUT,
|
ENV_OBS_SERVICE_NAME, ENV_OBS_SERVICE_VERSION, ENV_OBS_TRACE_ENDPOINT, ENV_OBS_USE_STDOUT,
|
||||||
};
|
};
|
||||||
use rustfs_config::{
|
use rustfs_config::{
|
||||||
APP_NAME, DEFAULT_LOG_KEEP_FILES, DEFAULT_LOG_LEVEL, DEFAULT_LOG_ROTATION_SIZE_MB, DEFAULT_LOG_ROTATION_TIME,
|
APP_NAME, DEFAULT_LOG_KEEP_FILES, DEFAULT_LOG_LEVEL, DEFAULT_LOG_ROTATION_SIZE_MB, DEFAULT_LOG_ROTATION_TIME,
|
||||||
@@ -209,3 +209,12 @@ impl Default for AppConfig {
|
|||||||
Self::new()
|
Self::new()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Check if the current environment is production
|
||||||
|
///
|
||||||
|
/// # Returns
|
||||||
|
/// true if production, false otherwise
|
||||||
|
///
|
||||||
|
pub fn is_production_environment() -> bool {
|
||||||
|
get_env_str(ENV_OBS_ENVIRONMENT, ENVIRONMENT).eq_ignore_ascii_case(DEFAULT_OBS_ENVIRONMENT_PRODUCTION)
|
||||||
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ mod metrics;
|
|||||||
mod system;
|
mod system;
|
||||||
mod telemetry;
|
mod telemetry;
|
||||||
|
|
||||||
pub use config::{AppConfig, OtelConfig};
|
pub use config::*;
|
||||||
pub use global::*;
|
pub use global::*;
|
||||||
pub use metrics::*;
|
pub use metrics::*;
|
||||||
pub use system::SystemObserver;
|
pub use system::SystemObserver;
|
||||||
|
|||||||
@@ -358,11 +358,14 @@ fn init_file_logging(config: &OtelConfig, logger_level: &str, is_production: boo
|
|||||||
// Build
|
// Build
|
||||||
let mut builder = flexi_logger::Logger::try_with_env_or_str(logger_level)
|
let mut builder = flexi_logger::Logger::try_with_env_or_str(logger_level)
|
||||||
.unwrap_or_else(|e| {
|
.unwrap_or_else(|e| {
|
||||||
eprintln!("WARNING: Invalid logger configuration '{logger_level}': {e:?}");
|
if !is_production {
|
||||||
eprintln!("Falling back to default configuration with level: {DEFAULT_LOG_LEVEL}");
|
eprintln!("WARNING: Invalid logger configuration '{logger_level}': {e:?}");
|
||||||
|
eprintln!("Falling back to default configuration with level: {DEFAULT_LOG_LEVEL}");
|
||||||
|
}
|
||||||
flexi_logger::Logger::with(log_spec.clone())
|
flexi_logger::Logger::with(log_spec.clone())
|
||||||
})
|
})
|
||||||
.format_for_stderr(format_with_color)
|
.format_for_stderr(format_with_color)
|
||||||
|
.format_for_stdout(format_with_color)
|
||||||
.format_for_files(format_for_file)
|
.format_for_files(format_for_file)
|
||||||
.log_to_file(
|
.log_to_file(
|
||||||
FileSpec::default()
|
FileSpec::default()
|
||||||
@@ -371,7 +374,9 @@ fn init_file_logging(config: &OtelConfig, logger_level: &str, is_production: boo
|
|||||||
.suppress_timestamp(),
|
.suppress_timestamp(),
|
||||||
)
|
)
|
||||||
.rotate(rotation_criterion, Naming::TimestampsDirect, Cleanup::KeepLogFiles(keep_files))
|
.rotate(rotation_criterion, Naming::TimestampsDirect, Cleanup::KeepLogFiles(keep_files))
|
||||||
.write_mode(write_mode);
|
.write_mode(write_mode)
|
||||||
|
.append()
|
||||||
|
.use_utc();
|
||||||
|
|
||||||
// Optional copy to stdout (for local observation)
|
// Optional copy to stdout (for local observation)
|
||||||
if config.log_stdout_enabled.unwrap_or(DEFAULT_OBS_LOG_STDOUT_ENABLED) {
|
if config.log_stdout_enabled.unwrap_or(DEFAULT_OBS_LOG_STDOUT_ENABLED) {
|
||||||
|
|||||||
@@ -145,15 +145,15 @@ pub(crate) fn get_tokio_runtime_builder() -> tokio::runtime::Builder {
|
|||||||
)
|
)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if !rustfs_obs::is_production_environment() {
|
||||||
println!(
|
println!(
|
||||||
"Starting Tokio runtime with configured parameters:\n\
|
"Starting Tokio runtime with configured parameters:\n\
|
||||||
worker_threads: {worker_threads}, max_blocking_threads: {max_blocking_threads}, \
|
worker_threads: {worker_threads}, max_blocking_threads: {max_blocking_threads}, \
|
||||||
thread_stack_size: {thread_stack_size}, thread_keep_alive: {thread_keep_alive}, \
|
thread_stack_size: {thread_stack_size}, thread_keep_alive: {thread_keep_alive}, \
|
||||||
global_queue_interval: {global_queue_interval}, event_interval: {event_interval}, \
|
global_queue_interval: {global_queue_interval}, event_interval: {event_interval}, \
|
||||||
max_io_events_per_tick: {max_io_events_per_tick}, thread_name: {thread_name}"
|
max_io_events_per_tick: {max_io_events_per_tick}, thread_name: {thread_name}"
|
||||||
);
|
);
|
||||||
|
}
|
||||||
builder
|
builder
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -66,8 +66,8 @@ export RUSTFS_CONSOLE_ADDRESS=":9001"
|
|||||||
#export RUSTFS_OBS_SERVICE_VERSION=0.1.0 # Service version
|
#export RUSTFS_OBS_SERVICE_VERSION=0.1.0 # Service version
|
||||||
export RUSTFS_OBS_ENVIRONMENT=develop # Environment name
|
export RUSTFS_OBS_ENVIRONMENT=develop # Environment name
|
||||||
export RUSTFS_OBS_LOGGER_LEVEL=info # 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=true # 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"
|
||||||
export RUSTFS_OBS_LOG_ROTATION_SIZE_MB=100 # Log rotation size in MB
|
export RUSTFS_OBS_LOG_ROTATION_SIZE_MB=100 # Log rotation size in MB
|
||||||
export RUSTFS_OBS_LOG_POOL_CAPA=10240
|
export RUSTFS_OBS_LOG_POOL_CAPA=10240
|
||||||
|
|||||||
Reference in New Issue
Block a user