mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-11 07:36:53 +00:00
add metrics
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
/// audit related metric descriptors
|
||||
///
|
||||
/// This module contains the metric descriptors for the audit subsystem.
|
||||
use crate::metrics::{new_counter_md, new_gauge_md, subsystems, MetricDescriptor, MetricName};
|
||||
|
||||
const TARGET_ID: &str = "target_id";
|
||||
|
||||
/// audit related metric descriptors
|
||||
lazy_static::lazy_static! {
|
||||
pub static ref AUDIT_FAILED_MESSAGES_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/// bucket level s3 metric descriptor
|
||||
use crate::metrics::{new_counter_md, new_gauge_md, new_histogram_md, subsystems, MetricDescriptor, MetricName};
|
||||
|
||||
/// Bucket 级别 S3 指标描述符
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
pub static ref BUCKET_API_TRAFFIC_SENT_BYTES_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/// Bucket copy metric descriptor
|
||||
use crate::metrics::{new_counter_md, new_gauge_md, subsystems, MetricDescriptor, MetricName};
|
||||
|
||||
// Label constants
|
||||
@@ -6,7 +7,6 @@ pub const OPERATION_L: &str = "operation";
|
||||
pub const TARGET_ARN_L: &str = "targetArn";
|
||||
pub const RANGE_L: &str = "range";
|
||||
|
||||
/// Bucket copy metric descriptor
|
||||
lazy_static::lazy_static! {
|
||||
pub static ref BUCKET_REPL_LAST_HR_FAILED_BYTES_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
use crate::metrics::{new_gauge_md, subsystems, MetricDescriptor, MetricName};
|
||||
|
||||
// 定义标签常量
|
||||
pub const POOL_ID_L: &str = "pool_id";
|
||||
pub const SET_ID_L: &str = "set_id";
|
||||
|
||||
/// 纠删码集合相关指标描述符
|
||||
lazy_static::lazy_static! {
|
||||
pub static ref ERASURE_SET_OVERALL_WRITE_QUORUM_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::ErasureSetOverallWriteQuorum,
|
||||
"Overall write quorum across pools and sets",
|
||||
&[], // 无标签
|
||||
subsystems::CLUSTER_ERASURE_SET
|
||||
);
|
||||
|
||||
pub static ref ERASURE_SET_OVERALL_HEALTH_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::ErasureSetOverallHealth,
|
||||
"Overall health across pools and sets (1=healthy, 0=unhealthy)",
|
||||
&[], // 无标签
|
||||
subsystems::CLUSTER_ERASURE_SET
|
||||
);
|
||||
|
||||
pub static ref ERASURE_SET_READ_QUORUM_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::ErasureSetReadQuorum,
|
||||
"Read quorum for the erasure set in a pool",
|
||||
&[POOL_ID_L, SET_ID_L],
|
||||
subsystems::CLUSTER_ERASURE_SET
|
||||
);
|
||||
|
||||
pub static ref ERASURE_SET_WRITE_QUORUM_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::ErasureSetWriteQuorum,
|
||||
"Write quorum for the erasure set in a pool",
|
||||
&[POOL_ID_L, SET_ID_L],
|
||||
subsystems::CLUSTER_ERASURE_SET
|
||||
);
|
||||
|
||||
pub static ref ERASURE_SET_ONLINE_DRIVES_COUNT_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::ErasureSetOnlineDrivesCount,
|
||||
"Count of online drives in the erasure set in a pool",
|
||||
&[POOL_ID_L, SET_ID_L],
|
||||
subsystems::CLUSTER_ERASURE_SET
|
||||
);
|
||||
|
||||
pub static ref ERASURE_SET_HEALING_DRIVES_COUNT_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::ErasureSetHealingDrivesCount,
|
||||
"Count of healing drives in the erasure set in a pool",
|
||||
&[POOL_ID_L, SET_ID_L],
|
||||
subsystems::CLUSTER_ERASURE_SET
|
||||
);
|
||||
|
||||
pub static ref ERASURE_SET_HEALTH_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::ErasureSetHealth,
|
||||
"Health of the erasure set in a pool (1=healthy, 0=unhealthy)",
|
||||
&[POOL_ID_L, SET_ID_L],
|
||||
subsystems::CLUSTER_ERASURE_SET
|
||||
);
|
||||
|
||||
pub static ref ERASURE_SET_READ_TOLERANCE_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::ErasureSetReadTolerance,
|
||||
"No of drive failures that can be tolerated without disrupting read operations",
|
||||
&[POOL_ID_L, SET_ID_L],
|
||||
subsystems::CLUSTER_ERASURE_SET
|
||||
);
|
||||
|
||||
pub static ref ERASURE_SET_WRITE_TOLERANCE_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::ErasureSetWriteTolerance,
|
||||
"No of drive failures that can be tolerated without disrupting write operations",
|
||||
&[POOL_ID_L, SET_ID_L],
|
||||
subsystems::CLUSTER_ERASURE_SET
|
||||
);
|
||||
|
||||
pub static ref ERASURE_SET_READ_HEALTH_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::ErasureSetReadHealth,
|
||||
"Health of the erasure set in a pool for read operations (1=healthy, 0=unhealthy)",
|
||||
&[POOL_ID_L, SET_ID_L],
|
||||
subsystems::CLUSTER_ERASURE_SET
|
||||
);
|
||||
|
||||
pub static ref ERASURE_SET_WRITE_HEALTH_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::ErasureSetWriteHealth,
|
||||
"Health of the erasure set in a pool for write operations (1=healthy, 0=unhealthy)",
|
||||
&[POOL_ID_L, SET_ID_L],
|
||||
subsystems::CLUSTER_ERASURE_SET
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
use crate::metrics::{new_gauge_md, subsystems, MetricDescriptor, MetricName};
|
||||
|
||||
/// 集群健康相关指标描述符
|
||||
lazy_static::lazy_static! {
|
||||
pub static ref HEALTH_DRIVES_OFFLINE_COUNT_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::HealthDrivesOfflineCount,
|
||||
"Count of offline drives in the cluster",
|
||||
&[], // 无标签
|
||||
subsystems::CLUSTER_HEALTH
|
||||
);
|
||||
|
||||
pub static ref HEALTH_DRIVES_ONLINE_COUNT_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::HealthDrivesOnlineCount,
|
||||
"Count of online drives in the cluster",
|
||||
&[], // 无标签
|
||||
subsystems::CLUSTER_HEALTH
|
||||
);
|
||||
|
||||
pub static ref HEALTH_DRIVES_COUNT_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::HealthDrivesCount,
|
||||
"Count of all drives in the cluster",
|
||||
&[], // 无标签
|
||||
subsystems::CLUSTER_HEALTH
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
use crate::metrics::{new_counter_md, subsystems, MetricDescriptor, MetricName};
|
||||
|
||||
/// IAM 相关指标描述符
|
||||
lazy_static::lazy_static! {
|
||||
pub static ref LAST_SYNC_DURATION_MILLIS_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::LastSyncDurationMillis,
|
||||
"Last successful IAM data sync duration in milliseconds",
|
||||
&[], // 无标签
|
||||
subsystems::CLUSTER_IAM
|
||||
);
|
||||
|
||||
pub static ref PLUGIN_AUTHN_SERVICE_FAILED_REQUESTS_MINUTE_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::PluginAuthnServiceFailedRequestsMinute,
|
||||
"When plugin authentication is configured, returns failed requests count in the last full minute",
|
||||
&[], // 无标签
|
||||
subsystems::CLUSTER_IAM
|
||||
);
|
||||
|
||||
pub static ref PLUGIN_AUTHN_SERVICE_LAST_FAIL_SECONDS_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::PluginAuthnServiceLastFailSeconds,
|
||||
"When plugin authentication is configured, returns time (in seconds) since the last failed request to the service",
|
||||
&[], // 无标签
|
||||
subsystems::CLUSTER_IAM
|
||||
);
|
||||
|
||||
pub static ref PLUGIN_AUTHN_SERVICE_LAST_SUCC_SECONDS_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::PluginAuthnServiceLastSuccSeconds,
|
||||
"When plugin authentication is configured, returns time (in seconds) since the last successful request to the service",
|
||||
&[], // 无标签
|
||||
subsystems::CLUSTER_IAM
|
||||
);
|
||||
|
||||
pub static ref PLUGIN_AUTHN_SERVICE_SUCC_AVG_RTT_MS_MINUTE_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::PluginAuthnServiceSuccAvgRttMsMinute,
|
||||
"When plugin authentication is configured, returns average round-trip-time of successful requests in the last full minute",
|
||||
&[], // 无标签
|
||||
subsystems::CLUSTER_IAM
|
||||
);
|
||||
|
||||
pub static ref PLUGIN_AUTHN_SERVICE_SUCC_MAX_RTT_MS_MINUTE_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::PluginAuthnServiceSuccMaxRttMsMinute,
|
||||
"When plugin authentication is configured, returns maximum round-trip-time of successful requests in the last full minute",
|
||||
&[], // 无标签
|
||||
subsystems::CLUSTER_IAM
|
||||
);
|
||||
|
||||
pub static ref PLUGIN_AUTHN_SERVICE_TOTAL_REQUESTS_MINUTE_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::PluginAuthnServiceTotalRequestsMinute,
|
||||
"When plugin authentication is configured, returns total requests count in the last full minute",
|
||||
&[], // 无标签
|
||||
subsystems::CLUSTER_IAM
|
||||
);
|
||||
|
||||
pub static ref SINCE_LAST_SYNC_MILLIS_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::SinceLastSyncMillis,
|
||||
"Time (in milliseconds) since last successful IAM data sync.",
|
||||
&[], // 无标签
|
||||
subsystems::CLUSTER_IAM
|
||||
);
|
||||
|
||||
pub static ref SYNC_FAILURES_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::SyncFailures,
|
||||
"Number of failed IAM data syncs since server start.",
|
||||
&[], // 无标签
|
||||
subsystems::CLUSTER_IAM
|
||||
);
|
||||
|
||||
pub static ref SYNC_SUCCESSES_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::SyncSuccesses,
|
||||
"Number of successful IAM data syncs since server start.",
|
||||
&[], // 无标签
|
||||
subsystems::CLUSTER_IAM
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
use crate::metrics::{new_counter_md, subsystems, MetricDescriptor, MetricName};
|
||||
|
||||
/// 通知相关指标描述符
|
||||
lazy_static::lazy_static! {
|
||||
pub static ref NOTIFICATION_CURRENT_SEND_IN_PROGRESS_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::NotificationCurrentSendInProgress,
|
||||
"Number of concurrent async Send calls active to all targets",
|
||||
&[], // 无标签
|
||||
subsystems::NOTIFICATION
|
||||
);
|
||||
|
||||
pub static ref NOTIFICATION_EVENTS_ERRORS_TOTAL_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::NotificationEventsErrorsTotal,
|
||||
"Events that were failed to be sent to the targets",
|
||||
&[], // 无标签
|
||||
subsystems::NOTIFICATION
|
||||
);
|
||||
|
||||
pub static ref NOTIFICATION_EVENTS_SENT_TOTAL_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::NotificationEventsSentTotal,
|
||||
"Total number of events sent to the targets",
|
||||
&[], // 无标签
|
||||
subsystems::NOTIFICATION
|
||||
);
|
||||
|
||||
pub static ref NOTIFICATION_EVENTS_SKIPPED_TOTAL_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::NotificationEventsSkippedTotal,
|
||||
"Events that were skipped to be sent to the targets due to the in-memory queue being full",
|
||||
&[], // 无标签
|
||||
subsystems::NOTIFICATION
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
use crate::metrics::{new_gauge_md, subsystems, MetricDescriptor, MetricName};
|
||||
|
||||
/// 集群对象使用情况相关指标描述符
|
||||
lazy_static::lazy_static! {
|
||||
pub static ref USAGE_SINCE_LAST_UPDATE_SECONDS_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::UsageSinceLastUpdateSeconds,
|
||||
"Time since last update of usage metrics in seconds",
|
||||
&[], // 无标签
|
||||
subsystems::CLUSTER_USAGE_OBJECTS
|
||||
);
|
||||
|
||||
pub static ref USAGE_TOTAL_BYTES_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::UsageTotalBytes,
|
||||
"Total cluster usage in bytes",
|
||||
&[], // 无标签
|
||||
subsystems::CLUSTER_USAGE_OBJECTS
|
||||
);
|
||||
|
||||
pub static ref USAGE_OBJECTS_COUNT_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::UsageObjectsCount,
|
||||
"Total cluster objects count",
|
||||
&[], // 无标签
|
||||
subsystems::CLUSTER_USAGE_OBJECTS
|
||||
);
|
||||
|
||||
pub static ref USAGE_VERSIONS_COUNT_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::UsageVersionsCount,
|
||||
"Total cluster object versions (including delete markers) count",
|
||||
&[], // 无标签
|
||||
subsystems::CLUSTER_USAGE_OBJECTS
|
||||
);
|
||||
|
||||
pub static ref USAGE_DELETE_MARKERS_COUNT_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::UsageDeleteMarkersCount,
|
||||
"Total cluster delete markers count",
|
||||
&[], // 无标签
|
||||
subsystems::CLUSTER_USAGE_OBJECTS
|
||||
);
|
||||
|
||||
pub static ref USAGE_BUCKETS_COUNT_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::UsageBucketsCount,
|
||||
"Total cluster buckets count",
|
||||
&[], // 无标签
|
||||
subsystems::CLUSTER_USAGE_OBJECTS
|
||||
);
|
||||
|
||||
pub static ref USAGE_OBJECTS_DISTRIBUTION_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::UsageSizeDistribution,
|
||||
"Cluster object size distribution",
|
||||
&["range"], // 标签
|
||||
subsystems::CLUSTER_USAGE_OBJECTS
|
||||
);
|
||||
|
||||
pub static ref USAGE_VERSIONS_DISTRIBUTION_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::UsageVersionCountDistribution,
|
||||
"Cluster object version count distribution",
|
||||
&["range"], // 标签
|
||||
subsystems::CLUSTER_USAGE_OBJECTS
|
||||
);
|
||||
}
|
||||
|
||||
/// 定义常量
|
||||
pub const BUCKET_LABEL: &str = "bucket";
|
||||
pub const RANGE_LABEL: &str = "range";
|
||||
|
||||
/// 桶使用情况相关指标描述符
|
||||
lazy_static::lazy_static! {
|
||||
pub static ref USAGE_BUCKET_TOTAL_BYTES_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::UsageBucketTotalBytes,
|
||||
"Total bucket size in bytes",
|
||||
&[BUCKET_LABEL],
|
||||
subsystems::CLUSTER_USAGE_BUCKETS
|
||||
);
|
||||
|
||||
pub static ref USAGE_BUCKET_OBJECTS_TOTAL_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::UsageBucketObjectsCount,
|
||||
"Total objects count in bucket",
|
||||
&[BUCKET_LABEL],
|
||||
subsystems::CLUSTER_USAGE_BUCKETS
|
||||
);
|
||||
|
||||
pub static ref USAGE_BUCKET_VERSIONS_COUNT_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::UsageBucketVersionsCount,
|
||||
"Total object versions (including delete markers) count in bucket",
|
||||
&[BUCKET_LABEL],
|
||||
subsystems::CLUSTER_USAGE_BUCKETS
|
||||
);
|
||||
|
||||
pub static ref USAGE_BUCKET_DELETE_MARKERS_COUNT_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::UsageBucketDeleteMarkersCount,
|
||||
"Total delete markers count in bucket",
|
||||
&[BUCKET_LABEL],
|
||||
subsystems::CLUSTER_USAGE_BUCKETS
|
||||
);
|
||||
|
||||
pub static ref USAGE_BUCKET_QUOTA_TOTAL_BYTES_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::UsageBucketQuotaTotalBytes,
|
||||
"Total bucket quota in bytes",
|
||||
&[BUCKET_LABEL],
|
||||
subsystems::CLUSTER_USAGE_BUCKETS
|
||||
);
|
||||
|
||||
pub static ref USAGE_BUCKET_OBJECT_SIZE_DISTRIBUTION_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::UsageBucketObjectSizeDistribution,
|
||||
"Bucket object size distribution",
|
||||
&[RANGE_LABEL, BUCKET_LABEL],
|
||||
subsystems::CLUSTER_USAGE_BUCKETS
|
||||
);
|
||||
|
||||
pub static ref USAGE_BUCKET_OBJECT_VERSION_COUNT_DISTRIBUTION_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::UsageBucketObjectVersionCountDistribution,
|
||||
"Bucket object version count distribution",
|
||||
&[RANGE_LABEL, BUCKET_LABEL],
|
||||
subsystems::CLUSTER_USAGE_BUCKETS
|
||||
);
|
||||
}
|
||||
@@ -38,6 +38,7 @@ impl MetricDescriptor {
|
||||
}
|
||||
|
||||
/// 获取完整的指标名称,包含前缀和格式化路径
|
||||
#[allow(dead_code)]
|
||||
pub fn get_full_metric_name(&self) -> String {
|
||||
let prefix = self.metric_type.to_prom();
|
||||
let namespace = self.namespace.as_str();
|
||||
|
||||
@@ -168,11 +168,175 @@ pub enum MetricName {
|
||||
ConfigRRSParity,
|
||||
ConfigStandardParity,
|
||||
|
||||
// 纠删码集合相关指标
|
||||
ErasureSetOverallWriteQuorum,
|
||||
ErasureSetOverallHealth,
|
||||
ErasureSetReadQuorum,
|
||||
ErasureSetWriteQuorum,
|
||||
ErasureSetOnlineDrivesCount,
|
||||
ErasureSetHealingDrivesCount,
|
||||
ErasureSetHealth,
|
||||
ErasureSetReadTolerance,
|
||||
ErasureSetWriteTolerance,
|
||||
ErasureSetReadHealth,
|
||||
ErasureSetWriteHealth,
|
||||
|
||||
// 集群健康相关指标
|
||||
HealthDrivesOfflineCount,
|
||||
HealthDrivesOnlineCount,
|
||||
HealthDrivesCount,
|
||||
|
||||
// IAM 相关指标
|
||||
LastSyncDurationMillis,
|
||||
PluginAuthnServiceFailedRequestsMinute,
|
||||
PluginAuthnServiceLastFailSeconds,
|
||||
PluginAuthnServiceLastSuccSeconds,
|
||||
PluginAuthnServiceSuccAvgRttMsMinute,
|
||||
PluginAuthnServiceSuccMaxRttMsMinute,
|
||||
PluginAuthnServiceTotalRequestsMinute,
|
||||
SinceLastSyncMillis,
|
||||
SyncFailures,
|
||||
SyncSuccesses,
|
||||
|
||||
// 通知相关指标
|
||||
NotificationCurrentSendInProgress,
|
||||
NotificationEventsErrorsTotal,
|
||||
NotificationEventsSentTotal,
|
||||
NotificationEventsSkippedTotal,
|
||||
|
||||
// 集群对象使用情况相关指标
|
||||
UsageSinceLastUpdateSeconds,
|
||||
UsageTotalBytes,
|
||||
UsageObjectsCount,
|
||||
UsageVersionsCount,
|
||||
UsageDeleteMarkersCount,
|
||||
UsageBucketsCount,
|
||||
UsageSizeDistribution,
|
||||
UsageVersionCountDistribution,
|
||||
|
||||
// 桶使用情况相关指标
|
||||
UsageBucketQuotaTotalBytes,
|
||||
UsageBucketTotalBytes,
|
||||
UsageBucketObjectsCount,
|
||||
UsageBucketVersionsCount,
|
||||
UsageBucketDeleteMarkersCount,
|
||||
UsageBucketObjectSizeDistribution,
|
||||
UsageBucketObjectVersionCountDistribution,
|
||||
|
||||
// ILM 相关指标
|
||||
IlmExpiryPendingTasks,
|
||||
IlmTransitionActiveTasks,
|
||||
IlmTransitionPendingTasks,
|
||||
IlmTransitionMissedImmediateTasks,
|
||||
IlmVersionsScanned,
|
||||
|
||||
// Webhook 日志相关指标
|
||||
WebhookQueueLength,
|
||||
WebhookTotalMessages,
|
||||
WebhookFailedMessages,
|
||||
|
||||
// 复制相关指标
|
||||
ReplicationAverageActiveWorkers,
|
||||
ReplicationAverageQueuedBytes,
|
||||
ReplicationAverageQueuedCount,
|
||||
ReplicationAverageDataTransferRate,
|
||||
ReplicationCurrentActiveWorkers,
|
||||
ReplicationCurrentDataTransferRate,
|
||||
ReplicationLastMinuteQueuedBytes,
|
||||
ReplicationLastMinuteQueuedCount,
|
||||
ReplicationMaxActiveWorkers,
|
||||
ReplicationMaxQueuedBytes,
|
||||
ReplicationMaxQueuedCount,
|
||||
ReplicationMaxDataTransferRate,
|
||||
ReplicationRecentBacklogCount,
|
||||
|
||||
// 扫描器相关指标
|
||||
ScannerBucketScansFinished,
|
||||
ScannerBucketScansStarted,
|
||||
ScannerDirectoriesScanned,
|
||||
ScannerObjectsScanned,
|
||||
ScannerVersionsScanned,
|
||||
ScannerLastActivitySeconds,
|
||||
|
||||
// CPU 系统相关指标
|
||||
SysCPUAvgIdle,
|
||||
SysCPUAvgIOWait,
|
||||
SysCPULoad,
|
||||
SysCPULoadPerc,
|
||||
SysCPUNice,
|
||||
SysCPUSteal,
|
||||
SysCPUSystem,
|
||||
SysCPUUser,
|
||||
|
||||
// 驱动器相关指标
|
||||
DriveUsedBytes,
|
||||
DriveFreeBytes,
|
||||
DriveTotalBytes,
|
||||
DriveUsedInodes,
|
||||
DriveFreeInodes,
|
||||
DriveTotalInodes,
|
||||
DriveTimeoutErrorsTotal,
|
||||
DriveIOErrorsTotal,
|
||||
DriveAvailabilityErrorsTotal,
|
||||
DriveWaitingIO,
|
||||
DriveAPILatencyMicros,
|
||||
DriveHealth,
|
||||
|
||||
DriveOfflineCount,
|
||||
DriveOnlineCount,
|
||||
DriveCount,
|
||||
|
||||
// iostat 相关指标
|
||||
DriveReadsPerSec,
|
||||
DriveReadsKBPerSec,
|
||||
DriveReadsAwait,
|
||||
DriveWritesPerSec,
|
||||
DriveWritesKBPerSec,
|
||||
DriveWritesAwait,
|
||||
DrivePercUtil,
|
||||
|
||||
// 内存相关指标
|
||||
MemTotal,
|
||||
MemUsed,
|
||||
MemUsedPerc,
|
||||
MemFree,
|
||||
MemBuffers,
|
||||
MemCache,
|
||||
MemShared,
|
||||
MemAvailable,
|
||||
|
||||
// 网络相关指标
|
||||
InternodeErrorsTotal,
|
||||
InternodeDialErrorsTotal,
|
||||
InternodeDialAvgTimeNanos,
|
||||
InternodeSentBytesTotal,
|
||||
InternodeRecvBytesTotal,
|
||||
|
||||
// 进程相关指标
|
||||
ProcessLocksReadTotal,
|
||||
ProcessLocksWriteTotal,
|
||||
ProcessCPUTotalSeconds,
|
||||
ProcessGoRoutineTotal,
|
||||
ProcessIORCharBytes,
|
||||
ProcessIOReadBytes,
|
||||
ProcessIOWCharBytes,
|
||||
ProcessIOWriteBytes,
|
||||
ProcessStartTimeSeconds,
|
||||
ProcessUptimeSeconds,
|
||||
ProcessFileDescriptorLimitTotal,
|
||||
ProcessFileDescriptorOpenTotal,
|
||||
ProcessSyscallReadTotal,
|
||||
ProcessSyscallWriteTotal,
|
||||
ProcessResidentMemoryBytes,
|
||||
ProcessVirtualMemoryBytes,
|
||||
ProcessVirtualMemoryMaxBytes,
|
||||
|
||||
// 自定义指标
|
||||
Custom(String),
|
||||
}
|
||||
|
||||
impl MetricName {
|
||||
#[allow(dead_code)]
|
||||
pub fn as_str(&self) -> String {
|
||||
match self {
|
||||
Self::AuthTotal => "auth_total".to_string(),
|
||||
@@ -317,10 +481,173 @@ impl MetricName {
|
||||
Self::AuditTargetQueueLength => "target_queue_length".to_string(),
|
||||
Self::AuditTotalMessages => "total_messages".to_string(),
|
||||
|
||||
/// metrics related to cluster configurations
|
||||
// metrics related to cluster configurations
|
||||
Self::ConfigRRSParity => "rrs_parity".to_string(),
|
||||
Self::ConfigStandardParity => "standard_parity".to_string(),
|
||||
|
||||
// 纠删码集合相关指标
|
||||
Self::ErasureSetOverallWriteQuorum => "overall_write_quorum".to_string(),
|
||||
Self::ErasureSetOverallHealth => "overall_health".to_string(),
|
||||
Self::ErasureSetReadQuorum => "read_quorum".to_string(),
|
||||
Self::ErasureSetWriteQuorum => "write_quorum".to_string(),
|
||||
Self::ErasureSetOnlineDrivesCount => "online_drives_count".to_string(),
|
||||
Self::ErasureSetHealingDrivesCount => "healing_drives_count".to_string(),
|
||||
Self::ErasureSetHealth => "health".to_string(),
|
||||
Self::ErasureSetReadTolerance => "read_tolerance".to_string(),
|
||||
Self::ErasureSetWriteTolerance => "write_tolerance".to_string(),
|
||||
Self::ErasureSetReadHealth => "read_health".to_string(),
|
||||
Self::ErasureSetWriteHealth => "write_health".to_string(),
|
||||
|
||||
// 集群健康相关指标
|
||||
Self::HealthDrivesOfflineCount => "drives_offline_count".to_string(),
|
||||
Self::HealthDrivesOnlineCount => "drives_online_count".to_string(),
|
||||
Self::HealthDrivesCount => "drives_count".to_string(),
|
||||
|
||||
// IAM 相关指标
|
||||
Self::LastSyncDurationMillis => "last_sync_duration_millis".to_string(),
|
||||
Self::PluginAuthnServiceFailedRequestsMinute => "plugin_authn_service_failed_requests_minute".to_string(),
|
||||
Self::PluginAuthnServiceLastFailSeconds => "plugin_authn_service_last_fail_seconds".to_string(),
|
||||
Self::PluginAuthnServiceLastSuccSeconds => "plugin_authn_service_last_succ_seconds".to_string(),
|
||||
Self::PluginAuthnServiceSuccAvgRttMsMinute => "plugin_authn_service_succ_avg_rtt_ms_minute".to_string(),
|
||||
Self::PluginAuthnServiceSuccMaxRttMsMinute => "plugin_authn_service_succ_max_rtt_ms_minute".to_string(),
|
||||
Self::PluginAuthnServiceTotalRequestsMinute => "plugin_authn_service_total_requests_minute".to_string(),
|
||||
Self::SinceLastSyncMillis => "since_last_sync_millis".to_string(),
|
||||
Self::SyncFailures => "sync_failures".to_string(),
|
||||
Self::SyncSuccesses => "sync_successes".to_string(),
|
||||
|
||||
// 通知相关指标
|
||||
Self::NotificationCurrentSendInProgress => "current_send_in_progress".to_string(),
|
||||
Self::NotificationEventsErrorsTotal => "events_errors_total".to_string(),
|
||||
Self::NotificationEventsSentTotal => "events_sent_total".to_string(),
|
||||
Self::NotificationEventsSkippedTotal => "events_skipped_total".to_string(),
|
||||
|
||||
// 集群对象使用情况相关指标
|
||||
Self::UsageSinceLastUpdateSeconds => "since_last_update_seconds".to_string(),
|
||||
Self::UsageTotalBytes => "total_bytes".to_string(),
|
||||
Self::UsageObjectsCount => "count".to_string(),
|
||||
Self::UsageVersionsCount => "versions_count".to_string(),
|
||||
Self::UsageDeleteMarkersCount => "delete_markers_count".to_string(),
|
||||
Self::UsageBucketsCount => "buckets_count".to_string(),
|
||||
Self::UsageSizeDistribution => "size_distribution".to_string(),
|
||||
Self::UsageVersionCountDistribution => "version_count_distribution".to_string(),
|
||||
|
||||
// 桶使用情况相关指标
|
||||
Self::UsageBucketQuotaTotalBytes => "quota_total_bytes".to_string(),
|
||||
Self::UsageBucketTotalBytes => "total_bytes".to_string(),
|
||||
Self::UsageBucketObjectsCount => "objects_count".to_string(),
|
||||
Self::UsageBucketVersionsCount => "versions_count".to_string(),
|
||||
Self::UsageBucketDeleteMarkersCount => "delete_markers_count".to_string(),
|
||||
Self::UsageBucketObjectSizeDistribution => "object_size_distribution".to_string(),
|
||||
Self::UsageBucketObjectVersionCountDistribution => "object_version_count_distribution".to_string(),
|
||||
|
||||
// ILM 相关指标
|
||||
Self::IlmExpiryPendingTasks => "expiry_pending_tasks".to_string(),
|
||||
Self::IlmTransitionActiveTasks => "transition_active_tasks".to_string(),
|
||||
Self::IlmTransitionPendingTasks => "transition_pending_tasks".to_string(),
|
||||
Self::IlmTransitionMissedImmediateTasks => "transition_missed_immediate_tasks".to_string(),
|
||||
Self::IlmVersionsScanned => "versions_scanned".to_string(),
|
||||
|
||||
// Webhook 日志相关指标
|
||||
Self::WebhookQueueLength => "queue_length".to_string(),
|
||||
Self::WebhookTotalMessages => "total_messages".to_string(),
|
||||
Self::WebhookFailedMessages => "failed_messages".to_string(),
|
||||
|
||||
// 复制相关指标
|
||||
Self::ReplicationAverageActiveWorkers => "average_active_workers".to_string(),
|
||||
Self::ReplicationAverageQueuedBytes => "average_queued_bytes".to_string(),
|
||||
Self::ReplicationAverageQueuedCount => "average_queued_count".to_string(),
|
||||
Self::ReplicationAverageDataTransferRate => "average_data_transfer_rate".to_string(),
|
||||
Self::ReplicationCurrentActiveWorkers => "current_active_workers".to_string(),
|
||||
Self::ReplicationCurrentDataTransferRate => "current_data_transfer_rate".to_string(),
|
||||
Self::ReplicationLastMinuteQueuedBytes => "last_minute_queued_bytes".to_string(),
|
||||
Self::ReplicationLastMinuteQueuedCount => "last_minute_queued_count".to_string(),
|
||||
Self::ReplicationMaxActiveWorkers => "max_active_workers".to_string(),
|
||||
Self::ReplicationMaxQueuedBytes => "max_queued_bytes".to_string(),
|
||||
Self::ReplicationMaxQueuedCount => "max_queued_count".to_string(),
|
||||
Self::ReplicationMaxDataTransferRate => "max_data_transfer_rate".to_string(),
|
||||
Self::ReplicationRecentBacklogCount => "recent_backlog_count".to_string(),
|
||||
|
||||
// 扫描器相关指标
|
||||
Self::ScannerBucketScansFinished => "bucket_scans_finished".to_string(),
|
||||
Self::ScannerBucketScansStarted => "bucket_scans_started".to_string(),
|
||||
Self::ScannerDirectoriesScanned => "directories_scanned".to_string(),
|
||||
Self::ScannerObjectsScanned => "objects_scanned".to_string(),
|
||||
Self::ScannerVersionsScanned => "versions_scanned".to_string(),
|
||||
Self::ScannerLastActivitySeconds => "last_activity_seconds".to_string(),
|
||||
|
||||
// CPU 系统相关指标
|
||||
Self::SysCPUAvgIdle => "avg_idle".to_string(),
|
||||
Self::SysCPUAvgIOWait => "avg_iowait".to_string(),
|
||||
Self::SysCPULoad => "load".to_string(),
|
||||
Self::SysCPULoadPerc => "load_perc".to_string(),
|
||||
Self::SysCPUNice => "nice".to_string(),
|
||||
Self::SysCPUSteal => "steal".to_string(),
|
||||
Self::SysCPUSystem => "system".to_string(),
|
||||
Self::SysCPUUser => "user".to_string(),
|
||||
|
||||
// 驱动器相关指标
|
||||
Self::DriveUsedBytes => "used_bytes".to_string(),
|
||||
Self::DriveFreeBytes => "free_bytes".to_string(),
|
||||
Self::DriveTotalBytes => "total_bytes".to_string(),
|
||||
Self::DriveUsedInodes => "used_inodes".to_string(),
|
||||
Self::DriveFreeInodes => "free_inodes".to_string(),
|
||||
Self::DriveTotalInodes => "total_inodes".to_string(),
|
||||
Self::DriveTimeoutErrorsTotal => "timeout_errors_total".to_string(),
|
||||
Self::DriveIOErrorsTotal => "io_errors_total".to_string(),
|
||||
Self::DriveAvailabilityErrorsTotal => "availability_errors_total".to_string(),
|
||||
Self::DriveWaitingIO => "waiting_io".to_string(),
|
||||
Self::DriveAPILatencyMicros => "api_latency_micros".to_string(),
|
||||
Self::DriveHealth => "health".to_string(),
|
||||
|
||||
Self::DriveOfflineCount => "offline_count".to_string(),
|
||||
Self::DriveOnlineCount => "online_count".to_string(),
|
||||
Self::DriveCount => "count".to_string(),
|
||||
|
||||
// iostat 相关指标
|
||||
Self::DriveReadsPerSec => "reads_per_sec".to_string(),
|
||||
Self::DriveReadsKBPerSec => "reads_kb_per_sec".to_string(),
|
||||
Self::DriveReadsAwait => "reads_await".to_string(),
|
||||
Self::DriveWritesPerSec => "writes_per_sec".to_string(),
|
||||
Self::DriveWritesKBPerSec => "writes_kb_per_sec".to_string(),
|
||||
Self::DriveWritesAwait => "writes_await".to_string(),
|
||||
Self::DrivePercUtil => "perc_util".to_string(),
|
||||
|
||||
// 内存相关指标
|
||||
Self::MemTotal => "total".to_string(),
|
||||
Self::MemUsed => "used".to_string(),
|
||||
Self::MemUsedPerc => "used_perc".to_string(),
|
||||
Self::MemFree => "free".to_string(),
|
||||
Self::MemBuffers => "buffers".to_string(),
|
||||
Self::MemCache => "cache".to_string(),
|
||||
Self::MemShared => "shared".to_string(),
|
||||
Self::MemAvailable => "available".to_string(),
|
||||
|
||||
// 网络相关指标
|
||||
Self::InternodeErrorsTotal => "errors_total".to_string(),
|
||||
Self::InternodeDialErrorsTotal => "dial_errors_total".to_string(),
|
||||
Self::InternodeDialAvgTimeNanos => "dial_avg_time_nanos".to_string(),
|
||||
Self::InternodeSentBytesTotal => "sent_bytes_total".to_string(),
|
||||
Self::InternodeRecvBytesTotal => "recv_bytes_total".to_string(),
|
||||
|
||||
// 进程相关指标
|
||||
Self::ProcessLocksReadTotal => "locks_read_total".to_string(),
|
||||
Self::ProcessLocksWriteTotal => "locks_write_total".to_string(),
|
||||
Self::ProcessCPUTotalSeconds => "cpu_total_seconds".to_string(),
|
||||
Self::ProcessGoRoutineTotal => "go_routine_total".to_string(),
|
||||
Self::ProcessIORCharBytes => "io_rchar_bytes".to_string(),
|
||||
Self::ProcessIOReadBytes => "io_read_bytes".to_string(),
|
||||
Self::ProcessIOWCharBytes => "io_wchar_bytes".to_string(),
|
||||
Self::ProcessIOWriteBytes => "io_write_bytes".to_string(),
|
||||
Self::ProcessStartTimeSeconds => "start_time_seconds".to_string(),
|
||||
Self::ProcessUptimeSeconds => "uptime_seconds".to_string(),
|
||||
Self::ProcessFileDescriptorLimitTotal => "file_descriptor_limit_total".to_string(),
|
||||
Self::ProcessFileDescriptorOpenTotal => "file_descriptor_open_total".to_string(),
|
||||
Self::ProcessSyscallReadTotal => "syscall_read_total".to_string(),
|
||||
Self::ProcessSyscallWriteTotal => "syscall_write_total".to_string(),
|
||||
Self::ProcessResidentMemoryBytes => "resident_memory_bytes".to_string(),
|
||||
Self::ProcessVirtualMemoryBytes => "virtual_memory_bytes".to_string(),
|
||||
Self::ProcessVirtualMemoryMaxBytes => "virtual_memory_max_bytes".to_string(),
|
||||
|
||||
Self::Custom(name) => name.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ impl MetricType {
|
||||
|
||||
/// Convert the metric type to the Prometheus value type
|
||||
/// In a Rust implementation, this might return the corresponding Prometheus Rust client type
|
||||
#[allow(dead_code)]
|
||||
pub fn to_prom(&self) -> &'static str {
|
||||
match self {
|
||||
Self::Counter => "counter.",
|
||||
|
||||
@@ -5,6 +5,7 @@ pub enum MetricNamespace {
|
||||
}
|
||||
|
||||
impl MetricNamespace {
|
||||
#[allow(dead_code)]
|
||||
pub fn as_str(&self) -> &'static str {
|
||||
match self {
|
||||
Self::RustFS => "rustfs",
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/// Format the path to the metric name format
|
||||
/// Replace '/' and '-' with '_'
|
||||
#[allow(dead_code)]
|
||||
pub fn format_path_to_metric_name(path: &str) -> String {
|
||||
path.trim_start_matches('/').replace('/', "_").replace('-', "_")
|
||||
path.trim_start_matches('/').replace(['/', '-'], "_")
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
use crate::metrics::entry::path_utils::format_path_to_metric_name;
|
||||
|
||||
/// The metrics subsystem is a subgroup of metrics within a namespace
|
||||
/// 指标子系统,表示命名空间内指标的子分组
|
||||
/// The metrics subsystem, which represents a subgroup of metrics within a namespace
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub enum MetricSubsystem {
|
||||
// API 相关子系统
|
||||
// API related subsystems
|
||||
ApiRequests,
|
||||
|
||||
// 桶相关子系统
|
||||
// bucket related subsystems
|
||||
BucketApi,
|
||||
BucketReplication,
|
||||
|
||||
// 系统相关子系统
|
||||
// system related subsystems
|
||||
SystemNetworkInternode,
|
||||
SystemDrive,
|
||||
SystemMemory,
|
||||
SystemCpu,
|
||||
SystemProcess,
|
||||
|
||||
// 调试相关子系统
|
||||
// debug related subsystems
|
||||
DebugGo,
|
||||
|
||||
// 集群相关子系统
|
||||
// cluster related subsystems
|
||||
ClusterHealth,
|
||||
ClusterUsageObjects,
|
||||
ClusterUsageBuckets,
|
||||
@@ -29,7 +29,7 @@ pub enum MetricSubsystem {
|
||||
ClusterIam,
|
||||
ClusterConfig,
|
||||
|
||||
// 其他服务相关子系统
|
||||
// other service related subsystems
|
||||
Ilm,
|
||||
Audit,
|
||||
LoggerWebhook,
|
||||
@@ -37,32 +37,32 @@ pub enum MetricSubsystem {
|
||||
Notification,
|
||||
Scanner,
|
||||
|
||||
// 自定义路径
|
||||
// Custom paths
|
||||
Custom(String),
|
||||
}
|
||||
|
||||
impl MetricSubsystem {
|
||||
/// 获取原始路径字符串
|
||||
/// Gets the original path string
|
||||
pub fn path(&self) -> &str {
|
||||
match self {
|
||||
// API 相关子系统
|
||||
// api related subsystems
|
||||
Self::ApiRequests => "/api/requests",
|
||||
|
||||
// 桶相关子系统
|
||||
// bucket related subsystems
|
||||
Self::BucketApi => "/bucket/api",
|
||||
Self::BucketReplication => "/bucket/replication",
|
||||
|
||||
// 系统相关子系统
|
||||
// system related subsystems
|
||||
Self::SystemNetworkInternode => "/system/network/internode",
|
||||
Self::SystemDrive => "/system/drive",
|
||||
Self::SystemMemory => "/system/memory",
|
||||
Self::SystemCpu => "/system/cpu",
|
||||
Self::SystemProcess => "/system/process",
|
||||
|
||||
// 调试相关子系统
|
||||
// debug related subsystems
|
||||
Self::DebugGo => "/debug/go",
|
||||
|
||||
// 集群相关子系统
|
||||
// cluster related subsystems
|
||||
Self::ClusterHealth => "/cluster/health",
|
||||
Self::ClusterUsageObjects => "/cluster/usage/objects",
|
||||
Self::ClusterUsageBuckets => "/cluster/usage/buckets",
|
||||
@@ -70,7 +70,7 @@ impl MetricSubsystem {
|
||||
Self::ClusterIam => "/cluster/iam",
|
||||
Self::ClusterConfig => "/cluster/config",
|
||||
|
||||
// 其他服务相关子系统
|
||||
// other service related subsystems
|
||||
Self::Ilm => "/ilm",
|
||||
Self::Audit => "/audit",
|
||||
Self::LoggerWebhook => "/logger/webhook",
|
||||
@@ -78,17 +78,18 @@ impl MetricSubsystem {
|
||||
Self::Notification => "/notification",
|
||||
Self::Scanner => "/scanner",
|
||||
|
||||
// 自定义路径
|
||||
// Custom paths
|
||||
Self::Custom(path) => path,
|
||||
}
|
||||
}
|
||||
|
||||
/// 获取格式化后的指标名称格式字符串
|
||||
/// Get the formatted metric name format string
|
||||
#[allow(dead_code)]
|
||||
pub fn as_str(&self) -> String {
|
||||
format_path_to_metric_name(self.path())
|
||||
}
|
||||
|
||||
/// 从路径字符串创建子系统枚举
|
||||
/// Create a subsystem enumeration from a path string
|
||||
pub fn from_path(path: &str) -> Self {
|
||||
match path {
|
||||
// API 相关子系统
|
||||
@@ -129,13 +130,14 @@ impl MetricSubsystem {
|
||||
}
|
||||
}
|
||||
|
||||
// 便利方法,直接创建自定义子系统
|
||||
/// A convenient way to create custom subsystems directly
|
||||
#[allow(dead_code)]
|
||||
pub fn new(path: impl Into<String>) -> Self {
|
||||
Self::Custom(path.into())
|
||||
}
|
||||
}
|
||||
|
||||
// 便于与字符串相互转换的实现
|
||||
/// Implementations that facilitate conversion to and from strings
|
||||
impl From<&str> for MetricSubsystem {
|
||||
fn from(s: &str) -> Self {
|
||||
Self::from_path(s)
|
||||
@@ -158,10 +160,10 @@ impl std::fmt::Display for MetricSubsystem {
|
||||
pub mod subsystems {
|
||||
use super::MetricSubsystem;
|
||||
|
||||
// 集群基本路径常量
|
||||
// cluster base path constant
|
||||
pub const CLUSTER_BASE_PATH: &str = "/cluster";
|
||||
|
||||
// 快捷访问各子系统的常量
|
||||
// Quick access to constants for each subsystem
|
||||
pub const API_REQUESTS: MetricSubsystem = MetricSubsystem::ApiRequests;
|
||||
pub const BUCKET_API: MetricSubsystem = MetricSubsystem::BucketApi;
|
||||
pub const BUCKET_REPLICATION: MetricSubsystem = MetricSubsystem::BucketReplication;
|
||||
@@ -198,7 +200,7 @@ mod tests {
|
||||
assert_eq!(MetricSubsystem::BucketApi.as_str(), "bucket_api");
|
||||
assert_eq!(MetricSubsystem::ClusterHealth.as_str(), "cluster_health");
|
||||
|
||||
// 测试自定义路径
|
||||
// Test custom paths
|
||||
let custom = MetricSubsystem::new("/custom/path-test");
|
||||
assert_eq!(custom.as_str(), "custom_path_test");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
use crate::metrics::{new_counter_md, new_gauge_md, subsystems, MetricDescriptor, MetricName};
|
||||
|
||||
/// ILM 相关指标描述符
|
||||
lazy_static::lazy_static! {
|
||||
pub static ref ILM_EXPIRY_PENDING_TASKS_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::IlmExpiryPendingTasks,
|
||||
"Number of pending ILM expiry tasks in the queue",
|
||||
&[], // 无标签
|
||||
subsystems::ILM
|
||||
);
|
||||
|
||||
pub static ref ILM_TRANSITION_ACTIVE_TASKS_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::IlmTransitionActiveTasks,
|
||||
"Number of active ILM transition tasks",
|
||||
&[], // 无标签
|
||||
subsystems::ILM
|
||||
);
|
||||
|
||||
pub static ref ILM_TRANSITION_PENDING_TASKS_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::IlmTransitionPendingTasks,
|
||||
"Number of pending ILM transition tasks in the queue",
|
||||
&[], // 无标签
|
||||
subsystems::ILM
|
||||
);
|
||||
|
||||
pub static ref ILM_TRANSITION_MISSED_IMMEDIATE_TASKS_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::IlmTransitionMissedImmediateTasks,
|
||||
"Number of missed immediate ILM transition tasks",
|
||||
&[], // 无标签
|
||||
subsystems::ILM
|
||||
);
|
||||
|
||||
pub static ref ILM_VERSIONS_SCANNED_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::IlmVersionsScanned,
|
||||
"Total number of object versions checked for ILM actions since server start",
|
||||
&[], // 无标签
|
||||
subsystems::ILM
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
use crate::metrics::{new_counter_md, new_gauge_md, subsystems, MetricDescriptor, MetricName};
|
||||
|
||||
/// 定义标签常量
|
||||
pub const NAME_LABEL: &str = "name";
|
||||
pub const ENDPOINT_LABEL: &str = "endpoint";
|
||||
|
||||
/// Webhook 日志相关指标描述符
|
||||
lazy_static::lazy_static! {
|
||||
// 所有 Webhook 指标使用的标签
|
||||
static ref ALL_WEBHOOK_LABELS: [&'static str; 2] = [NAME_LABEL, ENDPOINT_LABEL];
|
||||
|
||||
pub static ref WEBHOOK_FAILED_MESSAGES_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::WebhookFailedMessages,
|
||||
"Number of messages that failed to send",
|
||||
&ALL_WEBHOOK_LABELS[..],
|
||||
subsystems::LOGGER_WEBHOOK
|
||||
);
|
||||
|
||||
pub static ref WEBHOOK_QUEUE_LENGTH_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::WebhookQueueLength,
|
||||
"Webhook queue length",
|
||||
&ALL_WEBHOOK_LABELS[..],
|
||||
subsystems::LOGGER_WEBHOOK
|
||||
);
|
||||
|
||||
pub static ref WEBHOOK_TOTAL_MESSAGES_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::WebhookTotalMessages,
|
||||
"Total number of messages sent to this target",
|
||||
&ALL_WEBHOOK_LABELS[..],
|
||||
subsystems::LOGGER_WEBHOOK
|
||||
);
|
||||
}
|
||||
@@ -1,8 +1,22 @@
|
||||
mod audit;
|
||||
mod bucket;
|
||||
mod bucket_replication;
|
||||
mod cluster_erasure_set;
|
||||
mod cluster_health;
|
||||
mod cluster_iam;
|
||||
mod cluster_notification;
|
||||
mod cluster_usage;
|
||||
mod entry;
|
||||
mod ilm;
|
||||
mod logger_webhook;
|
||||
mod replication;
|
||||
mod request;
|
||||
mod scanner;
|
||||
mod system_cpu;
|
||||
mod system_drive;
|
||||
mod system_memory;
|
||||
mod system_network;
|
||||
mod system_process;
|
||||
|
||||
pub use entry::descriptor::MetricDescriptor;
|
||||
pub use entry::metric_name::MetricName;
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
use crate::metrics::{new_gauge_md, subsystems, MetricDescriptor, MetricName};
|
||||
|
||||
/// 复制相关指标描述符
|
||||
lazy_static::lazy_static! {
|
||||
pub static ref REPLICATION_AVERAGE_ACTIVE_WORKERS_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::ReplicationAverageActiveWorkers,
|
||||
"Average number of active replication workers",
|
||||
&[], // 无标签
|
||||
subsystems::REPLICATION
|
||||
);
|
||||
|
||||
pub static ref REPLICATION_AVERAGE_QUEUED_BYTES_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::ReplicationAverageQueuedBytes,
|
||||
"Average number of bytes queued for replication since server start",
|
||||
&[], // 无标签
|
||||
subsystems::REPLICATION
|
||||
);
|
||||
|
||||
pub static ref REPLICATION_AVERAGE_QUEUED_COUNT_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::ReplicationAverageQueuedCount,
|
||||
"Average number of objects queued for replication since server start",
|
||||
&[], // 无标签
|
||||
subsystems::REPLICATION
|
||||
);
|
||||
|
||||
pub static ref REPLICATION_AVERAGE_DATA_TRANSFER_RATE_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::ReplicationAverageDataTransferRate,
|
||||
"Average replication data transfer rate in bytes/sec",
|
||||
&[], // 无标签
|
||||
subsystems::REPLICATION
|
||||
);
|
||||
|
||||
pub static ref REPLICATION_CURRENT_ACTIVE_WORKERS_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::ReplicationCurrentActiveWorkers,
|
||||
"Total number of active replication workers",
|
||||
&[], // 无标签
|
||||
subsystems::REPLICATION
|
||||
);
|
||||
|
||||
pub static ref REPLICATION_CURRENT_DATA_TRANSFER_RATE_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::ReplicationCurrentDataTransferRate,
|
||||
"Current replication data transfer rate in bytes/sec",
|
||||
&[], // 无标签
|
||||
subsystems::REPLICATION
|
||||
);
|
||||
|
||||
pub static ref REPLICATION_LAST_MINUTE_QUEUED_BYTES_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::ReplicationLastMinuteQueuedBytes,
|
||||
"Number of bytes queued for replication in the last full minute",
|
||||
&[], // 无标签
|
||||
subsystems::REPLICATION
|
||||
);
|
||||
|
||||
pub static ref REPLICATION_LAST_MINUTE_QUEUED_COUNT_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::ReplicationLastMinuteQueuedCount,
|
||||
"Number of objects queued for replication in the last full minute",
|
||||
&[], // 无标签
|
||||
subsystems::REPLICATION
|
||||
);
|
||||
|
||||
pub static ref REPLICATION_MAX_ACTIVE_WORKERS_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::ReplicationMaxActiveWorkers,
|
||||
"Maximum number of active replication workers seen since server start",
|
||||
&[], // 无标签
|
||||
subsystems::REPLICATION
|
||||
);
|
||||
|
||||
pub static ref REPLICATION_MAX_QUEUED_BYTES_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::ReplicationMaxQueuedBytes,
|
||||
"Maximum number of bytes queued for replication since server start",
|
||||
&[], // 无标签
|
||||
subsystems::REPLICATION
|
||||
);
|
||||
|
||||
pub static ref REPLICATION_MAX_QUEUED_COUNT_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::ReplicationMaxQueuedCount,
|
||||
"Maximum number of objects queued for replication since server start",
|
||||
&[], // 无标签
|
||||
subsystems::REPLICATION
|
||||
);
|
||||
|
||||
pub static ref REPLICATION_MAX_DATA_TRANSFER_RATE_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::ReplicationMaxDataTransferRate,
|
||||
"Maximum replication data transfer rate in bytes/sec seen since server start",
|
||||
&[], // 无标签
|
||||
subsystems::REPLICATION
|
||||
);
|
||||
|
||||
pub static ref REPLICATION_RECENT_BACKLOG_COUNT_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::ReplicationRecentBacklogCount,
|
||||
"Total number of objects seen in replication backlog in the last 5 minutes",
|
||||
&[], // 无标签
|
||||
subsystems::REPLICATION
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
use crate::metrics::{new_counter_md, new_gauge_md, subsystems, MetricDescriptor, MetricName};
|
||||
|
||||
/// 扫描器相关指标描述符
|
||||
lazy_static::lazy_static! {
|
||||
pub static ref SCANNER_BUCKET_SCANS_FINISHED_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::ScannerBucketScansFinished,
|
||||
"Total number of bucket scans finished since server start",
|
||||
&[], // 无标签
|
||||
subsystems::SCANNER
|
||||
);
|
||||
|
||||
pub static ref SCANNER_BUCKET_SCANS_STARTED_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::ScannerBucketScansStarted,
|
||||
"Total number of bucket scans started since server start",
|
||||
&[], // 无标签
|
||||
subsystems::SCANNER
|
||||
);
|
||||
|
||||
pub static ref SCANNER_DIRECTORIES_SCANNED_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::ScannerDirectoriesScanned,
|
||||
"Total number of directories scanned since server start",
|
||||
&[], // 无标签
|
||||
subsystems::SCANNER
|
||||
);
|
||||
|
||||
pub static ref SCANNER_OBJECTS_SCANNED_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::ScannerObjectsScanned,
|
||||
"Total number of unique objects scanned since server start",
|
||||
&[], // 无标签
|
||||
subsystems::SCANNER
|
||||
);
|
||||
|
||||
pub static ref SCANNER_VERSIONS_SCANNED_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::ScannerVersionsScanned,
|
||||
"Total number of object versions scanned since server start",
|
||||
&[], // 无标签
|
||||
subsystems::SCANNER
|
||||
);
|
||||
|
||||
pub static ref SCANNER_LAST_ACTIVITY_SECONDS_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::ScannerLastActivitySeconds,
|
||||
"Time elapsed (in seconds) since last scan activity.",
|
||||
&[], // 无标签
|
||||
subsystems::SCANNER
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
use crate::metrics::{new_gauge_md, subsystems, MetricDescriptor, MetricName};
|
||||
|
||||
/// CPU 系统相关指标描述符
|
||||
lazy_static::lazy_static! {
|
||||
pub static ref SYS_CPU_AVG_IDLE_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::SysCPUAvgIdle,
|
||||
"Average CPU idle time",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_CPU
|
||||
);
|
||||
|
||||
pub static ref SYS_CPU_AVG_IOWAIT_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::SysCPUAvgIOWait,
|
||||
"Average CPU IOWait time",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_CPU
|
||||
);
|
||||
|
||||
pub static ref SYS_CPU_LOAD_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::SysCPULoad,
|
||||
"CPU load average 1min",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_CPU
|
||||
);
|
||||
|
||||
pub static ref SYS_CPU_LOAD_PERC_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::SysCPULoadPerc,
|
||||
"CPU load average 1min (percentage)",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_CPU
|
||||
);
|
||||
|
||||
pub static ref SYS_CPU_NICE_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::SysCPUNice,
|
||||
"CPU nice time",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_CPU
|
||||
);
|
||||
|
||||
pub static ref SYS_CPU_STEAL_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::SysCPUSteal,
|
||||
"CPU steal time",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_CPU
|
||||
);
|
||||
|
||||
pub static ref SYS_CPU_SYSTEM_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::SysCPUSystem,
|
||||
"CPU system time",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_CPU
|
||||
);
|
||||
|
||||
pub static ref SYS_CPU_USER_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::SysCPUUser,
|
||||
"CPU user time",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_CPU
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
use crate::metrics::{new_counter_md, new_gauge_md, subsystems, MetricDescriptor, MetricName};
|
||||
|
||||
/// 定义标签常量
|
||||
pub const DRIVE_LABEL: &str = "drive";
|
||||
pub const POOL_INDEX_LABEL: &str = "pool_index";
|
||||
pub const SET_INDEX_LABEL: &str = "set_index";
|
||||
pub const DRIVE_INDEX_LABEL: &str = "drive_index";
|
||||
pub const API_LABEL: &str = "api";
|
||||
|
||||
/// 所有驱动器相关的标签
|
||||
lazy_static::lazy_static! {
|
||||
static ref ALL_DRIVE_LABELS: [&'static str; 4] = [DRIVE_LABEL, POOL_INDEX_LABEL, SET_INDEX_LABEL, DRIVE_INDEX_LABEL];
|
||||
}
|
||||
|
||||
/// 驱动器相关指标描述符
|
||||
lazy_static::lazy_static! {
|
||||
pub static ref DRIVE_USED_BYTES_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::DriveUsedBytes,
|
||||
"Total storage used on a drive in bytes",
|
||||
&ALL_DRIVE_LABELS[..],
|
||||
subsystems::SYSTEM_DRIVE
|
||||
);
|
||||
|
||||
pub static ref DRIVE_FREE_BYTES_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::DriveFreeBytes,
|
||||
"Total storage free on a drive in bytes",
|
||||
&ALL_DRIVE_LABELS[..],
|
||||
subsystems::SYSTEM_DRIVE
|
||||
);
|
||||
|
||||
pub static ref DRIVE_TOTAL_BYTES_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::DriveTotalBytes,
|
||||
"Total storage available on a drive in bytes",
|
||||
&ALL_DRIVE_LABELS[..],
|
||||
subsystems::SYSTEM_DRIVE
|
||||
);
|
||||
|
||||
pub static ref DRIVE_USED_INODES_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::DriveUsedInodes,
|
||||
"Total used inodes on a drive",
|
||||
&ALL_DRIVE_LABELS[..],
|
||||
subsystems::SYSTEM_DRIVE
|
||||
);
|
||||
|
||||
pub static ref DRIVE_FREE_INODES_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::DriveFreeInodes,
|
||||
"Total free inodes on a drive",
|
||||
&ALL_DRIVE_LABELS[..],
|
||||
subsystems::SYSTEM_DRIVE
|
||||
);
|
||||
|
||||
pub static ref DRIVE_TOTAL_INODES_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::DriveTotalInodes,
|
||||
"Total inodes available on a drive",
|
||||
&ALL_DRIVE_LABELS[..],
|
||||
subsystems::SYSTEM_DRIVE
|
||||
);
|
||||
|
||||
pub static ref DRIVE_TIMEOUT_ERRORS_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::DriveTimeoutErrorsTotal,
|
||||
"Total timeout errors on a drive",
|
||||
&ALL_DRIVE_LABELS[..],
|
||||
subsystems::SYSTEM_DRIVE
|
||||
);
|
||||
|
||||
pub static ref DRIVE_IO_ERRORS_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::DriveIOErrorsTotal,
|
||||
"Total I/O errors on a drive",
|
||||
&ALL_DRIVE_LABELS[..],
|
||||
subsystems::SYSTEM_DRIVE
|
||||
);
|
||||
|
||||
pub static ref DRIVE_AVAILABILITY_ERRORS_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::DriveAvailabilityErrorsTotal,
|
||||
"Total availability errors (I/O errors, timeouts) on a drive",
|
||||
&ALL_DRIVE_LABELS[..],
|
||||
subsystems::SYSTEM_DRIVE
|
||||
);
|
||||
|
||||
pub static ref DRIVE_WAITING_IO_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::DriveWaitingIO,
|
||||
"Total waiting I/O operations on a drive",
|
||||
&ALL_DRIVE_LABELS[..],
|
||||
subsystems::SYSTEM_DRIVE
|
||||
);
|
||||
|
||||
pub static ref DRIVE_API_LATENCY_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::DriveAPILatencyMicros,
|
||||
"Average last minute latency in µs for drive API storage operations",
|
||||
&[&ALL_DRIVE_LABELS[..], &[API_LABEL]].concat(),
|
||||
subsystems::SYSTEM_DRIVE
|
||||
);
|
||||
|
||||
pub static ref DRIVE_HEALTH_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::DriveHealth,
|
||||
"Drive health (0 = offline, 1 = healthy, 2 = healing)",
|
||||
&ALL_DRIVE_LABELS[..],
|
||||
subsystems::SYSTEM_DRIVE
|
||||
);
|
||||
|
||||
pub static ref DRIVE_OFFLINE_COUNT_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::DriveOfflineCount,
|
||||
"Count of offline drives",
|
||||
&[],
|
||||
subsystems::SYSTEM_DRIVE
|
||||
);
|
||||
|
||||
pub static ref DRIVE_ONLINE_COUNT_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::DriveOnlineCount,
|
||||
"Count of online drives",
|
||||
&[],
|
||||
subsystems::SYSTEM_DRIVE
|
||||
);
|
||||
|
||||
pub static ref DRIVE_COUNT_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::DriveCount,
|
||||
"Count of all drives",
|
||||
&[],
|
||||
subsystems::SYSTEM_DRIVE
|
||||
);
|
||||
|
||||
pub static ref DRIVE_READS_PER_SEC_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::DriveReadsPerSec,
|
||||
"Reads per second on a drive",
|
||||
&ALL_DRIVE_LABELS[..],
|
||||
subsystems::SYSTEM_DRIVE
|
||||
);
|
||||
|
||||
pub static ref DRIVE_READS_KB_PER_SEC_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::DriveReadsKBPerSec,
|
||||
"Kilobytes read per second on a drive",
|
||||
&ALL_DRIVE_LABELS[..],
|
||||
subsystems::SYSTEM_DRIVE
|
||||
);
|
||||
|
||||
pub static ref DRIVE_READS_AWAIT_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::DriveReadsAwait,
|
||||
"Average time for read requests served on a drive",
|
||||
&ALL_DRIVE_LABELS[..],
|
||||
subsystems::SYSTEM_DRIVE
|
||||
);
|
||||
|
||||
pub static ref DRIVE_WRITES_PER_SEC_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::DriveWritesPerSec,
|
||||
"Writes per second on a drive",
|
||||
&ALL_DRIVE_LABELS[..],
|
||||
subsystems::SYSTEM_DRIVE
|
||||
);
|
||||
|
||||
pub static ref DRIVE_WRITES_KB_PER_SEC_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::DriveWritesKBPerSec,
|
||||
"Kilobytes written per second on a drive",
|
||||
&ALL_DRIVE_LABELS[..],
|
||||
subsystems::SYSTEM_DRIVE
|
||||
);
|
||||
|
||||
pub static ref DRIVE_WRITES_AWAIT_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::DriveWritesAwait,
|
||||
"Average time for write requests served on a drive",
|
||||
&ALL_DRIVE_LABELS[..],
|
||||
subsystems::SYSTEM_DRIVE
|
||||
);
|
||||
|
||||
pub static ref DRIVE_PERC_UTIL_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::DrivePercUtil,
|
||||
"Percentage of time the disk was busy",
|
||||
&ALL_DRIVE_LABELS[..],
|
||||
subsystems::SYSTEM_DRIVE
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
use crate::metrics::{new_gauge_md, subsystems, MetricDescriptor, MetricName};
|
||||
|
||||
/// 内存相关指标描述符
|
||||
lazy_static::lazy_static! {
|
||||
pub static ref MEM_TOTAL_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::MemTotal,
|
||||
"Total memory on the node",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_MEMORY
|
||||
);
|
||||
|
||||
pub static ref MEM_USED_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::MemUsed,
|
||||
"Used memory on the node",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_MEMORY
|
||||
);
|
||||
|
||||
pub static ref MEM_USED_PERC_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::MemUsedPerc,
|
||||
"Used memory percentage on the node",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_MEMORY
|
||||
);
|
||||
|
||||
pub static ref MEM_FREE_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::MemFree,
|
||||
"Free memory on the node",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_MEMORY
|
||||
);
|
||||
|
||||
pub static ref MEM_BUFFERS_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::MemBuffers,
|
||||
"Buffers memory on the node",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_MEMORY
|
||||
);
|
||||
|
||||
pub static ref MEM_CACHE_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::MemCache,
|
||||
"Cache memory on the node",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_MEMORY
|
||||
);
|
||||
|
||||
pub static ref MEM_SHARED_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::MemShared,
|
||||
"Shared memory on the node",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_MEMORY
|
||||
);
|
||||
|
||||
pub static ref MEM_AVAILABLE_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::MemAvailable,
|
||||
"Available memory on the node",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_MEMORY
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
use crate::metrics::{new_counter_md, new_gauge_md, subsystems, MetricDescriptor, MetricName};
|
||||
|
||||
/// 网络相关指标描述符
|
||||
lazy_static::lazy_static! {
|
||||
pub static ref INTERNODE_ERRORS_TOTAL_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::InternodeErrorsTotal,
|
||||
"Total number of failed internode calls",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_NETWORK_INTERNODE
|
||||
);
|
||||
|
||||
pub static ref INTERNODE_DIAL_ERRORS_TOTAL_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::InternodeDialErrorsTotal,
|
||||
"Total number of internode TCP dial timeouts and errors",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_NETWORK_INTERNODE
|
||||
);
|
||||
|
||||
pub static ref INTERNODE_DIAL_AVG_TIME_NANOS_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::InternodeDialAvgTimeNanos,
|
||||
"Average dial time of internode TCP calls in nanoseconds",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_NETWORK_INTERNODE
|
||||
);
|
||||
|
||||
pub static ref INTERNODE_SENT_BYTES_TOTAL_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::InternodeSentBytesTotal,
|
||||
"Total number of bytes sent to other peer nodes",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_NETWORK_INTERNODE
|
||||
);
|
||||
|
||||
pub static ref INTERNODE_RECV_BYTES_TOTAL_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::InternodeRecvBytesTotal,
|
||||
"Total number of bytes received from other peer nodes",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_NETWORK_INTERNODE
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
use crate::metrics::{new_counter_md, new_gauge_md, subsystems, MetricDescriptor, MetricName};
|
||||
|
||||
/// process related metric descriptors
|
||||
lazy_static::lazy_static! {
|
||||
pub static ref PROCESS_LOCKS_READ_TOTAL_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::ProcessLocksReadTotal,
|
||||
"Number of current READ locks on this peer",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_PROCESS
|
||||
);
|
||||
|
||||
pub static ref PROCESS_LOCKS_WRITE_TOTAL_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::ProcessLocksWriteTotal,
|
||||
"Number of current WRITE locks on this peer",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_PROCESS
|
||||
);
|
||||
|
||||
pub static ref PROCESS_CPU_TOTAL_SECONDS_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::ProcessCPUTotalSeconds,
|
||||
"Total user and system CPU time spent in seconds",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_PROCESS
|
||||
);
|
||||
|
||||
pub static ref PROCESS_GO_ROUTINE_TOTAL_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::ProcessGoRoutineTotal,
|
||||
"Total number of go routines running",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_PROCESS
|
||||
);
|
||||
|
||||
pub static ref PROCESS_IO_RCHAR_BYTES_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::ProcessIORCharBytes,
|
||||
"Total bytes read by the process from the underlying storage system including cache, /proc/[pid]/io rchar",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_PROCESS
|
||||
);
|
||||
|
||||
pub static ref PROCESS_IO_READ_BYTES_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::ProcessIOReadBytes,
|
||||
"Total bytes read by the process from the underlying storage system, /proc/[pid]/io read_bytes",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_PROCESS
|
||||
);
|
||||
|
||||
pub static ref PROCESS_IO_WCHAR_BYTES_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::ProcessIOWCharBytes,
|
||||
"Total bytes written by the process to the underlying storage system including page cache, /proc/[pid]/io wchar",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_PROCESS
|
||||
);
|
||||
|
||||
pub static ref PROCESS_IO_WRITE_BYTES_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::ProcessIOWriteBytes,
|
||||
"Total bytes written by the process to the underlying storage system, /proc/[pid]/io write_bytes",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_PROCESS
|
||||
);
|
||||
|
||||
pub static ref PROCESS_START_TIME_SECONDS_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::ProcessStartTimeSeconds,
|
||||
"Start time for RustFS process in seconds since Unix epoc",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_PROCESS
|
||||
);
|
||||
|
||||
pub static ref PROCESS_UPTIME_SECONDS_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::ProcessUptimeSeconds,
|
||||
"Uptime for RustFS process in seconds",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_PROCESS
|
||||
);
|
||||
|
||||
pub static ref PROCESS_FILE_DESCRIPTOR_LIMIT_TOTAL_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::ProcessFileDescriptorLimitTotal,
|
||||
"Limit on total number of open file descriptors for the RustFS Server process",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_PROCESS
|
||||
);
|
||||
|
||||
pub static ref PROCESS_FILE_DESCRIPTOR_OPEN_TOTAL_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::ProcessFileDescriptorOpenTotal,
|
||||
"Total number of open file descriptors by the RustFS Server process",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_PROCESS
|
||||
);
|
||||
|
||||
pub static ref PROCESS_SYSCALL_READ_TOTAL_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::ProcessSyscallReadTotal,
|
||||
"Total read SysCalls to the kernel. /proc/[pid]/io syscr",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_PROCESS
|
||||
);
|
||||
|
||||
pub static ref PROCESS_SYSCALL_WRITE_TOTAL_MD: MetricDescriptor =
|
||||
new_counter_md(
|
||||
MetricName::ProcessSyscallWriteTotal,
|
||||
"Total write SysCalls to the kernel. /proc/[pid]/io syscw",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_PROCESS
|
||||
);
|
||||
|
||||
pub static ref PROCESS_RESIDENT_MEMORY_BYTES_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::ProcessResidentMemoryBytes,
|
||||
"Resident memory size in bytes",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_PROCESS
|
||||
);
|
||||
|
||||
pub static ref PROCESS_VIRTUAL_MEMORY_BYTES_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::ProcessVirtualMemoryBytes,
|
||||
"Virtual memory size in bytes",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_PROCESS
|
||||
);
|
||||
|
||||
pub static ref PROCESS_VIRTUAL_MEMORY_MAX_BYTES_MD: MetricDescriptor =
|
||||
new_gauge_md(
|
||||
MetricName::ProcessVirtualMemoryMaxBytes,
|
||||
"Maximum virtual memory size in bytes",
|
||||
&[], // 无标签
|
||||
subsystems::SYSTEM_PROCESS
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user