diff --git a/Cargo.lock b/Cargo.lock index 729e06d5..52e4c5e9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4472,9 +4472,9 @@ dependencies = [ [[package]] name = "iri-string" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbc5ebe9c3a1a7a5127f920a418f7585e9e758e911d0466ed004f393b0e380b2" +checksum = "4f867b9d1d896b67beb18518eda36fdb77a32ea590de864f1325b294a6d14397" dependencies = [ "memchr", "serde", @@ -6635,9 +6635,9 @@ dependencies = [ [[package]] name = "rmcp" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fdad1258f7259fdc0f2dfc266939c82c3b5d1fd72bcde274d600cdc27e60243" +checksum = "a2c66318b30535ccd0d3b39afaa4240d6b5a35328fb7672a28e3386c97472805" dependencies = [ "base64 0.22.1", "chrono", @@ -6656,9 +6656,9 @@ dependencies = [ [[package]] name = "rmcp-macros" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ede0589a208cc7ce81d1be68aa7e74b917fcd03c81528408bab0457e187dcd9b" +checksum = "49a19193e0d69bb1c96324b1b4daec078d4c8e76d734e53404c107437858a4d2" dependencies = [ "darling 0.21.3", "proc-macro2", diff --git a/Cargo.toml b/Cargo.toml index a7d5cdd6..6350c2f4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -129,7 +129,7 @@ flatbuffers = "25.9.23" form_urlencoded = "1.2.2" prost = "0.14.1" quick-xml = "0.38.3" -rmcp = { version = "0.8.3" } +rmcp = { version = "0.8.4" } rmp = { version = "0.8.14" } rmp-serde = { version = "1.3.0" } serde = { version = "1.0.228", features = ["derive"] } diff --git a/crates/ahm/src/heal/channel.rs b/crates/ahm/src/heal/channel.rs index 1b52f349..fc85e671 100644 --- a/crates/ahm/src/heal/channel.rs +++ b/crates/ahm/src/heal/channel.rs @@ -12,12 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::error::{Error, Result}; use crate::heal::{ manager::HealManager, task::{HealOptions, HealPriority, HealRequest, HealType}, utils, }; +use crate::{Error, Result}; use rustfs_common::heal_channel::{ HealChannelCommand, HealChannelPriority, HealChannelReceiver, HealChannelRequest, HealChannelResponse, HealScanMode, publish_heal_response, diff --git a/crates/ahm/src/heal/event.rs b/crates/ahm/src/heal/event.rs index 8e1f3b22..1711f2f9 100644 --- a/crates/ahm/src/heal/event.rs +++ b/crates/ahm/src/heal/event.rs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::heal::task::{HealOptions, HealPriority, HealRequest, HealType}; +use crate::heal::{HealOptions, HealPriority, HealRequest, HealType}; use crate::{Error, Result}; use rustfs_ecstore::disk::endpoint::Endpoint; use serde::{Deserialize, Serialize}; diff --git a/crates/ahm/src/heal/task.rs b/crates/ahm/src/heal/task.rs index 2a7ac4e1..0c7ef0f7 100644 --- a/crates/ahm/src/heal/task.rs +++ b/crates/ahm/src/heal/task.rs @@ -12,8 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::heal::ErasureSetHealer; -use crate::heal::{progress::HealProgress, storage::HealStorageAPI}; +use crate::heal::{ErasureSetHealer, progress::HealProgress, storage::HealStorageAPI}; use crate::{Error, Result}; use rustfs_common::heal_channel::{HealOpts, HealScanMode}; use serde::{Deserialize, Serialize}; diff --git a/crates/ahm/src/heal/utils.rs b/crates/ahm/src/heal/utils.rs index b4985e9c..5740216c 100644 --- a/crates/ahm/src/heal/utils.rs +++ b/crates/ahm/src/heal/utils.rs @@ -1,4 +1,18 @@ -use crate::error::{Error, Result}; +// Copyright 2024 RustFS Team +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use crate::{Error, Result}; /// Prefix for pool index in set disk identifiers. const POOL_PREFIX: &str = "pool"; diff --git a/crates/ahm/src/scanner/io_monitor.rs b/crates/ahm/src/scanner/io_monitor.rs index 0d5bbe3b..9a55a780 100644 --- a/crates/ahm/src/scanner/io_monitor.rs +++ b/crates/ahm/src/scanner/io_monitor.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +use crate::Result; +use crate::scanner::LoadLevel; use serde::{Deserialize, Serialize}; use std::{ collections::VecDeque, @@ -25,9 +27,6 @@ use tokio::sync::RwLock; use tokio_util::sync::CancellationToken; use tracing::{debug, error, info, warn}; -use super::node_scanner::LoadLevel; -use crate::error::Result; - /// IO monitor config #[derive(Debug, Clone)] pub struct IOMonitorConfig { diff --git a/crates/ahm/src/scanner/local_scan/mod.rs b/crates/ahm/src/scanner/local_scan/mod.rs index 97e4b687..7e31d711 100644 --- a/crates/ahm/src/scanner/local_scan/mod.rs +++ b/crates/ahm/src/scanner/local_scan/mod.rs @@ -1,16 +1,18 @@ -use std::collections::{HashMap, HashSet}; -use std::path::{Path, PathBuf}; -use std::sync::Arc; -use std::time::{SystemTime, UNIX_EPOCH}; - -use serde::{Deserialize, Serialize}; -use serde_json::{from_slice, to_vec}; -use tokio::{fs, task}; -use tracing::warn; -use walkdir::WalkDir; - -use crate::error::{Error, Result}; +// Copyright 2024 RustFS Team +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +use crate::{Error, Result}; use rustfs_common::data_usage::DiskUsageStatus; use rustfs_ecstore::data_usage::{ LocalUsageSnapshot, LocalUsageSnapshotMeta, data_usage_state_dir, ensure_data_usage_layout, snapshot_file_name, @@ -20,6 +22,15 @@ use rustfs_ecstore::disk::DiskAPI; use rustfs_ecstore::store::ECStore; use rustfs_ecstore::store_api::ObjectInfo; use rustfs_filemeta::{FileInfo, FileMeta, FileMetaVersion, VersionType}; +use serde::{Deserialize, Serialize}; +use serde_json::{from_slice, to_vec}; +use std::collections::{HashMap, HashSet}; +use std::path::{Path, PathBuf}; +use std::sync::Arc; +use std::time::{SystemTime, UNIX_EPOCH}; +use tokio::{fs, task}; +use tracing::warn; +use walkdir::WalkDir; const STATE_FILE_EXTENSION: &str = ""; diff --git a/crates/obs/src/telemetry.rs b/crates/obs/src/telemetry.rs index e145da71..4c7a1d3b 100644 --- a/crates/obs/src/telemetry.rs +++ b/crates/obs/src/telemetry.rs @@ -50,6 +50,7 @@ use std::io::IsTerminal; use std::time::Duration; use std::{env, fs}; use tracing::info; +use tracing_appender::rolling::{RollingFileAppender, Rotation}; use tracing_error::ErrorLayer; use tracing_opentelemetry::{MetricsLayer, OpenTelemetryLayer}; use tracing_subscriber::fmt::format::FmtSpan; @@ -363,7 +364,13 @@ pub(crate) fn init_telemetry(config: &OtelConfig) -> OtelGuard { if endpoint.is_empty() && !is_production { // Create a file appender (rolling by day), add the -tracing suffix to the file name to avoid conflicts - let file_appender = tracing_appender::rolling::hourly(log_directory, format!("{log_filename}-tracing.log")); + // let file_appender = tracing_appender::rolling::hourly(log_directory, format!("{log_filename}-tracing.log")); + let file_appender = RollingFileAppender::builder() + .rotation(Rotation::HOURLY) // rotate log files once every hour + .filename_prefix(format!("{log_filename}-tracing")) // log file names will be prefixed with `myapp.` + .filename_suffix("log") // log file names will be suffixed with `.log` + .build(log_directory) // try to build an appender that stores log files in `/var/log` + .expect("initializing rolling file appender failed"); let (nb_writer, guard) = tracing_appender::non_blocking(file_appender); let enable_color = std::io::stdout().is_terminal();