mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-24 13:16:28 +00:00
Merge branch 'main' of github.com:rustfs/rustfs into houseme/get-small-file-optimization
* 'main' of github.com:rustfs/rustfs: fix(ecstore): replace unwrap() with proper error handling in api_get_object_attributes (#729 batch 11) (#3991) fix(ecstore): improve expect() messages in admin_server_info (#729 batch 9) (#3990) fix(server): improve expect() messages in layer.rs (#729 batch 8) (#3989) fix(ecstore): improve expect() messages in replication_resyncer (#729 batch 7) (#3988) fix(admin): improve expect() messages in remaining admin handlers (#729 batch 6) (#3987) fix(admin): improve expect() messages in policies handler (#729 batch 5) (#3986) fix(admin): improve expect() messages in user handler (#729 batch 4) (#3985) fix(admin): replace unwrap() with safe pattern in bucket_meta handler (#729 batch 3) (#3984) feat(get): harden codec streaming rollout (#3981) fix(admin): replace unwrap() with proper error handling in tier handler (#729 batch 2) (#3983) # Conflicts: # crates/ecstore/src/set_disk/mod.rs
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
use crate::disk::error::DiskError;
|
||||
use crate::error::StorageError;
|
||||
use std::io;
|
||||
use std::time::Instant;
|
||||
|
||||
pub(crate) const GET_OBJECT_PATH_CODEC_STREAMING: &str = "codec_streaming";
|
||||
pub(crate) const GET_OBJECT_PATH_CODEC_STREAMING_LEGACY_ENGINE: &str = "codec_streaming_legacy_engine";
|
||||
@@ -174,6 +175,18 @@ pub(crate) fn record_get_object_pipeline_failure_for_path(
|
||||
rustfs_io_metrics::record_get_object_pipeline_failure_for_path(path, stage, reason.as_str());
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub(crate) fn get_stage_timer_if_enabled(stage_metrics_enabled: bool) -> Option<Instant> {
|
||||
stage_metrics_enabled.then(Instant::now)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub(crate) fn record_get_stage_duration_if_enabled(path: &'static str, stage: &'static str, started_at: Option<Instant>) {
|
||||
if let Some(started_at) = started_at {
|
||||
rustfs_io_metrics::record_get_object_stage_duration(path, stage, started_at.elapsed().as_secs_f64());
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user