mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-10 23:26:53 +00:00
feat(compression): show cluster-level compression stat in grafana (#4112)
This commit is contained in:
@@ -12,16 +12,21 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::init::{init_auto_tuner, init_update_check, print_server_info};
|
||||
use crate::startup_runtime_sources;
|
||||
use crate::storage_api::startup::storage::{ECStore, init_compression_total_memory_from_backend};
|
||||
use tokio_util::sync::CancellationToken;
|
||||
|
||||
pub(crate) async fn init_observability_runtime(ctx: CancellationToken) {
|
||||
pub(crate) async fn init_observability_runtime(store: Arc<ECStore>, ctx: CancellationToken) {
|
||||
print_server_info();
|
||||
init_update_check();
|
||||
crate::allocator_reclaim::init_allocator_reclaim(ctx.clone());
|
||||
|
||||
if startup_runtime_sources::observability_metric_enabled() {
|
||||
// Load persisted compression stats into memory early, before any PUTs can occur.
|
||||
init_compression_total_memory_from_backend(store).await;
|
||||
startup_runtime_sources::set_put_stage_metrics_enabled(true);
|
||||
startup_runtime_sources::set_get_stage_metrics_enabled(true);
|
||||
startup_runtime_sources::init_metrics_runtime(ctx.clone());
|
||||
|
||||
@@ -80,7 +80,7 @@ pub(crate) async fn init_startup_runtime_services(
|
||||
init_auth_integrations().await?;
|
||||
init_notification_runtime(endpoint_pools, buckets).await?;
|
||||
let enable_scanner = init_background_service_runtime(store.clone()).await?;
|
||||
init_observability_runtime(ctx.clone()).await;
|
||||
init_observability_runtime(store.clone(), ctx.clone()).await;
|
||||
|
||||
Ok(StartupServiceRuntime {
|
||||
optional_runtimes,
|
||||
|
||||
@@ -125,6 +125,17 @@ pub(crate) async fn run_startup_shutdown_sequence(
|
||||
);
|
||||
}
|
||||
|
||||
// Persist in-memory compression totals to backend before subsystems shut down.
|
||||
info!(
|
||||
target: "rustfs::main::handle_shutdown",
|
||||
event = "compression_total_persist",
|
||||
component = LOG_COMPONENT_MAIN,
|
||||
subsystem = LOG_SUBSYSTEM_STARTUP,
|
||||
state = "persisting",
|
||||
"Compression total persist started"
|
||||
);
|
||||
crate::storage_api::startup::shutdown::store_compression_total_in_backend().await;
|
||||
|
||||
let optional_runtime_shutdowns = prepare_optional_runtime_shutdowns(optional_runtimes);
|
||||
|
||||
info!(
|
||||
|
||||
@@ -347,10 +347,10 @@ pub(crate) mod ecstore_config {
|
||||
|
||||
pub(crate) mod ecstore_data_usage {
|
||||
pub(crate) use rustfs_ecstore::api::data_usage::{
|
||||
apply_bucket_usage_memory_overlay, load_data_usage_from_backend, record_bucket_delete_marker_memory,
|
||||
record_bucket_object_delete_memory, record_bucket_object_version_write_memory, record_bucket_object_write_memory,
|
||||
refresh_versioned_bucket_usage_from_object_layer, remove_bucket_usage_from_backend,
|
||||
replace_bucket_usage_memory_from_info,
|
||||
apply_bucket_usage_memory_overlay, init_compression_total_memory_from_backend, load_data_usage_from_backend,
|
||||
record_bucket_delete_marker_memory, record_bucket_object_delete_memory, record_bucket_object_version_write_memory,
|
||||
record_bucket_object_write_memory, refresh_versioned_bucket_usage_from_object_layer, remove_bucket_usage_from_backend,
|
||||
replace_bucket_usage_memory_from_info, store_compression_total_in_backend,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1238,3 +1238,11 @@ pub(crate) type GetObjectReader = <ECStore as contract::object::ObjectIO>::GetOb
|
||||
pub(crate) type ObjectInfo = <ECStore as contract::object::ObjectOperations>::ObjectInfo;
|
||||
pub(crate) type ObjectOptions = <ECStore as contract::object::ObjectOperations>::ObjectOptions;
|
||||
pub(crate) type PutObjReader = <ECStore as contract::object::ObjectIO>::PutObjectReader;
|
||||
|
||||
pub(crate) async fn store_compression_total_in_backend() {
|
||||
ecstore_data_usage::store_compression_total_in_backend().await;
|
||||
}
|
||||
|
||||
pub(crate) async fn init_compression_total_memory_from_backend(store: Arc<ECStore>) {
|
||||
ecstore_data_usage::init_compression_total_memory_from_backend(store).await
|
||||
}
|
||||
|
||||
@@ -210,14 +210,14 @@ pub(crate) mod startup {
|
||||
}
|
||||
|
||||
pub(crate) mod shutdown {
|
||||
pub(crate) use crate::storage::storage_api::shutdown_background_services;
|
||||
pub(crate) use crate::storage::storage_api::{shutdown_background_services, store_compression_total_in_backend};
|
||||
}
|
||||
|
||||
pub(crate) mod storage {
|
||||
pub(crate) use crate::storage::storage_api::{
|
||||
ECStore, EndpointServerPools, init_background_replication, init_ecstore_config, init_global_config_sys,
|
||||
init_local_disks, init_lock_clients, prewarm_local_disk_id_map, set_global_endpoints, try_migrate_server_config,
|
||||
update_erasure_type,
|
||||
ECStore, EndpointServerPools, init_background_replication, init_compression_total_memory_from_backend,
|
||||
init_ecstore_config, init_global_config_sys, init_local_disks, init_lock_clients, prewarm_local_disk_id_map,
|
||||
set_global_endpoints, try_migrate_server_config, update_erasure_type,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user