improve comment and error

This commit is contained in:
houseme
2025-05-16 17:00:56 +08:00
parent 60635aeb65
commit 6659b77f9a
29 changed files with 228 additions and 235 deletions
-1
View File
@@ -1,7 +1,6 @@
/// bucket level s3 metric descriptor /// bucket level s3 metric descriptor
use crate::metrics::{new_counter_md, new_gauge_md, new_histogram_md, subsystems, MetricDescriptor, MetricName}; use crate::metrics::{new_counter_md, new_gauge_md, new_histogram_md, subsystems, MetricDescriptor, MetricName};
lazy_static::lazy_static! { lazy_static::lazy_static! {
pub static ref BUCKET_API_TRAFFIC_SENT_BYTES_MD: MetricDescriptor = pub static ref BUCKET_API_TRAFFIC_SENT_BYTES_MD: MetricDescriptor =
new_counter_md( new_counter_md(
+4 -1
View File
@@ -1,10 +1,13 @@
/// Bucket copy metric descriptor /// Bucket copy metric descriptor
use crate::metrics::{new_counter_md, new_gauge_md, subsystems, MetricDescriptor, MetricName}; use crate::metrics::{new_counter_md, new_gauge_md, subsystems, MetricDescriptor, MetricName};
// Label constants /// Bucket level replication metric descriptor
pub const BUCKET_L: &str = "bucket"; pub const BUCKET_L: &str = "bucket";
/// Replication operation
pub const OPERATION_L: &str = "operation"; pub const OPERATION_L: &str = "operation";
/// Replication target ARN
pub const TARGET_ARN_L: &str = "targetArn"; pub const TARGET_ARN_L: &str = "targetArn";
/// Replication range
pub const RANGE_L: &str = "range"; pub const RANGE_L: &str = "range";
lazy_static::lazy_static! { lazy_static::lazy_static! {
+3 -3
View File
@@ -1,12 +1,12 @@
/// Metric descriptors related to cluster configuration
use crate::metrics::{new_gauge_md, subsystems, MetricDescriptor, MetricName}; use crate::metrics::{new_gauge_md, subsystems, MetricDescriptor, MetricName};
/// 集群配置相关指标描述符
lazy_static::lazy_static! { lazy_static::lazy_static! {
pub static ref CONFIG_RRS_PARITY_MD: MetricDescriptor = pub static ref CONFIG_RRS_PARITY_MD: MetricDescriptor =
new_gauge_md( new_gauge_md(
MetricName::ConfigRRSParity, MetricName::ConfigRRSParity,
"Reduced redundancy storage class parity", "Reduced redundancy storage class parity",
&[], // 无标签 &[],
subsystems::CLUSTER_CONFIG subsystems::CLUSTER_CONFIG
); );
@@ -14,7 +14,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::ConfigStandardParity, MetricName::ConfigStandardParity,
"Standard storage class parity", "Standard storage class parity",
&[], // 无标签 &[],
subsystems::CLUSTER_CONFIG subsystems::CLUSTER_CONFIG
); );
} }
@@ -1,16 +1,17 @@
/// Erasure code set related metric descriptors
use crate::metrics::{new_gauge_md, subsystems, MetricDescriptor, MetricName}; use crate::metrics::{new_gauge_md, subsystems, MetricDescriptor, MetricName};
// 定义标签常量 /// The label for the pool ID
pub const POOL_ID_L: &str = "pool_id"; pub const POOL_ID_L: &str = "pool_id";
/// The label for the pool ID
pub const SET_ID_L: &str = "set_id"; pub const SET_ID_L: &str = "set_id";
/// 纠删码集合相关指标描述符
lazy_static::lazy_static! { lazy_static::lazy_static! {
pub static ref ERASURE_SET_OVERALL_WRITE_QUORUM_MD: MetricDescriptor = pub static ref ERASURE_SET_OVERALL_WRITE_QUORUM_MD: MetricDescriptor =
new_gauge_md( new_gauge_md(
MetricName::ErasureSetOverallWriteQuorum, MetricName::ErasureSetOverallWriteQuorum,
"Overall write quorum across pools and sets", "Overall write quorum across pools and sets",
&[], // 无标签 &[],
subsystems::CLUSTER_ERASURE_SET subsystems::CLUSTER_ERASURE_SET
); );
@@ -18,7 +19,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::ErasureSetOverallHealth, MetricName::ErasureSetOverallHealth,
"Overall health across pools and sets (1=healthy, 0=unhealthy)", "Overall health across pools and sets (1=healthy, 0=unhealthy)",
&[], // 无标签 &[],
subsystems::CLUSTER_ERASURE_SET subsystems::CLUSTER_ERASURE_SET
); );
+4 -4
View File
@@ -1,12 +1,12 @@
/// Cluster health-related metric descriptors
use crate::metrics::{new_gauge_md, subsystems, MetricDescriptor, MetricName}; use crate::metrics::{new_gauge_md, subsystems, MetricDescriptor, MetricName};
/// 集群健康相关指标描述符
lazy_static::lazy_static! { lazy_static::lazy_static! {
pub static ref HEALTH_DRIVES_OFFLINE_COUNT_MD: MetricDescriptor = pub static ref HEALTH_DRIVES_OFFLINE_COUNT_MD: MetricDescriptor =
new_gauge_md( new_gauge_md(
MetricName::HealthDrivesOfflineCount, MetricName::HealthDrivesOfflineCount,
"Count of offline drives in the cluster", "Count of offline drives in the cluster",
&[], // 无标签 &[],
subsystems::CLUSTER_HEALTH subsystems::CLUSTER_HEALTH
); );
@@ -14,7 +14,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::HealthDrivesOnlineCount, MetricName::HealthDrivesOnlineCount,
"Count of online drives in the cluster", "Count of online drives in the cluster",
&[], // 无标签 &[],
subsystems::CLUSTER_HEALTH subsystems::CLUSTER_HEALTH
); );
@@ -22,7 +22,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::HealthDrivesCount, MetricName::HealthDrivesCount,
"Count of all drives in the cluster", "Count of all drives in the cluster",
&[], // 无标签 &[],
subsystems::CLUSTER_HEALTH subsystems::CLUSTER_HEALTH
); );
} }
+11 -11
View File
@@ -1,12 +1,12 @@
/// IAM related metric descriptors
use crate::metrics::{new_counter_md, subsystems, MetricDescriptor, MetricName}; use crate::metrics::{new_counter_md, subsystems, MetricDescriptor, MetricName};
/// IAM 相关指标描述符
lazy_static::lazy_static! { lazy_static::lazy_static! {
pub static ref LAST_SYNC_DURATION_MILLIS_MD: MetricDescriptor = pub static ref LAST_SYNC_DURATION_MILLIS_MD: MetricDescriptor =
new_counter_md( new_counter_md(
MetricName::LastSyncDurationMillis, MetricName::LastSyncDurationMillis,
"Last successful IAM data sync duration in milliseconds", "Last successful IAM data sync duration in milliseconds",
&[], // 无标签 &[],
subsystems::CLUSTER_IAM subsystems::CLUSTER_IAM
); );
@@ -14,7 +14,7 @@ lazy_static::lazy_static! {
new_counter_md( new_counter_md(
MetricName::PluginAuthnServiceFailedRequestsMinute, MetricName::PluginAuthnServiceFailedRequestsMinute,
"When plugin authentication is configured, returns failed requests count in the last full minute", "When plugin authentication is configured, returns failed requests count in the last full minute",
&[], // 无标签 &[],
subsystems::CLUSTER_IAM subsystems::CLUSTER_IAM
); );
@@ -22,7 +22,7 @@ lazy_static::lazy_static! {
new_counter_md( new_counter_md(
MetricName::PluginAuthnServiceLastFailSeconds, MetricName::PluginAuthnServiceLastFailSeconds,
"When plugin authentication is configured, returns time (in seconds) since the last failed request to the service", "When plugin authentication is configured, returns time (in seconds) since the last failed request to the service",
&[], // 无标签 &[],
subsystems::CLUSTER_IAM subsystems::CLUSTER_IAM
); );
@@ -30,7 +30,7 @@ lazy_static::lazy_static! {
new_counter_md( new_counter_md(
MetricName::PluginAuthnServiceLastSuccSeconds, MetricName::PluginAuthnServiceLastSuccSeconds,
"When plugin authentication is configured, returns time (in seconds) since the last successful request to the service", "When plugin authentication is configured, returns time (in seconds) since the last successful request to the service",
&[], // 无标签 &[],
subsystems::CLUSTER_IAM subsystems::CLUSTER_IAM
); );
@@ -38,7 +38,7 @@ lazy_static::lazy_static! {
new_counter_md( new_counter_md(
MetricName::PluginAuthnServiceSuccAvgRttMsMinute, MetricName::PluginAuthnServiceSuccAvgRttMsMinute,
"When plugin authentication is configured, returns average round-trip-time of successful requests in the last full minute", "When plugin authentication is configured, returns average round-trip-time of successful requests in the last full minute",
&[], // 无标签 &[],
subsystems::CLUSTER_IAM subsystems::CLUSTER_IAM
); );
@@ -46,7 +46,7 @@ lazy_static::lazy_static! {
new_counter_md( new_counter_md(
MetricName::PluginAuthnServiceSuccMaxRttMsMinute, MetricName::PluginAuthnServiceSuccMaxRttMsMinute,
"When plugin authentication is configured, returns maximum round-trip-time of successful requests in the last full minute", "When plugin authentication is configured, returns maximum round-trip-time of successful requests in the last full minute",
&[], // 无标签 &[],
subsystems::CLUSTER_IAM subsystems::CLUSTER_IAM
); );
@@ -54,7 +54,7 @@ lazy_static::lazy_static! {
new_counter_md( new_counter_md(
MetricName::PluginAuthnServiceTotalRequestsMinute, MetricName::PluginAuthnServiceTotalRequestsMinute,
"When plugin authentication is configured, returns total requests count in the last full minute", "When plugin authentication is configured, returns total requests count in the last full minute",
&[], // 无标签 &[],
subsystems::CLUSTER_IAM subsystems::CLUSTER_IAM
); );
@@ -62,7 +62,7 @@ lazy_static::lazy_static! {
new_counter_md( new_counter_md(
MetricName::SinceLastSyncMillis, MetricName::SinceLastSyncMillis,
"Time (in milliseconds) since last successful IAM data sync.", "Time (in milliseconds) since last successful IAM data sync.",
&[], // 无标签 &[],
subsystems::CLUSTER_IAM subsystems::CLUSTER_IAM
); );
@@ -70,7 +70,7 @@ lazy_static::lazy_static! {
new_counter_md( new_counter_md(
MetricName::SyncFailures, MetricName::SyncFailures,
"Number of failed IAM data syncs since server start.", "Number of failed IAM data syncs since server start.",
&[], // 无标签 &[],
subsystems::CLUSTER_IAM subsystems::CLUSTER_IAM
); );
@@ -78,7 +78,7 @@ lazy_static::lazy_static! {
new_counter_md( new_counter_md(
MetricName::SyncSuccesses, MetricName::SyncSuccesses,
"Number of successful IAM data syncs since server start.", "Number of successful IAM data syncs since server start.",
&[], // 无标签 &[],
subsystems::CLUSTER_IAM subsystems::CLUSTER_IAM
); );
} }
@@ -1,12 +1,12 @@
/// Notify the relevant metric descriptor
use crate::metrics::{new_counter_md, subsystems, MetricDescriptor, MetricName}; use crate::metrics::{new_counter_md, subsystems, MetricDescriptor, MetricName};
/// 通知相关指标描述符
lazy_static::lazy_static! { lazy_static::lazy_static! {
pub static ref NOTIFICATION_CURRENT_SEND_IN_PROGRESS_MD: MetricDescriptor = pub static ref NOTIFICATION_CURRENT_SEND_IN_PROGRESS_MD: MetricDescriptor =
new_counter_md( new_counter_md(
MetricName::NotificationCurrentSendInProgress, MetricName::NotificationCurrentSendInProgress,
"Number of concurrent async Send calls active to all targets", "Number of concurrent async Send calls active to all targets",
&[], // 无标签 &[],
subsystems::NOTIFICATION subsystems::NOTIFICATION
); );
@@ -14,7 +14,7 @@ lazy_static::lazy_static! {
new_counter_md( new_counter_md(
MetricName::NotificationEventsErrorsTotal, MetricName::NotificationEventsErrorsTotal,
"Events that were failed to be sent to the targets", "Events that were failed to be sent to the targets",
&[], // 无标签 &[],
subsystems::NOTIFICATION subsystems::NOTIFICATION
); );
@@ -22,7 +22,7 @@ lazy_static::lazy_static! {
new_counter_md( new_counter_md(
MetricName::NotificationEventsSentTotal, MetricName::NotificationEventsSentTotal,
"Total number of events sent to the targets", "Total number of events sent to the targets",
&[], // 无标签 &[],
subsystems::NOTIFICATION subsystems::NOTIFICATION
); );
@@ -30,7 +30,7 @@ lazy_static::lazy_static! {
new_counter_md( new_counter_md(
MetricName::NotificationEventsSkippedTotal, MetricName::NotificationEventsSkippedTotal,
"Events that were skipped to be sent to the targets due to the in-memory queue being full", "Events that were skipped to be sent to the targets due to the in-memory queue being full",
&[], // 无标签 &[],
subsystems::NOTIFICATION subsystems::NOTIFICATION
); );
} }
+14 -14
View File
@@ -1,12 +1,17 @@
/// Descriptors of metrics related to cluster object and bucket usage
use crate::metrics::{new_gauge_md, subsystems, MetricDescriptor, MetricName}; use crate::metrics::{new_gauge_md, subsystems, MetricDescriptor, MetricName};
/// 集群对象使用情况相关指标描述符 /// Bucket labels
pub const BUCKET_LABEL: &str = "bucket";
/// Range labels
pub const RANGE_LABEL: &str = "range";
lazy_static::lazy_static! { lazy_static::lazy_static! {
pub static ref USAGE_SINCE_LAST_UPDATE_SECONDS_MD: MetricDescriptor = pub static ref USAGE_SINCE_LAST_UPDATE_SECONDS_MD: MetricDescriptor =
new_gauge_md( new_gauge_md(
MetricName::UsageSinceLastUpdateSeconds, MetricName::UsageSinceLastUpdateSeconds,
"Time since last update of usage metrics in seconds", "Time since last update of usage metrics in seconds",
&[], // 无标签 &[],
subsystems::CLUSTER_USAGE_OBJECTS subsystems::CLUSTER_USAGE_OBJECTS
); );
@@ -14,7 +19,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::UsageTotalBytes, MetricName::UsageTotalBytes,
"Total cluster usage in bytes", "Total cluster usage in bytes",
&[], // 无标签 &[],
subsystems::CLUSTER_USAGE_OBJECTS subsystems::CLUSTER_USAGE_OBJECTS
); );
@@ -22,7 +27,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::UsageObjectsCount, MetricName::UsageObjectsCount,
"Total cluster objects count", "Total cluster objects count",
&[], // 无标签 &[],
subsystems::CLUSTER_USAGE_OBJECTS subsystems::CLUSTER_USAGE_OBJECTS
); );
@@ -30,7 +35,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::UsageVersionsCount, MetricName::UsageVersionsCount,
"Total cluster object versions (including delete markers) count", "Total cluster object versions (including delete markers) count",
&[], // 无标签 &[],
subsystems::CLUSTER_USAGE_OBJECTS subsystems::CLUSTER_USAGE_OBJECTS
); );
@@ -38,7 +43,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::UsageDeleteMarkersCount, MetricName::UsageDeleteMarkersCount,
"Total cluster delete markers count", "Total cluster delete markers count",
&[], // 无标签 &[],
subsystems::CLUSTER_USAGE_OBJECTS subsystems::CLUSTER_USAGE_OBJECTS
); );
@@ -46,7 +51,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::UsageBucketsCount, MetricName::UsageBucketsCount,
"Total cluster buckets count", "Total cluster buckets count",
&[], // 无标签 &[],
subsystems::CLUSTER_USAGE_OBJECTS subsystems::CLUSTER_USAGE_OBJECTS
); );
@@ -54,7 +59,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::UsageSizeDistribution, MetricName::UsageSizeDistribution,
"Cluster object size distribution", "Cluster object size distribution",
&["range"], // 标签 &[RANGE_LABEL],
subsystems::CLUSTER_USAGE_OBJECTS subsystems::CLUSTER_USAGE_OBJECTS
); );
@@ -62,16 +67,11 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::UsageVersionCountDistribution, MetricName::UsageVersionCountDistribution,
"Cluster object version count distribution", "Cluster object version count distribution",
&["range"], // 标签 &[RANGE_LABEL],
subsystems::CLUSTER_USAGE_OBJECTS subsystems::CLUSTER_USAGE_OBJECTS
); );
} }
/// 定义常量
pub const BUCKET_LABEL: &str = "bucket";
pub const RANGE_LABEL: &str = "range";
/// 桶使用情况相关指标描述符
lazy_static::lazy_static! { lazy_static::lazy_static! {
pub static ref USAGE_BUCKET_TOTAL_BYTES_MD: MetricDescriptor = pub static ref USAGE_BUCKET_TOTAL_BYTES_MD: MetricDescriptor =
new_gauge_md( new_gauge_md(
+9 -9
View File
@@ -1,7 +1,7 @@
use crate::metrics::{MetricName, MetricNamespace, MetricSubsystem, MetricType}; use crate::metrics::{MetricName, MetricNamespace, MetricSubsystem, MetricType};
use std::collections::HashSet; use std::collections::HashSet;
/// MetricDescriptor - 指标描述符 /// MetricDescriptor - Metric descriptors
#[allow(dead_code)] #[allow(dead_code)]
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct MetricDescriptor { pub struct MetricDescriptor {
@@ -10,21 +10,21 @@ pub struct MetricDescriptor {
pub help: String, pub help: String,
pub variable_labels: Vec<String>, pub variable_labels: Vec<String>,
pub namespace: MetricNamespace, pub namespace: MetricNamespace,
pub subsystem: MetricSubsystem, // 从 String 修改为 MetricSubsystem pub subsystem: MetricSubsystem,
// 内部管理值 // Internal management values
label_set: Option<HashSet<String>>, label_set: Option<HashSet<String>>,
} }
impl MetricDescriptor { impl MetricDescriptor {
/// 创建新的指标描述符 /// Create a new metric descriptor
pub fn new( pub fn new(
name: MetricName, name: MetricName,
metric_type: MetricType, metric_type: MetricType,
help: String, help: String,
variable_labels: Vec<String>, variable_labels: Vec<String>,
namespace: MetricNamespace, namespace: MetricNamespace,
subsystem: impl Into<MetricSubsystem>, // 修改参数类型 subsystem: impl Into<MetricSubsystem>, // Modify the parameter type
) -> Self { ) -> Self {
Self { Self {
name, name,
@@ -37,23 +37,23 @@ impl MetricDescriptor {
} }
} }
/// 获取完整的指标名称,包含前缀和格式化路径 /// Get the full metric name, including the prefix and formatting path
#[allow(dead_code)] #[allow(dead_code)]
pub fn get_full_metric_name(&self) -> String { pub fn get_full_metric_name(&self) -> String {
let prefix = self.metric_type.to_prom(); let prefix = self.metric_type.as_prom();
let namespace = self.namespace.as_str(); let namespace = self.namespace.as_str();
let formatted_subsystem = self.subsystem.as_str(); let formatted_subsystem = self.subsystem.as_str();
format!("{}{}_{}_{}", prefix, namespace, formatted_subsystem, self.name.as_str()) format!("{}{}_{}_{}", prefix, namespace, formatted_subsystem, self.name.as_str())
} }
/// 检查标签是否在标签集中 /// check whether the label is in the label set
#[allow(dead_code)] #[allow(dead_code)]
pub fn has_label(&mut self, label: &str) -> bool { pub fn has_label(&mut self, label: &str) -> bool {
self.get_label_set().contains(label) self.get_label_set().contains(label)
} }
/// 获取标签集合,如果不存在则创建 /// Gets a collection of tags and creates them if they don't exist
pub fn get_label_set(&mut self) -> &HashSet<String> { pub fn get_label_set(&mut self) -> &HashSet<String> {
if self.label_set.is_none() { if self.label_set.is_none() {
let mut set = HashSet::with_capacity(self.variable_labels.len()); let mut set = HashSet::with_capacity(self.variable_labels.len());
+54 -54
View File
@@ -2,7 +2,7 @@
#[allow(dead_code)] #[allow(dead_code)]
#[derive(Debug, Clone, PartialEq, Eq)] #[derive(Debug, Clone, PartialEq, Eq)]
pub enum MetricName { pub enum MetricName {
// 通用指标名称 // The generic metric name
AuthTotal, AuthTotal,
CanceledTotal, CanceledTotal,
ErrorsTotal, ErrorsTotal,
@@ -27,7 +27,7 @@ pub enum MetricName {
Total, Total,
FreeInodes, FreeInodes,
// 失败统计指标 // Failure statistical metrics
LastMinFailedCount, LastMinFailedCount,
LastMinFailedBytes, LastMinFailedBytes,
LastHourFailedCount, LastHourFailedCount,
@@ -35,7 +35,7 @@ pub enum MetricName {
TotalFailedCount, TotalFailedCount,
TotalFailedBytes, TotalFailedBytes,
// 工作线程指标 // Worker metrics
CurrActiveWorkers, CurrActiveWorkers,
AvgActiveWorkers, AvgActiveWorkers,
MaxActiveWorkers, MaxActiveWorkers,
@@ -49,23 +49,23 @@ pub enum MetricName {
MaxTransferRate, MaxTransferRate,
CredentialErrors, CredentialErrors,
// 链接延迟指标 // Link latency metrics
CurrLinkLatency, CurrLinkLatency,
AvgLinkLatency, AvgLinkLatency,
MaxLinkLatency, MaxLinkLatency,
// 链接状态指标 // Link status metrics
LinkOnline, LinkOnline,
LinkOfflineDuration, LinkOfflineDuration,
LinkDowntimeTotalDuration, LinkDowntimeTotalDuration,
// 队列指标 // Queue metrics
AvgInQueueCount, AvgInQueueCount,
AvgInQueueBytes, AvgInQueueBytes,
MaxInQueueCount, MaxInQueueCount,
MaxInQueueBytes, MaxInQueueBytes,
// 代理请求指标 // Proxy request metrics
ProxiedGetRequestsTotal, ProxiedGetRequestsTotal,
ProxiedHeadRequestsTotal, ProxiedHeadRequestsTotal,
ProxiedPutTaggingRequestsTotal, ProxiedPutTaggingRequestsTotal,
@@ -77,7 +77,7 @@ pub enum MetricName {
ProxiedGetTaggingRequestFailures, ProxiedGetTaggingRequestFailures,
ProxiedDeleteTaggingRequestFailures, ProxiedDeleteTaggingRequestFailures,
// 字节相关指标 // Byte-related metrics
FreeBytes, FreeBytes,
ReadBytes, ReadBytes,
RcharBytes, RcharBytes,
@@ -89,22 +89,22 @@ pub enum MetricName {
WriteBytes, WriteBytes,
WcharBytes, WcharBytes,
// 延迟指标 // Latency metrics
LatencyMicroSec, LatencyMicroSec,
LatencyNanoSec, LatencyNanoSec,
// 信息指标 // Information metrics
CommitInfo, CommitInfo,
UsageInfo, UsageInfo,
VersionInfo, VersionInfo,
// 分布指标 // Distribution metrics
SizeDistribution, SizeDistribution,
VersionDistribution, VersionDistribution,
TtfbDistribution, TtfbDistribution,
TtlbDistribution, TtlbDistribution,
// 时间指标 // Time metrics
LastActivityTime, LastActivityTime,
StartTime, StartTime,
UpTime, UpTime,
@@ -112,7 +112,7 @@ pub enum MetricName {
Vmemory, Vmemory,
Cpu, Cpu,
// 过期和转换指标 // Expiration and conversion metrics
ExpiryMissedTasks, ExpiryMissedTasks,
ExpiryMissedFreeVersions, ExpiryMissedFreeVersions,
ExpiryMissedTierJournalTasks, ExpiryMissedTierJournalTasks,
@@ -122,18 +122,18 @@ pub enum MetricName {
TransitionedObjects, TransitionedObjects,
TransitionedVersions, TransitionedVersions,
// Tier 请求指标 //Tier request metrics
TierRequestsSuccess, TierRequestsSuccess,
TierRequestsFailure, TierRequestsFailure,
// KMS 指标 // KMS metrics
KmsOnline, KmsOnline,
KmsRequestsSuccess, KmsRequestsSuccess,
KmsRequestsError, KmsRequestsError,
KmsRequestsFail, KmsRequestsFail,
KmsUptime, KmsUptime,
// Webhook 指标 // Webhook metrics
WebhookOnline, WebhookOnline,
// API 拒绝指标 // API 拒绝指标
@@ -142,7 +142,7 @@ pub enum MetricName {
ApiRejectedTimestampTotal, ApiRejectedTimestampTotal,
ApiRejectedInvalidTotal, ApiRejectedInvalidTotal,
// API 请求指标 //API request metrics
ApiRequestsWaitingTotal, ApiRequestsWaitingTotal,
ApiRequestsIncomingTotal, ApiRequestsIncomingTotal,
ApiRequestsInFlightTotal, ApiRequestsInFlightTotal,
@@ -152,23 +152,23 @@ pub enum MetricName {
ApiRequests4xxErrorsTotal, ApiRequests4xxErrorsTotal,
ApiRequestsCanceledTotal, ApiRequestsCanceledTotal,
// API 分布指标 // API distribution metrics
ApiRequestsTTFBSecondsDistribution, ApiRequestsTTFBSecondsDistribution,
// API 流量指标 // API traffic metrics
ApiTrafficSentBytes, ApiTrafficSentBytes,
ApiTrafficRecvBytes, ApiTrafficRecvBytes,
// 审计指标 // Audit metrics
AuditFailedMessages, AuditFailedMessages,
AuditTargetQueueLength, AuditTargetQueueLength,
AuditTotalMessages, AuditTotalMessages,
// 集群配置相关指标 // Metrics related to cluster configurations
ConfigRRSParity, ConfigRRSParity,
ConfigStandardParity, ConfigStandardParity,
// 纠删码集合相关指标 // Erasure coding set related metrics
ErasureSetOverallWriteQuorum, ErasureSetOverallWriteQuorum,
ErasureSetOverallHealth, ErasureSetOverallHealth,
ErasureSetReadQuorum, ErasureSetReadQuorum,
@@ -181,12 +181,12 @@ pub enum MetricName {
ErasureSetReadHealth, ErasureSetReadHealth,
ErasureSetWriteHealth, ErasureSetWriteHealth,
// 集群健康相关指标 // Cluster health-related metrics
HealthDrivesOfflineCount, HealthDrivesOfflineCount,
HealthDrivesOnlineCount, HealthDrivesOnlineCount,
HealthDrivesCount, HealthDrivesCount,
// IAM 相关指标 // IAM-related metrics
LastSyncDurationMillis, LastSyncDurationMillis,
PluginAuthnServiceFailedRequestsMinute, PluginAuthnServiceFailedRequestsMinute,
PluginAuthnServiceLastFailSeconds, PluginAuthnServiceLastFailSeconds,
@@ -198,13 +198,13 @@ pub enum MetricName {
SyncFailures, SyncFailures,
SyncSuccesses, SyncSuccesses,
// 通知相关指标 // Notify relevant metrics
NotificationCurrentSendInProgress, NotificationCurrentSendInProgress,
NotificationEventsErrorsTotal, NotificationEventsErrorsTotal,
NotificationEventsSentTotal, NotificationEventsSentTotal,
NotificationEventsSkippedTotal, NotificationEventsSkippedTotal,
// 集群对象使用情况相关指标 // Metrics related to the usage of cluster objects
UsageSinceLastUpdateSeconds, UsageSinceLastUpdateSeconds,
UsageTotalBytes, UsageTotalBytes,
UsageObjectsCount, UsageObjectsCount,
@@ -214,7 +214,7 @@ pub enum MetricName {
UsageSizeDistribution, UsageSizeDistribution,
UsageVersionCountDistribution, UsageVersionCountDistribution,
// 桶使用情况相关指标 // Metrics related to bucket usage
UsageBucketQuotaTotalBytes, UsageBucketQuotaTotalBytes,
UsageBucketTotalBytes, UsageBucketTotalBytes,
UsageBucketObjectsCount, UsageBucketObjectsCount,
@@ -223,19 +223,19 @@ pub enum MetricName {
UsageBucketObjectSizeDistribution, UsageBucketObjectSizeDistribution,
UsageBucketObjectVersionCountDistribution, UsageBucketObjectVersionCountDistribution,
// ILM 相关指标 // ILM-related metrics
IlmExpiryPendingTasks, IlmExpiryPendingTasks,
IlmTransitionActiveTasks, IlmTransitionActiveTasks,
IlmTransitionPendingTasks, IlmTransitionPendingTasks,
IlmTransitionMissedImmediateTasks, IlmTransitionMissedImmediateTasks,
IlmVersionsScanned, IlmVersionsScanned,
// Webhook 日志相关指标 // Webhook logs
WebhookQueueLength, WebhookQueueLength,
WebhookTotalMessages, WebhookTotalMessages,
WebhookFailedMessages, WebhookFailedMessages,
// 复制相关指标 // Copy the relevant metrics
ReplicationAverageActiveWorkers, ReplicationAverageActiveWorkers,
ReplicationAverageQueuedBytes, ReplicationAverageQueuedBytes,
ReplicationAverageQueuedCount, ReplicationAverageQueuedCount,
@@ -250,7 +250,7 @@ pub enum MetricName {
ReplicationMaxDataTransferRate, ReplicationMaxDataTransferRate,
ReplicationRecentBacklogCount, ReplicationRecentBacklogCount,
// 扫描器相关指标 // Scanner-related metrics
ScannerBucketScansFinished, ScannerBucketScansFinished,
ScannerBucketScansStarted, ScannerBucketScansStarted,
ScannerDirectoriesScanned, ScannerDirectoriesScanned,
@@ -258,7 +258,7 @@ pub enum MetricName {
ScannerVersionsScanned, ScannerVersionsScanned,
ScannerLastActivitySeconds, ScannerLastActivitySeconds,
// CPU 系统相关指标 // CPU system-related metrics
SysCPUAvgIdle, SysCPUAvgIdle,
SysCPUAvgIOWait, SysCPUAvgIOWait,
SysCPULoad, SysCPULoad,
@@ -268,7 +268,7 @@ pub enum MetricName {
SysCPUSystem, SysCPUSystem,
SysCPUUser, SysCPUUser,
// 驱动器相关指标 // Drive-related metrics
DriveUsedBytes, DriveUsedBytes,
DriveFreeBytes, DriveFreeBytes,
DriveTotalBytes, DriveTotalBytes,
@@ -286,7 +286,7 @@ pub enum MetricName {
DriveOnlineCount, DriveOnlineCount,
DriveCount, DriveCount,
// iostat 相关指标 // iostat related metrics
DriveReadsPerSec, DriveReadsPerSec,
DriveReadsKBPerSec, DriveReadsKBPerSec,
DriveReadsAwait, DriveReadsAwait,
@@ -295,7 +295,7 @@ pub enum MetricName {
DriveWritesAwait, DriveWritesAwait,
DrivePercUtil, DrivePercUtil,
// 内存相关指标 // Memory-related metrics
MemTotal, MemTotal,
MemUsed, MemUsed,
MemUsedPerc, MemUsedPerc,
@@ -305,14 +305,14 @@ pub enum MetricName {
MemShared, MemShared,
MemAvailable, MemAvailable,
// 网络相关指标 // Network-related metrics
InternodeErrorsTotal, InternodeErrorsTotal,
InternodeDialErrorsTotal, InternodeDialErrorsTotal,
InternodeDialAvgTimeNanos, InternodeDialAvgTimeNanos,
InternodeSentBytesTotal, InternodeSentBytesTotal,
InternodeRecvBytesTotal, InternodeRecvBytesTotal,
// 进程相关指标 // Process-related metrics
ProcessLocksReadTotal, ProcessLocksReadTotal,
ProcessLocksWriteTotal, ProcessLocksWriteTotal,
ProcessCPUTotalSeconds, ProcessCPUTotalSeconds,
@@ -331,7 +331,7 @@ pub enum MetricName {
ProcessVirtualMemoryBytes, ProcessVirtualMemoryBytes,
ProcessVirtualMemoryMaxBytes, ProcessVirtualMemoryMaxBytes,
// 自定义指标 // Custom metrics
Custom(String), Custom(String),
} }
@@ -485,7 +485,7 @@ impl MetricName {
Self::ConfigRRSParity => "rrs_parity".to_string(), Self::ConfigRRSParity => "rrs_parity".to_string(),
Self::ConfigStandardParity => "standard_parity".to_string(), Self::ConfigStandardParity => "standard_parity".to_string(),
// 纠删码集合相关指标 // Erasure coding set related metrics
Self::ErasureSetOverallWriteQuorum => "overall_write_quorum".to_string(), Self::ErasureSetOverallWriteQuorum => "overall_write_quorum".to_string(),
Self::ErasureSetOverallHealth => "overall_health".to_string(), Self::ErasureSetOverallHealth => "overall_health".to_string(),
Self::ErasureSetReadQuorum => "read_quorum".to_string(), Self::ErasureSetReadQuorum => "read_quorum".to_string(),
@@ -498,12 +498,12 @@ impl MetricName {
Self::ErasureSetReadHealth => "read_health".to_string(), Self::ErasureSetReadHealth => "read_health".to_string(),
Self::ErasureSetWriteHealth => "write_health".to_string(), Self::ErasureSetWriteHealth => "write_health".to_string(),
// 集群健康相关指标 // Cluster health-related metrics
Self::HealthDrivesOfflineCount => "drives_offline_count".to_string(), Self::HealthDrivesOfflineCount => "drives_offline_count".to_string(),
Self::HealthDrivesOnlineCount => "drives_online_count".to_string(), Self::HealthDrivesOnlineCount => "drives_online_count".to_string(),
Self::HealthDrivesCount => "drives_count".to_string(), Self::HealthDrivesCount => "drives_count".to_string(),
// IAM 相关指标 // IAM-related metrics
Self::LastSyncDurationMillis => "last_sync_duration_millis".to_string(), Self::LastSyncDurationMillis => "last_sync_duration_millis".to_string(),
Self::PluginAuthnServiceFailedRequestsMinute => "plugin_authn_service_failed_requests_minute".to_string(), Self::PluginAuthnServiceFailedRequestsMinute => "plugin_authn_service_failed_requests_minute".to_string(),
Self::PluginAuthnServiceLastFailSeconds => "plugin_authn_service_last_fail_seconds".to_string(), Self::PluginAuthnServiceLastFailSeconds => "plugin_authn_service_last_fail_seconds".to_string(),
@@ -515,13 +515,13 @@ impl MetricName {
Self::SyncFailures => "sync_failures".to_string(), Self::SyncFailures => "sync_failures".to_string(),
Self::SyncSuccesses => "sync_successes".to_string(), Self::SyncSuccesses => "sync_successes".to_string(),
// 通知相关指标 // Notify relevant metrics
Self::NotificationCurrentSendInProgress => "current_send_in_progress".to_string(), Self::NotificationCurrentSendInProgress => "current_send_in_progress".to_string(),
Self::NotificationEventsErrorsTotal => "events_errors_total".to_string(), Self::NotificationEventsErrorsTotal => "events_errors_total".to_string(),
Self::NotificationEventsSentTotal => "events_sent_total".to_string(), Self::NotificationEventsSentTotal => "events_sent_total".to_string(),
Self::NotificationEventsSkippedTotal => "events_skipped_total".to_string(), Self::NotificationEventsSkippedTotal => "events_skipped_total".to_string(),
// 集群对象使用情况相关指标 // Metrics related to the usage of cluster objects
Self::UsageSinceLastUpdateSeconds => "since_last_update_seconds".to_string(), Self::UsageSinceLastUpdateSeconds => "since_last_update_seconds".to_string(),
Self::UsageTotalBytes => "total_bytes".to_string(), Self::UsageTotalBytes => "total_bytes".to_string(),
Self::UsageObjectsCount => "count".to_string(), Self::UsageObjectsCount => "count".to_string(),
@@ -531,7 +531,7 @@ impl MetricName {
Self::UsageSizeDistribution => "size_distribution".to_string(), Self::UsageSizeDistribution => "size_distribution".to_string(),
Self::UsageVersionCountDistribution => "version_count_distribution".to_string(), Self::UsageVersionCountDistribution => "version_count_distribution".to_string(),
// 桶使用情况相关指标 // Metrics related to bucket usage
Self::UsageBucketQuotaTotalBytes => "quota_total_bytes".to_string(), Self::UsageBucketQuotaTotalBytes => "quota_total_bytes".to_string(),
Self::UsageBucketTotalBytes => "total_bytes".to_string(), Self::UsageBucketTotalBytes => "total_bytes".to_string(),
Self::UsageBucketObjectsCount => "objects_count".to_string(), Self::UsageBucketObjectsCount => "objects_count".to_string(),
@@ -540,19 +540,19 @@ impl MetricName {
Self::UsageBucketObjectSizeDistribution => "object_size_distribution".to_string(), Self::UsageBucketObjectSizeDistribution => "object_size_distribution".to_string(),
Self::UsageBucketObjectVersionCountDistribution => "object_version_count_distribution".to_string(), Self::UsageBucketObjectVersionCountDistribution => "object_version_count_distribution".to_string(),
// ILM 相关指标 // ILM-related metrics
Self::IlmExpiryPendingTasks => "expiry_pending_tasks".to_string(), Self::IlmExpiryPendingTasks => "expiry_pending_tasks".to_string(),
Self::IlmTransitionActiveTasks => "transition_active_tasks".to_string(), Self::IlmTransitionActiveTasks => "transition_active_tasks".to_string(),
Self::IlmTransitionPendingTasks => "transition_pending_tasks".to_string(), Self::IlmTransitionPendingTasks => "transition_pending_tasks".to_string(),
Self::IlmTransitionMissedImmediateTasks => "transition_missed_immediate_tasks".to_string(), Self::IlmTransitionMissedImmediateTasks => "transition_missed_immediate_tasks".to_string(),
Self::IlmVersionsScanned => "versions_scanned".to_string(), Self::IlmVersionsScanned => "versions_scanned".to_string(),
// Webhook 日志相关指标 // Webhook logs
Self::WebhookQueueLength => "queue_length".to_string(), Self::WebhookQueueLength => "queue_length".to_string(),
Self::WebhookTotalMessages => "total_messages".to_string(), Self::WebhookTotalMessages => "total_messages".to_string(),
Self::WebhookFailedMessages => "failed_messages".to_string(), Self::WebhookFailedMessages => "failed_messages".to_string(),
// 复制相关指标 // Copy the relevant metrics
Self::ReplicationAverageActiveWorkers => "average_active_workers".to_string(), Self::ReplicationAverageActiveWorkers => "average_active_workers".to_string(),
Self::ReplicationAverageQueuedBytes => "average_queued_bytes".to_string(), Self::ReplicationAverageQueuedBytes => "average_queued_bytes".to_string(),
Self::ReplicationAverageQueuedCount => "average_queued_count".to_string(), Self::ReplicationAverageQueuedCount => "average_queued_count".to_string(),
@@ -567,7 +567,7 @@ impl MetricName {
Self::ReplicationMaxDataTransferRate => "max_data_transfer_rate".to_string(), Self::ReplicationMaxDataTransferRate => "max_data_transfer_rate".to_string(),
Self::ReplicationRecentBacklogCount => "recent_backlog_count".to_string(), Self::ReplicationRecentBacklogCount => "recent_backlog_count".to_string(),
// 扫描器相关指标 // Scanner-related metrics
Self::ScannerBucketScansFinished => "bucket_scans_finished".to_string(), Self::ScannerBucketScansFinished => "bucket_scans_finished".to_string(),
Self::ScannerBucketScansStarted => "bucket_scans_started".to_string(), Self::ScannerBucketScansStarted => "bucket_scans_started".to_string(),
Self::ScannerDirectoriesScanned => "directories_scanned".to_string(), Self::ScannerDirectoriesScanned => "directories_scanned".to_string(),
@@ -575,7 +575,7 @@ impl MetricName {
Self::ScannerVersionsScanned => "versions_scanned".to_string(), Self::ScannerVersionsScanned => "versions_scanned".to_string(),
Self::ScannerLastActivitySeconds => "last_activity_seconds".to_string(), Self::ScannerLastActivitySeconds => "last_activity_seconds".to_string(),
// CPU 系统相关指标 // CPU system-related metrics
Self::SysCPUAvgIdle => "avg_idle".to_string(), Self::SysCPUAvgIdle => "avg_idle".to_string(),
Self::SysCPUAvgIOWait => "avg_iowait".to_string(), Self::SysCPUAvgIOWait => "avg_iowait".to_string(),
Self::SysCPULoad => "load".to_string(), Self::SysCPULoad => "load".to_string(),
@@ -585,7 +585,7 @@ impl MetricName {
Self::SysCPUSystem => "system".to_string(), Self::SysCPUSystem => "system".to_string(),
Self::SysCPUUser => "user".to_string(), Self::SysCPUUser => "user".to_string(),
// 驱动器相关指标 // Drive-related metrics
Self::DriveUsedBytes => "used_bytes".to_string(), Self::DriveUsedBytes => "used_bytes".to_string(),
Self::DriveFreeBytes => "free_bytes".to_string(), Self::DriveFreeBytes => "free_bytes".to_string(),
Self::DriveTotalBytes => "total_bytes".to_string(), Self::DriveTotalBytes => "total_bytes".to_string(),
@@ -603,7 +603,7 @@ impl MetricName {
Self::DriveOnlineCount => "online_count".to_string(), Self::DriveOnlineCount => "online_count".to_string(),
Self::DriveCount => "count".to_string(), Self::DriveCount => "count".to_string(),
// iostat 相关指标 // iostat related metrics
Self::DriveReadsPerSec => "reads_per_sec".to_string(), Self::DriveReadsPerSec => "reads_per_sec".to_string(),
Self::DriveReadsKBPerSec => "reads_kb_per_sec".to_string(), Self::DriveReadsKBPerSec => "reads_kb_per_sec".to_string(),
Self::DriveReadsAwait => "reads_await".to_string(), Self::DriveReadsAwait => "reads_await".to_string(),
@@ -612,7 +612,7 @@ impl MetricName {
Self::DriveWritesAwait => "writes_await".to_string(), Self::DriveWritesAwait => "writes_await".to_string(),
Self::DrivePercUtil => "perc_util".to_string(), Self::DrivePercUtil => "perc_util".to_string(),
// 内存相关指标 // Memory-related metrics
Self::MemTotal => "total".to_string(), Self::MemTotal => "total".to_string(),
Self::MemUsed => "used".to_string(), Self::MemUsed => "used".to_string(),
Self::MemUsedPerc => "used_perc".to_string(), Self::MemUsedPerc => "used_perc".to_string(),
@@ -622,14 +622,14 @@ impl MetricName {
Self::MemShared => "shared".to_string(), Self::MemShared => "shared".to_string(),
Self::MemAvailable => "available".to_string(), Self::MemAvailable => "available".to_string(),
// 网络相关指标 // Network-related metrics
Self::InternodeErrorsTotal => "errors_total".to_string(), Self::InternodeErrorsTotal => "errors_total".to_string(),
Self::InternodeDialErrorsTotal => "dial_errors_total".to_string(), Self::InternodeDialErrorsTotal => "dial_errors_total".to_string(),
Self::InternodeDialAvgTimeNanos => "dial_avg_time_nanos".to_string(), Self::InternodeDialAvgTimeNanos => "dial_avg_time_nanos".to_string(),
Self::InternodeSentBytesTotal => "sent_bytes_total".to_string(), Self::InternodeSentBytesTotal => "sent_bytes_total".to_string(),
Self::InternodeRecvBytesTotal => "recv_bytes_total".to_string(), Self::InternodeRecvBytesTotal => "recv_bytes_total".to_string(),
// 进程相关指标 // Process-related metrics
Self::ProcessLocksReadTotal => "locks_read_total".to_string(), Self::ProcessLocksReadTotal => "locks_read_total".to_string(),
Self::ProcessLocksWriteTotal => "locks_write_total".to_string(), Self::ProcessLocksWriteTotal => "locks_write_total".to_string(),
Self::ProcessCPUTotalSeconds => "cpu_total_seconds".to_string(), Self::ProcessCPUTotalSeconds => "cpu_total_seconds".to_string(),
+1 -1
View File
@@ -21,7 +21,7 @@ impl MetricType {
/// Convert the metric type to the Prometheus value type /// Convert the metric type to the Prometheus value type
/// In a Rust implementation, this might return the corresponding Prometheus Rust client type /// In a Rust implementation, this might return the corresponding Prometheus Rust client type
#[allow(dead_code)] #[allow(dead_code)]
pub fn to_prom(&self) -> &'static str { pub fn as_prom(&self) -> &'static str {
match self { match self {
Self::Counter => "counter.", Self::Counter => "counter.",
Self::Gauge => "gauge.", Self::Gauge => "gauge.",
+4 -4
View File
@@ -92,21 +92,21 @@ impl MetricSubsystem {
/// Create a subsystem enumeration from a path string /// Create a subsystem enumeration from a path string
pub fn from_path(path: &str) -> Self { pub fn from_path(path: &str) -> Self {
match path { match path {
// API 相关子系统 // API-related subsystems
"/api/requests" => Self::ApiRequests, "/api/requests" => Self::ApiRequests,
// 桶相关子系统 // Bucket-related subsystems
"/bucket/api" => Self::BucketApi, "/bucket/api" => Self::BucketApi,
"/bucket/replication" => Self::BucketReplication, "/bucket/replication" => Self::BucketReplication,
// 系统相关子系统 // System-related subsystems
"/system/network/internode" => Self::SystemNetworkInternode, "/system/network/internode" => Self::SystemNetworkInternode,
"/system/drive" => Self::SystemDrive, "/system/drive" => Self::SystemDrive,
"/system/memory" => Self::SystemMemory, "/system/memory" => Self::SystemMemory,
"/system/cpu" => Self::SystemCpu, "/system/cpu" => Self::SystemCpu,
"/system/process" => Self::SystemProcess, "/system/process" => Self::SystemProcess,
// 调试相关子系统 // Debug related subsystems
"/debug/go" => Self::DebugGo, "/debug/go" => Self::DebugGo,
// 集群相关子系统 // 集群相关子系统
+6 -6
View File
@@ -1,12 +1,12 @@
/// ILM-related metric descriptors
use crate::metrics::{new_counter_md, new_gauge_md, subsystems, MetricDescriptor, MetricName}; use crate::metrics::{new_counter_md, new_gauge_md, subsystems, MetricDescriptor, MetricName};
/// ILM 相关指标描述符
lazy_static::lazy_static! { lazy_static::lazy_static! {
pub static ref ILM_EXPIRY_PENDING_TASKS_MD: MetricDescriptor = pub static ref ILM_EXPIRY_PENDING_TASKS_MD: MetricDescriptor =
new_gauge_md( new_gauge_md(
MetricName::IlmExpiryPendingTasks, MetricName::IlmExpiryPendingTasks,
"Number of pending ILM expiry tasks in the queue", "Number of pending ILM expiry tasks in the queue",
&[], // 无标签 &[],
subsystems::ILM subsystems::ILM
); );
@@ -14,7 +14,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::IlmTransitionActiveTasks, MetricName::IlmTransitionActiveTasks,
"Number of active ILM transition tasks", "Number of active ILM transition tasks",
&[], // 无标签 &[],
subsystems::ILM subsystems::ILM
); );
@@ -22,7 +22,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::IlmTransitionPendingTasks, MetricName::IlmTransitionPendingTasks,
"Number of pending ILM transition tasks in the queue", "Number of pending ILM transition tasks in the queue",
&[], // 无标签 &[],
subsystems::ILM subsystems::ILM
); );
@@ -30,7 +30,7 @@ lazy_static::lazy_static! {
new_counter_md( new_counter_md(
MetricName::IlmTransitionMissedImmediateTasks, MetricName::IlmTransitionMissedImmediateTasks,
"Number of missed immediate ILM transition tasks", "Number of missed immediate ILM transition tasks",
&[], // 无标签 &[],
subsystems::ILM subsystems::ILM
); );
@@ -38,7 +38,7 @@ lazy_static::lazy_static! {
new_counter_md( new_counter_md(
MetricName::IlmVersionsScanned, MetricName::IlmVersionsScanned,
"Total number of object versions checked for ILM actions since server start", "Total number of object versions checked for ILM actions since server start",
&[], // 无标签 &[],
subsystems::ILM subsystems::ILM
); );
} }
+5 -3
View File
@@ -1,12 +1,14 @@
/// A descriptor for metrics related to webhook logs
use crate::metrics::{new_counter_md, new_gauge_md, subsystems, MetricDescriptor, MetricName}; use crate::metrics::{new_counter_md, new_gauge_md, subsystems, MetricDescriptor, MetricName};
/// 定义标签常量 /// Define label constants for webhook metrics
/// name label
pub const NAME_LABEL: &str = "name"; pub const NAME_LABEL: &str = "name";
/// endpoint label
pub const ENDPOINT_LABEL: &str = "endpoint"; pub const ENDPOINT_LABEL: &str = "endpoint";
/// Webhook 日志相关指标描述符
lazy_static::lazy_static! { lazy_static::lazy_static! {
// 所有 Webhook 指标使用的标签 // The label used by all webhook metrics
static ref ALL_WEBHOOK_LABELS: [&'static str; 2] = [NAME_LABEL, ENDPOINT_LABEL]; static ref ALL_WEBHOOK_LABELS: [&'static str; 2] = [NAME_LABEL, ENDPOINT_LABEL];
pub static ref WEBHOOK_FAILED_MESSAGES_MD: MetricDescriptor = pub static ref WEBHOOK_FAILED_MESSAGES_MD: MetricDescriptor =
+1
View File
@@ -1,6 +1,7 @@
mod audit; mod audit;
mod bucket; mod bucket;
mod bucket_replication; mod bucket_replication;
mod cluster_config;
mod cluster_erasure_set; mod cluster_erasure_set;
mod cluster_health; mod cluster_health;
mod cluster_iam; mod cluster_iam;
+14 -14
View File
@@ -1,12 +1,12 @@
/// Copy the relevant metric descriptor
use crate::metrics::{new_gauge_md, subsystems, MetricDescriptor, MetricName}; use crate::metrics::{new_gauge_md, subsystems, MetricDescriptor, MetricName};
/// 复制相关指标描述符
lazy_static::lazy_static! { lazy_static::lazy_static! {
pub static ref REPLICATION_AVERAGE_ACTIVE_WORKERS_MD: MetricDescriptor = pub static ref REPLICATION_AVERAGE_ACTIVE_WORKERS_MD: MetricDescriptor =
new_gauge_md( new_gauge_md(
MetricName::ReplicationAverageActiveWorkers, MetricName::ReplicationAverageActiveWorkers,
"Average number of active replication workers", "Average number of active replication workers",
&[], // 无标签 &[],
subsystems::REPLICATION subsystems::REPLICATION
); );
@@ -14,7 +14,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::ReplicationAverageQueuedBytes, MetricName::ReplicationAverageQueuedBytes,
"Average number of bytes queued for replication since server start", "Average number of bytes queued for replication since server start",
&[], // 无标签 &[],
subsystems::REPLICATION subsystems::REPLICATION
); );
@@ -22,7 +22,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::ReplicationAverageQueuedCount, MetricName::ReplicationAverageQueuedCount,
"Average number of objects queued for replication since server start", "Average number of objects queued for replication since server start",
&[], // 无标签 &[],
subsystems::REPLICATION subsystems::REPLICATION
); );
@@ -30,7 +30,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::ReplicationAverageDataTransferRate, MetricName::ReplicationAverageDataTransferRate,
"Average replication data transfer rate in bytes/sec", "Average replication data transfer rate in bytes/sec",
&[], // 无标签 &[],
subsystems::REPLICATION subsystems::REPLICATION
); );
@@ -38,7 +38,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::ReplicationCurrentActiveWorkers, MetricName::ReplicationCurrentActiveWorkers,
"Total number of active replication workers", "Total number of active replication workers",
&[], // 无标签 &[],
subsystems::REPLICATION subsystems::REPLICATION
); );
@@ -46,7 +46,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::ReplicationCurrentDataTransferRate, MetricName::ReplicationCurrentDataTransferRate,
"Current replication data transfer rate in bytes/sec", "Current replication data transfer rate in bytes/sec",
&[], // 无标签 &[],
subsystems::REPLICATION subsystems::REPLICATION
); );
@@ -54,7 +54,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::ReplicationLastMinuteQueuedBytes, MetricName::ReplicationLastMinuteQueuedBytes,
"Number of bytes queued for replication in the last full minute", "Number of bytes queued for replication in the last full minute",
&[], // 无标签 &[],
subsystems::REPLICATION subsystems::REPLICATION
); );
@@ -62,7 +62,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::ReplicationLastMinuteQueuedCount, MetricName::ReplicationLastMinuteQueuedCount,
"Number of objects queued for replication in the last full minute", "Number of objects queued for replication in the last full minute",
&[], // 无标签 &[],
subsystems::REPLICATION subsystems::REPLICATION
); );
@@ -70,7 +70,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::ReplicationMaxActiveWorkers, MetricName::ReplicationMaxActiveWorkers,
"Maximum number of active replication workers seen since server start", "Maximum number of active replication workers seen since server start",
&[], // 无标签 &[],
subsystems::REPLICATION subsystems::REPLICATION
); );
@@ -78,7 +78,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::ReplicationMaxQueuedBytes, MetricName::ReplicationMaxQueuedBytes,
"Maximum number of bytes queued for replication since server start", "Maximum number of bytes queued for replication since server start",
&[], // 无标签 &[],
subsystems::REPLICATION subsystems::REPLICATION
); );
@@ -86,7 +86,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::ReplicationMaxQueuedCount, MetricName::ReplicationMaxQueuedCount,
"Maximum number of objects queued for replication since server start", "Maximum number of objects queued for replication since server start",
&[], // 无标签 &[],
subsystems::REPLICATION subsystems::REPLICATION
); );
@@ -94,7 +94,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::ReplicationMaxDataTransferRate, MetricName::ReplicationMaxDataTransferRate,
"Maximum replication data transfer rate in bytes/sec seen since server start", "Maximum replication data transfer rate in bytes/sec seen since server start",
&[], // 无标签 &[],
subsystems::REPLICATION subsystems::REPLICATION
); );
@@ -102,7 +102,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::ReplicationRecentBacklogCount, MetricName::ReplicationRecentBacklogCount,
"Total number of objects seen in replication backlog in the last 5 minutes", "Total number of objects seen in replication backlog in the last 5 minutes",
&[], // 无标签 &[],
subsystems::REPLICATION subsystems::REPLICATION
); );
} }
+7 -7
View File
@@ -1,12 +1,12 @@
/// Scanner-related metric descriptors
use crate::metrics::{new_counter_md, new_gauge_md, subsystems, MetricDescriptor, MetricName}; use crate::metrics::{new_counter_md, new_gauge_md, subsystems, MetricDescriptor, MetricName};
/// 扫描器相关指标描述符
lazy_static::lazy_static! { lazy_static::lazy_static! {
pub static ref SCANNER_BUCKET_SCANS_FINISHED_MD: MetricDescriptor = pub static ref SCANNER_BUCKET_SCANS_FINISHED_MD: MetricDescriptor =
new_counter_md( new_counter_md(
MetricName::ScannerBucketScansFinished, MetricName::ScannerBucketScansFinished,
"Total number of bucket scans finished since server start", "Total number of bucket scans finished since server start",
&[], // 无标签 &[],
subsystems::SCANNER subsystems::SCANNER
); );
@@ -14,7 +14,7 @@ lazy_static::lazy_static! {
new_counter_md( new_counter_md(
MetricName::ScannerBucketScansStarted, MetricName::ScannerBucketScansStarted,
"Total number of bucket scans started since server start", "Total number of bucket scans started since server start",
&[], // 无标签 &[],
subsystems::SCANNER subsystems::SCANNER
); );
@@ -22,7 +22,7 @@ lazy_static::lazy_static! {
new_counter_md( new_counter_md(
MetricName::ScannerDirectoriesScanned, MetricName::ScannerDirectoriesScanned,
"Total number of directories scanned since server start", "Total number of directories scanned since server start",
&[], // 无标签 &[],
subsystems::SCANNER subsystems::SCANNER
); );
@@ -30,7 +30,7 @@ lazy_static::lazy_static! {
new_counter_md( new_counter_md(
MetricName::ScannerObjectsScanned, MetricName::ScannerObjectsScanned,
"Total number of unique objects scanned since server start", "Total number of unique objects scanned since server start",
&[], // 无标签 &[],
subsystems::SCANNER subsystems::SCANNER
); );
@@ -38,7 +38,7 @@ lazy_static::lazy_static! {
new_counter_md( new_counter_md(
MetricName::ScannerVersionsScanned, MetricName::ScannerVersionsScanned,
"Total number of object versions scanned since server start", "Total number of object versions scanned since server start",
&[], // 无标签 &[],
subsystems::SCANNER subsystems::SCANNER
); );
@@ -46,7 +46,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::ScannerLastActivitySeconds, MetricName::ScannerLastActivitySeconds,
"Time elapsed (in seconds) since last scan activity.", "Time elapsed (in seconds) since last scan activity.",
&[], // 无标签 &[],
subsystems::SCANNER subsystems::SCANNER
); );
} }
+9 -9
View File
@@ -1,12 +1,12 @@
/// CPU system-related metric descriptors
use crate::metrics::{new_gauge_md, subsystems, MetricDescriptor, MetricName}; use crate::metrics::{new_gauge_md, subsystems, MetricDescriptor, MetricName};
/// CPU 系统相关指标描述符
lazy_static::lazy_static! { lazy_static::lazy_static! {
pub static ref SYS_CPU_AVG_IDLE_MD: MetricDescriptor = pub static ref SYS_CPU_AVG_IDLE_MD: MetricDescriptor =
new_gauge_md( new_gauge_md(
MetricName::SysCPUAvgIdle, MetricName::SysCPUAvgIdle,
"Average CPU idle time", "Average CPU idle time",
&[], // 无标签 &[],
subsystems::SYSTEM_CPU subsystems::SYSTEM_CPU
); );
@@ -14,7 +14,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::SysCPUAvgIOWait, MetricName::SysCPUAvgIOWait,
"Average CPU IOWait time", "Average CPU IOWait time",
&[], // 无标签 &[],
subsystems::SYSTEM_CPU subsystems::SYSTEM_CPU
); );
@@ -22,7 +22,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::SysCPULoad, MetricName::SysCPULoad,
"CPU load average 1min", "CPU load average 1min",
&[], // 无标签 &[],
subsystems::SYSTEM_CPU subsystems::SYSTEM_CPU
); );
@@ -30,7 +30,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::SysCPULoadPerc, MetricName::SysCPULoadPerc,
"CPU load average 1min (percentage)", "CPU load average 1min (percentage)",
&[], // 无标签 &[],
subsystems::SYSTEM_CPU subsystems::SYSTEM_CPU
); );
@@ -38,7 +38,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::SysCPUNice, MetricName::SysCPUNice,
"CPU nice time", "CPU nice time",
&[], // 无标签 &[],
subsystems::SYSTEM_CPU subsystems::SYSTEM_CPU
); );
@@ -46,7 +46,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::SysCPUSteal, MetricName::SysCPUSteal,
"CPU steal time", "CPU steal time",
&[], // 无标签 &[],
subsystems::SYSTEM_CPU subsystems::SYSTEM_CPU
); );
@@ -54,7 +54,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::SysCPUSystem, MetricName::SysCPUSystem,
"CPU system time", "CPU system time",
&[], // 无标签 &[],
subsystems::SYSTEM_CPU subsystems::SYSTEM_CPU
); );
@@ -62,7 +62,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::SysCPUUser, MetricName::SysCPUUser,
"CPU user time", "CPU user time",
&[], // 无标签 &[],
subsystems::SYSTEM_CPU subsystems::SYSTEM_CPU
); );
} }
+7 -3
View File
@@ -1,18 +1,22 @@
/// Drive-related metric descriptors
use crate::metrics::{new_counter_md, new_gauge_md, subsystems, MetricDescriptor, MetricName}; use crate::metrics::{new_counter_md, new_gauge_md, subsystems, MetricDescriptor, MetricName};
/// 定义标签常量 /// drive related labels
pub const DRIVE_LABEL: &str = "drive"; pub const DRIVE_LABEL: &str = "drive";
/// pool index label
pub const POOL_INDEX_LABEL: &str = "pool_index"; pub const POOL_INDEX_LABEL: &str = "pool_index";
/// set index label
pub const SET_INDEX_LABEL: &str = "set_index"; pub const SET_INDEX_LABEL: &str = "set_index";
/// drive index label
pub const DRIVE_INDEX_LABEL: &str = "drive_index"; pub const DRIVE_INDEX_LABEL: &str = "drive_index";
/// API label
pub const API_LABEL: &str = "api"; pub const API_LABEL: &str = "api";
/// 所有驱动器相关的标签
lazy_static::lazy_static! { lazy_static::lazy_static! {
/// All drive-related labels
static ref ALL_DRIVE_LABELS: [&'static str; 4] = [DRIVE_LABEL, POOL_INDEX_LABEL, SET_INDEX_LABEL, DRIVE_INDEX_LABEL]; static ref ALL_DRIVE_LABELS: [&'static str; 4] = [DRIVE_LABEL, POOL_INDEX_LABEL, SET_INDEX_LABEL, DRIVE_INDEX_LABEL];
} }
/// 驱动器相关指标描述符
lazy_static::lazy_static! { lazy_static::lazy_static! {
pub static ref DRIVE_USED_BYTES_MD: MetricDescriptor = pub static ref DRIVE_USED_BYTES_MD: MetricDescriptor =
new_gauge_md( new_gauge_md(
+9 -9
View File
@@ -1,12 +1,12 @@
/// Memory-related metric descriptors
use crate::metrics::{new_gauge_md, subsystems, MetricDescriptor, MetricName}; use crate::metrics::{new_gauge_md, subsystems, MetricDescriptor, MetricName};
/// 内存相关指标描述符
lazy_static::lazy_static! { lazy_static::lazy_static! {
pub static ref MEM_TOTAL_MD: MetricDescriptor = pub static ref MEM_TOTAL_MD: MetricDescriptor =
new_gauge_md( new_gauge_md(
MetricName::MemTotal, MetricName::MemTotal,
"Total memory on the node", "Total memory on the node",
&[], // 无标签 &[],
subsystems::SYSTEM_MEMORY subsystems::SYSTEM_MEMORY
); );
@@ -14,7 +14,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::MemUsed, MetricName::MemUsed,
"Used memory on the node", "Used memory on the node",
&[], // 无标签 &[],
subsystems::SYSTEM_MEMORY subsystems::SYSTEM_MEMORY
); );
@@ -22,7 +22,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::MemUsedPerc, MetricName::MemUsedPerc,
"Used memory percentage on the node", "Used memory percentage on the node",
&[], // 无标签 &[],
subsystems::SYSTEM_MEMORY subsystems::SYSTEM_MEMORY
); );
@@ -30,7 +30,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::MemFree, MetricName::MemFree,
"Free memory on the node", "Free memory on the node",
&[], // 无标签 &[],
subsystems::SYSTEM_MEMORY subsystems::SYSTEM_MEMORY
); );
@@ -38,7 +38,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::MemBuffers, MetricName::MemBuffers,
"Buffers memory on the node", "Buffers memory on the node",
&[], // 无标签 &[],
subsystems::SYSTEM_MEMORY subsystems::SYSTEM_MEMORY
); );
@@ -46,7 +46,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::MemCache, MetricName::MemCache,
"Cache memory on the node", "Cache memory on the node",
&[], // 无标签 &[],
subsystems::SYSTEM_MEMORY subsystems::SYSTEM_MEMORY
); );
@@ -54,7 +54,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::MemShared, MetricName::MemShared,
"Shared memory on the node", "Shared memory on the node",
&[], // 无标签 &[],
subsystems::SYSTEM_MEMORY subsystems::SYSTEM_MEMORY
); );
@@ -62,7 +62,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::MemAvailable, MetricName::MemAvailable,
"Available memory on the node", "Available memory on the node",
&[], // 无标签 &[],
subsystems::SYSTEM_MEMORY subsystems::SYSTEM_MEMORY
); );
} }
+6 -6
View File
@@ -1,12 +1,12 @@
/// Network-related metric descriptors
use crate::metrics::{new_counter_md, new_gauge_md, subsystems, MetricDescriptor, MetricName}; use crate::metrics::{new_counter_md, new_gauge_md, subsystems, MetricDescriptor, MetricName};
/// 网络相关指标描述符
lazy_static::lazy_static! { lazy_static::lazy_static! {
pub static ref INTERNODE_ERRORS_TOTAL_MD: MetricDescriptor = pub static ref INTERNODE_ERRORS_TOTAL_MD: MetricDescriptor =
new_counter_md( new_counter_md(
MetricName::InternodeErrorsTotal, MetricName::InternodeErrorsTotal,
"Total number of failed internode calls", "Total number of failed internode calls",
&[], // 无标签 &[],
subsystems::SYSTEM_NETWORK_INTERNODE subsystems::SYSTEM_NETWORK_INTERNODE
); );
@@ -14,7 +14,7 @@ lazy_static::lazy_static! {
new_counter_md( new_counter_md(
MetricName::InternodeDialErrorsTotal, MetricName::InternodeDialErrorsTotal,
"Total number of internode TCP dial timeouts and errors", "Total number of internode TCP dial timeouts and errors",
&[], // 无标签 &[],
subsystems::SYSTEM_NETWORK_INTERNODE subsystems::SYSTEM_NETWORK_INTERNODE
); );
@@ -22,7 +22,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::InternodeDialAvgTimeNanos, MetricName::InternodeDialAvgTimeNanos,
"Average dial time of internode TCP calls in nanoseconds", "Average dial time of internode TCP calls in nanoseconds",
&[], // 无标签 &[],
subsystems::SYSTEM_NETWORK_INTERNODE subsystems::SYSTEM_NETWORK_INTERNODE
); );
@@ -30,7 +30,7 @@ lazy_static::lazy_static! {
new_counter_md( new_counter_md(
MetricName::InternodeSentBytesTotal, MetricName::InternodeSentBytesTotal,
"Total number of bytes sent to other peer nodes", "Total number of bytes sent to other peer nodes",
&[], // 无标签 &[],
subsystems::SYSTEM_NETWORK_INTERNODE subsystems::SYSTEM_NETWORK_INTERNODE
); );
@@ -38,7 +38,7 @@ lazy_static::lazy_static! {
new_counter_md( new_counter_md(
MetricName::InternodeRecvBytesTotal, MetricName::InternodeRecvBytesTotal,
"Total number of bytes received from other peer nodes", "Total number of bytes received from other peer nodes",
&[], // 无标签 &[],
subsystems::SYSTEM_NETWORK_INTERNODE subsystems::SYSTEM_NETWORK_INTERNODE
); );
} }
+18 -18
View File
@@ -1,12 +1,12 @@
/// process related metric descriptors
use crate::metrics::{new_counter_md, new_gauge_md, subsystems, MetricDescriptor, MetricName}; use crate::metrics::{new_counter_md, new_gauge_md, subsystems, MetricDescriptor, MetricName};
/// process related metric descriptors
lazy_static::lazy_static! { lazy_static::lazy_static! {
pub static ref PROCESS_LOCKS_READ_TOTAL_MD: MetricDescriptor = pub static ref PROCESS_LOCKS_READ_TOTAL_MD: MetricDescriptor =
new_gauge_md( new_gauge_md(
MetricName::ProcessLocksReadTotal, MetricName::ProcessLocksReadTotal,
"Number of current READ locks on this peer", "Number of current READ locks on this peer",
&[], // 无标签 &[],
subsystems::SYSTEM_PROCESS subsystems::SYSTEM_PROCESS
); );
@@ -14,7 +14,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::ProcessLocksWriteTotal, MetricName::ProcessLocksWriteTotal,
"Number of current WRITE locks on this peer", "Number of current WRITE locks on this peer",
&[], // 无标签 &[],
subsystems::SYSTEM_PROCESS subsystems::SYSTEM_PROCESS
); );
@@ -22,7 +22,7 @@ lazy_static::lazy_static! {
new_counter_md( new_counter_md(
MetricName::ProcessCPUTotalSeconds, MetricName::ProcessCPUTotalSeconds,
"Total user and system CPU time spent in seconds", "Total user and system CPU time spent in seconds",
&[], // 无标签 &[],
subsystems::SYSTEM_PROCESS subsystems::SYSTEM_PROCESS
); );
@@ -30,7 +30,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::ProcessGoRoutineTotal, MetricName::ProcessGoRoutineTotal,
"Total number of go routines running", "Total number of go routines running",
&[], // 无标签 &[],
subsystems::SYSTEM_PROCESS subsystems::SYSTEM_PROCESS
); );
@@ -38,7 +38,7 @@ lazy_static::lazy_static! {
new_counter_md( new_counter_md(
MetricName::ProcessIORCharBytes, MetricName::ProcessIORCharBytes,
"Total bytes read by the process from the underlying storage system including cache, /proc/[pid]/io rchar", "Total bytes read by the process from the underlying storage system including cache, /proc/[pid]/io rchar",
&[], // 无标签 &[],
subsystems::SYSTEM_PROCESS subsystems::SYSTEM_PROCESS
); );
@@ -46,7 +46,7 @@ lazy_static::lazy_static! {
new_counter_md( new_counter_md(
MetricName::ProcessIOReadBytes, MetricName::ProcessIOReadBytes,
"Total bytes read by the process from the underlying storage system, /proc/[pid]/io read_bytes", "Total bytes read by the process from the underlying storage system, /proc/[pid]/io read_bytes",
&[], // 无标签 &[],
subsystems::SYSTEM_PROCESS subsystems::SYSTEM_PROCESS
); );
@@ -54,7 +54,7 @@ lazy_static::lazy_static! {
new_counter_md( new_counter_md(
MetricName::ProcessIOWCharBytes, MetricName::ProcessIOWCharBytes,
"Total bytes written by the process to the underlying storage system including page cache, /proc/[pid]/io wchar", "Total bytes written by the process to the underlying storage system including page cache, /proc/[pid]/io wchar",
&[], // 无标签 &[],
subsystems::SYSTEM_PROCESS subsystems::SYSTEM_PROCESS
); );
@@ -62,7 +62,7 @@ lazy_static::lazy_static! {
new_counter_md( new_counter_md(
MetricName::ProcessIOWriteBytes, MetricName::ProcessIOWriteBytes,
"Total bytes written by the process to the underlying storage system, /proc/[pid]/io write_bytes", "Total bytes written by the process to the underlying storage system, /proc/[pid]/io write_bytes",
&[], // 无标签 &[],
subsystems::SYSTEM_PROCESS subsystems::SYSTEM_PROCESS
); );
@@ -70,7 +70,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::ProcessStartTimeSeconds, MetricName::ProcessStartTimeSeconds,
"Start time for RustFS process in seconds since Unix epoc", "Start time for RustFS process in seconds since Unix epoc",
&[], // 无标签 &[],
subsystems::SYSTEM_PROCESS subsystems::SYSTEM_PROCESS
); );
@@ -78,7 +78,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::ProcessUptimeSeconds, MetricName::ProcessUptimeSeconds,
"Uptime for RustFS process in seconds", "Uptime for RustFS process in seconds",
&[], // 无标签 &[],
subsystems::SYSTEM_PROCESS subsystems::SYSTEM_PROCESS
); );
@@ -86,7 +86,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::ProcessFileDescriptorLimitTotal, MetricName::ProcessFileDescriptorLimitTotal,
"Limit on total number of open file descriptors for the RustFS Server process", "Limit on total number of open file descriptors for the RustFS Server process",
&[], // 无标签 &[],
subsystems::SYSTEM_PROCESS subsystems::SYSTEM_PROCESS
); );
@@ -94,7 +94,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::ProcessFileDescriptorOpenTotal, MetricName::ProcessFileDescriptorOpenTotal,
"Total number of open file descriptors by the RustFS Server process", "Total number of open file descriptors by the RustFS Server process",
&[], // 无标签 &[],
subsystems::SYSTEM_PROCESS subsystems::SYSTEM_PROCESS
); );
@@ -102,7 +102,7 @@ lazy_static::lazy_static! {
new_counter_md( new_counter_md(
MetricName::ProcessSyscallReadTotal, MetricName::ProcessSyscallReadTotal,
"Total read SysCalls to the kernel. /proc/[pid]/io syscr", "Total read SysCalls to the kernel. /proc/[pid]/io syscr",
&[], // 无标签 &[],
subsystems::SYSTEM_PROCESS subsystems::SYSTEM_PROCESS
); );
@@ -110,7 +110,7 @@ lazy_static::lazy_static! {
new_counter_md( new_counter_md(
MetricName::ProcessSyscallWriteTotal, MetricName::ProcessSyscallWriteTotal,
"Total write SysCalls to the kernel. /proc/[pid]/io syscw", "Total write SysCalls to the kernel. /proc/[pid]/io syscw",
&[], // 无标签 &[],
subsystems::SYSTEM_PROCESS subsystems::SYSTEM_PROCESS
); );
@@ -118,7 +118,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::ProcessResidentMemoryBytes, MetricName::ProcessResidentMemoryBytes,
"Resident memory size in bytes", "Resident memory size in bytes",
&[], // 无标签 &[],
subsystems::SYSTEM_PROCESS subsystems::SYSTEM_PROCESS
); );
@@ -126,7 +126,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::ProcessVirtualMemoryBytes, MetricName::ProcessVirtualMemoryBytes,
"Virtual memory size in bytes", "Virtual memory size in bytes",
&[], // 无标签 &[],
subsystems::SYSTEM_PROCESS subsystems::SYSTEM_PROCESS
); );
@@ -134,7 +134,7 @@ lazy_static::lazy_static! {
new_gauge_md( new_gauge_md(
MetricName::ProcessVirtualMemoryMaxBytes, MetricName::ProcessVirtualMemoryMaxBytes,
"Maximum virtual memory size in bytes", "Maximum virtual memory size in bytes",
&[], // 无标签 &[],
subsystems::SYSTEM_PROCESS subsystems::SYSTEM_PROCESS
); );
} }
+1 -1
View File
@@ -43,7 +43,7 @@ pub fn load_private_key(filename: &str) -> io::Result<PrivateKeyDer<'static>> {
/// error function /// error function
pub fn certs_error(err: String) -> Error { pub fn certs_error(err: String) -> Error {
Error::new(io::ErrorKind::Other, err) Error::other(err)
} }
/// Load all certificates and private keys in the directory /// Load all certificates and private keys in the directory
+2 -2
View File
@@ -1193,15 +1193,15 @@ impl DiskAPI for LocalDisk {
#[tracing::instrument(skip(self))] #[tracing::instrument(skip(self))]
async fn set_disk_id(&self, id: Option<Uuid>) -> Result<()> { async fn set_disk_id(&self, id: Option<Uuid>) -> Result<()> {
// 本地不需要设置 // No setup is required locally
// TODO: add check_id_store // TODO: add check_id_store
let mut format_info = self.format_info.write().await; let mut format_info = self.format_info.write().await;
format_info.id = id; format_info.id = id;
Ok(()) Ok(())
} }
#[must_use]
#[tracing::instrument(skip(self))] #[tracing::instrument(skip(self))]
#[must_use]
async fn read_all(&self, volume: &str, path: &str) -> Result<Vec<u8>> { async fn read_all(&self, volume: &str, path: &str) -> Result<Vec<u8>> {
if volume == super::RUSTFS_META_BUCKET && path == super::FORMAT_CONFIG_FILE { if volume == super::RUSTFS_META_BUCKET && path == super::FORMAT_CONFIG_FILE {
let format_info = self.format_info.read().await; let format_info = self.format_info.read().await;
+3 -3
View File
@@ -58,7 +58,7 @@ impl HttpFileWriter {
.body(body) .body(body)
.send() .send()
.await .await
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e)) .map_err(io::Error::other)
{ {
error!("HttpFileWriter put file err: {:?}", err); error!("HttpFileWriter put file err: {:?}", err);
@@ -115,9 +115,9 @@ impl HttpFileReader {
)) ))
.send() .send()
.await .await
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?; .map_err(io::Error::other)?;
let inner = Box::new(StreamReader::new(resp.bytes_stream().map_err(std::io::Error::other))); let inner = Box::new(StreamReader::new(resp.bytes_stream().map_err(io::Error::other)));
Ok(Self { inner }) Ok(Self { inner })
} }
+19 -28
View File
@@ -2,7 +2,7 @@ use super::IOStats;
use crate::disk::Info; use crate::disk::Info;
use common::error::Result; use common::error::Result;
use nix::sys::{stat::stat, statfs::statfs}; use nix::sys::{stat::stat, statfs::statfs};
use std::io::{Error, ErrorKind}; use std::io::Error;
use std::path::Path; use std::path::Path;
/// returns total and free bytes available in a directory, e.g. `/`. /// returns total and free bytes available in a directory, e.g. `/`.
@@ -17,30 +17,24 @@ pub fn get_info(p: impl AsRef<Path>) -> std::io::Result<Info> {
let reserved = match bfree.checked_sub(bavail) { let reserved = match bfree.checked_sub(bavail) {
Some(reserved) => reserved, Some(reserved) => reserved,
None => { None => {
return Err(Error::new( return Err(Error::other(format!(
ErrorKind::Other, "detected f_bavail space ({}) > f_bfree space ({}), fs corruption at ({}). please run 'fsck'",
format!( bavail,
"detected f_bavail space ({}) > f_bfree space ({}), fs corruption at ({}). please run 'fsck'", bfree,
bavail, p.as_ref().display()
bfree, )))
p.as_ref().display()
),
))
} }
}; };
let total = match blocks.checked_sub(reserved) { let total = match blocks.checked_sub(reserved) {
Some(total) => total * bsize, Some(total) => total * bsize,
None => { None => {
return Err(Error::new( return Err(Error::other(format!(
ErrorKind::Other, "detected reserved space ({}) > blocks space ({}), fs corruption at ({}). please run 'fsck'",
format!( reserved,
"detected reserved space ({}) > blocks space ({}), fs corruption at ({}). please run 'fsck'", blocks,
reserved, p.as_ref().display()
blocks, )))
p.as_ref().display()
),
))
} }
}; };
@@ -48,15 +42,12 @@ pub fn get_info(p: impl AsRef<Path>) -> std::io::Result<Info> {
let used = match total.checked_sub(free) { let used = match total.checked_sub(free) {
Some(used) => used, Some(used) => used,
None => { None => {
return Err(Error::new( return Err(Error::other(format!(
ErrorKind::Other, "detected free space ({}) > total drive space ({}), fs corruption at ({}). please run 'fsck'",
format!( free,
"detected free space ({}) > total drive space ({}), fs corruption at ({}). please run 'fsck'", total,
free, p.as_ref().display()
total, )))
p.as_ref().display()
),
))
} }
}; };
+1 -5
View File
@@ -117,11 +117,7 @@ impl Operation for PutFile {
.map_err(|e| s3_error!(InternalError, "read file err {}", e))? .map_err(|e| s3_error!(InternalError, "read file err {}", e))?
}; };
let mut body = StreamReader::new( let mut body = StreamReader::new(req.input.into_stream().map_err(std::io::Error::other));
req.input
.into_stream()
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e)),
);
tokio::io::copy(&mut body, &mut file) tokio::io::copy(&mut body, &mut file)
.await .await
+2 -2
View File
@@ -281,7 +281,7 @@ async fn start_server(server_addr: SocketAddr, tls_path: Option<String>, app: Ro
.handle(handle.clone()) .handle(handle.clone())
.serve(app.into_make_service()) .serve(app.into_make_service())
.await .await
.map_err(|e| io::Error::new(io::ErrorKind::Other, e))?; .map_err(|e| io::Error::other(e))?;
info!("HTTPS server running on https://{}", server_addr); info!("HTTPS server running on https://{}", server_addr);
@@ -323,7 +323,7 @@ async fn start_http_server(addr: SocketAddr, app: Router, handle: axum_server::H
.handle(handle) .handle(handle)
.serve(app.into_make_service()) .serve(app.into_make_service())
.await .await
.map_err(|e| io::Error::new(io::ErrorKind::Other, e)) .map_err(io::Error::other)
} }
async fn shutdown_signal() { async fn shutdown_signal() {
+4 -8
View File
@@ -119,7 +119,7 @@ impl FS {
let Some(body) = body else { return Err(s3_error!(IncompleteBody)) }; let Some(body) = body else { return Err(s3_error!(IncompleteBody)) };
let body = StreamReader::new(body.map(|f| f.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string())))); let body = StreamReader::new(body.map(|f| f.map_err(|e| std::io::Error::other(e.to_string()))));
// let etag_stream = EtagReader::new(body); // let etag_stream = EtagReader::new(body);
@@ -205,7 +205,7 @@ impl FS {
// .await // .await
// { // {
// Ok(_) => println!("解压成功!"), // Ok(_) => println!("解压成功!"),
// Err(e) => println!("解压失败: {}", e), // Err(e) => println!("解压失败{}", e),
// } // }
// TODO: etag // TODO: etag
@@ -960,9 +960,7 @@ impl S3 for FS {
} }
}; };
let body = Box::new(StreamReader::new( let body = Box::new(StreamReader::new(body.map(|f| f.map_err(|e| std::io::Error::other(e.to_string())))));
body.map(|f| f.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string()))),
));
let mut reader = PutObjReader::new(body, content_length as usize); let mut reader = PutObjReader::new(body, content_length as usize);
@@ -1076,9 +1074,7 @@ impl S3 for FS {
} }
}; };
let body = Box::new(StreamReader::new( let body = Box::new(StreamReader::new(body.map(|f| f.map_err(|e| std::io::Error::other(e.to_string())))));
body.map(|f| f.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string()))),
));
// mc cp step 4 // mc cp step 4
let mut data = PutObjReader::new(body, content_length as usize); let mut data = PutObjReader::new(body, content_length as usize);