mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-21 20:06:37 +00:00
refactor: expose remaining external owner symbols (#3751)
This commit is contained in:
@@ -19,12 +19,21 @@ pub mod scheduler;
|
||||
pub mod schema;
|
||||
pub mod stats_collector;
|
||||
|
||||
pub(crate) use rustfs_ecstore::api::bucket as ecstore_bucket;
|
||||
pub(crate) use rustfs_ecstore::api::capacity as ecstore_capacity;
|
||||
pub(crate) use rustfs_ecstore::api::data_usage as ecstore_data_usage;
|
||||
pub(crate) use rustfs_ecstore::api::error as ecstore_error;
|
||||
pub(crate) use rustfs_ecstore::api::global as ecstore_global;
|
||||
pub(crate) use rustfs_ecstore::api::storage as ecstore_storage;
|
||||
pub(crate) use rustfs_ecstore::api::bucket::lifecycle::bucket_lifecycle_ops::{
|
||||
GLOBAL_ExpiryState as OBS_GLOBAL_EXPIRY_STATE, GLOBAL_TransitionState as OBS_GLOBAL_TRANSITION_STATE,
|
||||
};
|
||||
pub(crate) use rustfs_ecstore::api::bucket::metadata_sys::get_quota_config as obs_get_quota_config;
|
||||
pub(crate) use rustfs_ecstore::api::bucket::replication::GLOBAL_REPLICATION_STATS as OBS_GLOBAL_REPLICATION_STATS;
|
||||
pub(crate) use rustfs_ecstore::api::capacity::{
|
||||
get_total_usable_capacity as obs_get_total_usable_capacity,
|
||||
get_total_usable_capacity_free as obs_get_total_usable_capacity_free,
|
||||
};
|
||||
pub(crate) use rustfs_ecstore::api::data_usage::load_data_usage_from_backend as obs_load_data_usage_from_backend;
|
||||
pub(crate) use rustfs_ecstore::api::error::Result as ObsEcstoreResult;
|
||||
pub(crate) use rustfs_ecstore::api::global::{
|
||||
get_global_bucket_monitor as obs_get_global_bucket_monitor, resolve_object_store_handle as obs_resolve_object_store_handle,
|
||||
};
|
||||
pub(crate) use rustfs_ecstore::api::storage::ECStore as ObsStore;
|
||||
|
||||
pub use collectors::*;
|
||||
pub use config::*;
|
||||
|
||||
@@ -70,7 +70,7 @@ use crate::metrics::config::{
|
||||
ENV_BUCKET_REPLICATION_BANDWIDTH_METRICS_INTERVAL, ENV_CLUSTER_METRICS_INTERVAL, ENV_DEFAULT_METRICS_INTERVAL,
|
||||
ENV_NODE_METRICS_INTERVAL, ENV_NOTIFICATION_METRICS_INTERVAL, ENV_RESOURCE_METRICS_INTERVAL,
|
||||
};
|
||||
use crate::metrics::ecstore_global;
|
||||
use crate::metrics::obs_get_global_bucket_monitor;
|
||||
use crate::metrics::report::{PrometheusMetric, report_metrics};
|
||||
use crate::metrics::schema::bucket_replication::{
|
||||
BUCKET_L, BUCKET_REPL_BANDWIDTH_CURRENT_MD, BUCKET_REPL_BANDWIDTH_LIMIT_MD, TARGET_ARN_L,
|
||||
@@ -599,7 +599,7 @@ pub fn init_metrics_runtime(token: CancellationToken) {
|
||||
loop {
|
||||
tokio::select! {
|
||||
_ = interval.tick() => {
|
||||
let monitor_available = ecstore_global::get_global_bucket_monitor().is_some();
|
||||
let monitor_available = obs_get_global_bucket_monitor().is_some();
|
||||
let stats = collect_bucket_replication_bandwidth_stats();
|
||||
|
||||
let current_live_keys = repl_bw_live_keys(&stats);
|
||||
|
||||
@@ -26,7 +26,11 @@ use crate::metrics::collectors::{
|
||||
DriveDetailedStats, ErasureSetStats, HostNetworkStats, IamStats, IlmStats, MemoryStats, NetworkStats, ProcessStats,
|
||||
ProcessStatusType, ReplicationStats, ResourceStats, ScannerStats,
|
||||
};
|
||||
use crate::metrics::{ecstore_bucket, ecstore_capacity, ecstore_data_usage, ecstore_error, ecstore_global, ecstore_storage};
|
||||
use crate::metrics::{
|
||||
OBS_GLOBAL_EXPIRY_STATE, OBS_GLOBAL_REPLICATION_STATS, OBS_GLOBAL_TRANSITION_STATE, ObsEcstoreResult, ObsStore,
|
||||
obs_get_global_bucket_monitor, obs_get_quota_config, obs_get_total_usable_capacity, obs_get_total_usable_capacity_free,
|
||||
obs_load_data_usage_from_backend, obs_resolve_object_store_handle,
|
||||
};
|
||||
use chrono::Utc;
|
||||
use rustfs_common::heal_channel::HealScanMode;
|
||||
use rustfs_common::metrics::global_metrics;
|
||||
@@ -42,7 +46,6 @@ const LOG_COMPONENT_OBS: &str = "obs";
|
||||
const LOG_SUBSYSTEM_METRICS_COLLECTOR: &str = "metrics_collector";
|
||||
const EVENT_METRICS_COLLECTOR_STATE: &str = "metrics_collector_state";
|
||||
|
||||
type ObsStore = ecstore_storage::ECStore;
|
||||
type ObsStorageInfo = <ObsStore as StorageAdminApi>::StorageInfo;
|
||||
|
||||
struct ObsDataUsageInfo {
|
||||
@@ -95,8 +98,8 @@ fn i32_to_u64_floor_zero(value: i32) -> u64 {
|
||||
u64::try_from(value.max(0)).unwrap_or(0)
|
||||
}
|
||||
|
||||
async fn load_obs_data_usage_from_backend(store: Arc<ObsStore>) -> ecstore_error::Result<ObsDataUsageInfo> {
|
||||
let data_usage = ecstore_data_usage::load_data_usage_from_backend(store).await?;
|
||||
async fn load_obs_data_usage_from_backend(store: Arc<ObsStore>) -> ObsEcstoreResult<ObsDataUsageInfo> {
|
||||
let data_usage = obs_load_data_usage_from_backend(store).await?;
|
||||
|
||||
Ok(ObsDataUsageInfo {
|
||||
buckets_count: data_usage.buckets_count,
|
||||
@@ -125,19 +128,19 @@ async fn load_obs_data_usage_from_backend(store: Arc<ObsStore>) -> ecstore_error
|
||||
}
|
||||
|
||||
fn resolve_obs_object_store_handle() -> Option<Arc<ObsStore>> {
|
||||
ecstore_global::resolve_object_store_handle()
|
||||
obs_resolve_object_store_handle()
|
||||
}
|
||||
|
||||
fn obs_total_usable_capacity_bytes(storage_info: &ObsStorageInfo) -> u64 {
|
||||
usize_to_u64_saturating(ecstore_capacity::get_total_usable_capacity(&storage_info.disks, storage_info))
|
||||
usize_to_u64_saturating(obs_get_total_usable_capacity(&storage_info.disks, storage_info))
|
||||
}
|
||||
|
||||
fn obs_total_usable_capacity_free_bytes(storage_info: &ObsStorageInfo) -> u64 {
|
||||
usize_to_u64_saturating(ecstore_capacity::get_total_usable_capacity_free(&storage_info.disks, storage_info))
|
||||
usize_to_u64_saturating(obs_get_total_usable_capacity_free(&storage_info.disks, storage_info))
|
||||
}
|
||||
|
||||
async fn obs_bucket_quota_limit_bytes(bucket: &str) -> u64 {
|
||||
ecstore_bucket::metadata_sys::get_quota_config(bucket)
|
||||
obs_get_quota_config(bucket)
|
||||
.await
|
||||
.ok()
|
||||
.and_then(|(quota, _)| quota.get_quota_limit())
|
||||
@@ -145,7 +148,7 @@ async fn obs_bucket_quota_limit_bytes(bucket: &str) -> u64 {
|
||||
}
|
||||
|
||||
fn obs_bucket_replication_bandwidth_stats() -> Option<Vec<ObsBucketReplicationBandwidthStats>> {
|
||||
let monitor = ecstore_global::get_global_bucket_monitor()?;
|
||||
let monitor = obs_get_global_bucket_monitor()?;
|
||||
Some(
|
||||
monitor
|
||||
.get_report(|_| true)
|
||||
@@ -163,12 +166,10 @@ fn obs_bucket_replication_bandwidth_stats() -> Option<Vec<ObsBucketReplicationBa
|
||||
|
||||
async fn obs_ilm_runtime_snapshot() -> ObsIlmRuntimeSnapshot {
|
||||
let expiry_pending_tasks = {
|
||||
let expiry = ecstore_bucket::lifecycle::bucket_lifecycle_ops::GLOBAL_ExpiryState
|
||||
.read()
|
||||
.await;
|
||||
let expiry = OBS_GLOBAL_EXPIRY_STATE.read().await;
|
||||
usize_to_u64_saturating(expiry.pending_tasks())
|
||||
};
|
||||
let transition = &ecstore_bucket::lifecycle::bucket_lifecycle_ops::GLOBAL_TransitionState;
|
||||
let transition = &OBS_GLOBAL_TRANSITION_STATE;
|
||||
|
||||
ObsIlmRuntimeSnapshot {
|
||||
expiry_pending_tasks,
|
||||
@@ -183,7 +184,7 @@ async fn obs_ilm_runtime_snapshot() -> ObsIlmRuntimeSnapshot {
|
||||
}
|
||||
|
||||
async fn obs_bucket_replication_detail_stats() -> Vec<BucketReplicationStats> {
|
||||
let Some(stats) = ecstore_bucket::replication::GLOBAL_REPLICATION_STATS.get() else {
|
||||
let Some(stats) = OBS_GLOBAL_REPLICATION_STATS.get() else {
|
||||
return Vec::new();
|
||||
};
|
||||
|
||||
@@ -255,7 +256,7 @@ async fn obs_bucket_replication_detail_stats() -> Vec<BucketReplicationStats> {
|
||||
}
|
||||
|
||||
async fn obs_site_replication_stats() -> ReplicationStats {
|
||||
let Some(stats) = ecstore_bucket::replication::GLOBAL_REPLICATION_STATS.get() else {
|
||||
let Some(stats) = OBS_GLOBAL_REPLICATION_STATS.get() else {
|
||||
return ReplicationStats::default();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user