feat(scanner): expand scanner observability metrics (#3159)

* feat(scanner): expand scanner observability metrics

* chore(scanner): align bucket-drive metric wording

---------

Co-authored-by: Henry Guo <marshawcoco@users.noreply.github.com>
This commit is contained in:
Henry Guo
2026-06-02 09:29:53 +08:00
committed by GitHub
parent 39a283fbce
commit 1d46047d6f
9 changed files with 996 additions and 56 deletions
@@ -279,24 +279,46 @@ pub enum MetricName {
ScannerVersionsScanned,
ScannerLastActivitySeconds,
ScannerActivePaths,
ScannerBucketScansFailed,
ScannerThrottleIdleModeEnabled,
ScannerThrottleSleepFactor,
ScannerThrottleMaxSleepSeconds,
ScannerYieldEveryNObjects,
ScannerCycleIntervalSeconds,
ScannerBitrotCycleEnabled,
ScannerBitrotCycleSeconds,
ScannerCurrentCycle,
ScannerCompletedCycles,
ScannerCurrentCycleAgeSeconds,
ScannerCurrentCycleObjectsScanned,
ScannerCurrentCycleDirectoriesScanned,
ScannerCurrentCycleBucketDriveScans,
ScannerCurrentCycleBucketDriveFailures,
ScannerCurrentCycleObjectsPerSecond,
ScannerCurrentCycleDirectoriesPerSecond,
ScannerCurrentCycleBucketDriveScansPerSecond,
ScannerCurrentCycleYieldEvents,
ScannerCurrentCycleYieldDurationSeconds,
ScannerCurrentCycleIlmActions,
ScannerCurrentCycleHealObjects,
ScannerCurrentCycleReplicationChecks,
ScannerCurrentCycleUsageSaves,
ScannerCurrentScanMode,
ScannerLastCycleResult,
ScannerLastCycleDurationSeconds,
ScannerLastCycleObjectsScanned,
ScannerLastCycleDirectoriesScanned,
ScannerLastCycleBucketDriveScans,
ScannerLastCycleBucketDriveFailures,
ScannerLastCycleObjectsPerSecond,
ScannerLastCycleDirectoriesPerSecond,
ScannerLastCycleBucketDriveScansPerSecond,
ScannerLastCycleYieldEvents,
ScannerLastCycleYieldDurationSeconds,
ScannerLastCycleIlmActions,
ScannerLastCycleHealObjects,
ScannerLastCycleReplicationChecks,
ScannerLastCycleUsageSaves,
ScannerFailedCycles,
// CPU system-related metrics
@@ -639,24 +661,46 @@ impl MetricName {
Self::ScannerVersionsScanned => "versions_scanned".to_string(),
Self::ScannerLastActivitySeconds => "last_activity_seconds".to_string(),
Self::ScannerActivePaths => "active_paths".to_string(),
Self::ScannerBucketScansFailed => "bucket_scans_failed".to_string(),
Self::ScannerThrottleIdleModeEnabled => "throttle_idle_mode_enabled".to_string(),
Self::ScannerThrottleSleepFactor => "throttle_sleep_factor".to_string(),
Self::ScannerThrottleMaxSleepSeconds => "throttle_max_sleep_seconds".to_string(),
Self::ScannerYieldEveryNObjects => "yield_every_n_objects".to_string(),
Self::ScannerCycleIntervalSeconds => "cycle_interval_seconds".to_string(),
Self::ScannerBitrotCycleEnabled => "bitrot_cycle_enabled".to_string(),
Self::ScannerBitrotCycleSeconds => "bitrot_cycle_seconds".to_string(),
Self::ScannerCurrentCycle => "current_cycle".to_string(),
Self::ScannerCompletedCycles => "completed_cycles".to_string(),
Self::ScannerCurrentCycleAgeSeconds => "current_cycle_age_seconds".to_string(),
Self::ScannerCurrentCycleObjectsScanned => "current_cycle_objects_scanned".to_string(),
Self::ScannerCurrentCycleDirectoriesScanned => "current_cycle_directories_scanned".to_string(),
Self::ScannerCurrentCycleBucketDriveScans => "current_cycle_bucket_drive_scans".to_string(),
Self::ScannerCurrentCycleBucketDriveFailures => "current_cycle_bucket_drive_failures".to_string(),
Self::ScannerCurrentCycleObjectsPerSecond => "current_cycle_objects_per_second".to_string(),
Self::ScannerCurrentCycleDirectoriesPerSecond => "current_cycle_directories_per_second".to_string(),
Self::ScannerCurrentCycleBucketDriveScansPerSecond => "current_cycle_bucket_drive_scans_per_second".to_string(),
Self::ScannerCurrentCycleYieldEvents => "current_cycle_yield_events".to_string(),
Self::ScannerCurrentCycleYieldDurationSeconds => "current_cycle_yield_duration_seconds".to_string(),
Self::ScannerCurrentCycleIlmActions => "current_cycle_ilm_actions".to_string(),
Self::ScannerCurrentCycleHealObjects => "current_cycle_heal_objects".to_string(),
Self::ScannerCurrentCycleReplicationChecks => "current_cycle_replication_checks".to_string(),
Self::ScannerCurrentCycleUsageSaves => "current_cycle_usage_saves".to_string(),
Self::ScannerCurrentScanMode => "current_scan_mode".to_string(),
Self::ScannerLastCycleResult => "last_cycle_result".to_string(),
Self::ScannerLastCycleDurationSeconds => "last_cycle_duration_seconds".to_string(),
Self::ScannerLastCycleObjectsScanned => "last_cycle_objects_scanned".to_string(),
Self::ScannerLastCycleDirectoriesScanned => "last_cycle_directories_scanned".to_string(),
Self::ScannerLastCycleBucketDriveScans => "last_cycle_bucket_drive_scans".to_string(),
Self::ScannerLastCycleBucketDriveFailures => "last_cycle_bucket_drive_failures".to_string(),
Self::ScannerLastCycleObjectsPerSecond => "last_cycle_objects_per_second".to_string(),
Self::ScannerLastCycleDirectoriesPerSecond => "last_cycle_directories_per_second".to_string(),
Self::ScannerLastCycleBucketDriveScansPerSecond => "last_cycle_bucket_drive_scans_per_second".to_string(),
Self::ScannerLastCycleYieldEvents => "last_cycle_yield_events".to_string(),
Self::ScannerLastCycleYieldDurationSeconds => "last_cycle_yield_duration_seconds".to_string(),
Self::ScannerLastCycleIlmActions => "last_cycle_ilm_actions".to_string(),
Self::ScannerLastCycleHealObjects => "last_cycle_heal_objects".to_string(),
Self::ScannerLastCycleReplicationChecks => "last_cycle_replication_checks".to_string(),
Self::ScannerLastCycleUsageSaves => "last_cycle_usage_saves".to_string(),
Self::ScannerFailedCycles => "failed_cycles".to_string(),
// CPU system-related metrics
+200 -2
View File
@@ -20,7 +20,7 @@ use std::sync::LazyLock;
pub static SCANNER_BUCKET_SCANS_FINISHED_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
new_counter_md(
MetricName::ScannerBucketScansFinished,
"Total number of bucket scans finished since server start",
"Total number of bucket-drive scans finished since server start",
&[],
subsystems::SCANNER,
)
@@ -29,7 +29,16 @@ pub static SCANNER_BUCKET_SCANS_FINISHED_MD: LazyLock<MetricDescriptor> = LazyLo
pub static SCANNER_BUCKET_SCANS_STARTED_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
new_counter_md(
MetricName::ScannerBucketScansStarted,
"Total number of bucket scans started since server start",
"Total number of bucket-drive scans started since server start",
&[],
subsystems::SCANNER,
)
});
pub static SCANNER_BUCKET_SCANS_FAILED_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
new_counter_md(
MetricName::ScannerBucketScansFailed,
"Total number of bucket-drive scans that failed since server start",
&[],
subsystems::SCANNER,
)
@@ -80,6 +89,69 @@ pub static SCANNER_ACTIVE_PATHS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|
)
});
pub static SCANNER_THROTTLE_IDLE_MODE_ENABLED_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
new_gauge_md(
MetricName::ScannerThrottleIdleModeEnabled,
"Whether scanner idle-mode self-throttling is enabled: 1 enabled, 0 disabled.",
&[],
subsystems::SCANNER,
)
});
pub static SCANNER_THROTTLE_SLEEP_FACTOR_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
new_gauge_md(
MetricName::ScannerThrottleSleepFactor,
"Effective scanner sleep factor used to compute proportional self-throttle sleeps.",
&[],
subsystems::SCANNER,
)
});
pub static SCANNER_THROTTLE_MAX_SLEEP_SECONDS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
new_gauge_md(
MetricName::ScannerThrottleMaxSleepSeconds,
"Effective maximum scanner self-throttle sleep duration in seconds.",
&[],
subsystems::SCANNER,
)
});
pub static SCANNER_YIELD_EVERY_N_OBJECTS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
new_gauge_md(
MetricName::ScannerYieldEveryNObjects,
"Current object interval for cooperative scanner runtime yields, or zero when disabled.",
&[],
subsystems::SCANNER,
)
});
pub static SCANNER_CYCLE_INTERVAL_SECONDS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
new_gauge_md(
MetricName::ScannerCycleIntervalSeconds,
"Effective scanner cycle interval in seconds.",
&[],
subsystems::SCANNER,
)
});
pub static SCANNER_BITROT_CYCLE_ENABLED_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
new_gauge_md(
MetricName::ScannerBitrotCycleEnabled,
"Whether periodic scanner bitrot deep scans are enabled: 1 enabled, 0 disabled.",
&[],
subsystems::SCANNER,
)
});
pub static SCANNER_BITROT_CYCLE_SECONDS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
new_gauge_md(
MetricName::ScannerBitrotCycleSeconds,
"Effective scanner bitrot deep-scan interval in seconds; zero means disabled or deep-scan every cycle.",
&[],
subsystems::SCANNER,
)
});
pub static SCANNER_CURRENT_CYCLE_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
new_gauge_md(
MetricName::ScannerCurrentCycle,
@@ -134,6 +206,15 @@ pub static SCANNER_CURRENT_CYCLE_BUCKET_DRIVE_SCANS_MD: LazyLock<MetricDescripto
)
});
pub static SCANNER_CURRENT_CYCLE_BUCKET_DRIVE_FAILURES_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
new_gauge_md(
MetricName::ScannerCurrentCycleBucketDriveFailures,
"Number of bucket-drive scans that failed in the currently running scanner cycle.",
&[],
subsystems::SCANNER,
)
});
pub static SCANNER_CURRENT_CYCLE_OBJECTS_PER_SECOND_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
new_gauge_md(
MetricName::ScannerCurrentCycleObjectsPerSecond,
@@ -161,6 +242,60 @@ pub static SCANNER_CURRENT_CYCLE_BUCKET_DRIVE_SCANS_PER_SECOND_MD: LazyLock<Metr
)
});
pub static SCANNER_CURRENT_CYCLE_YIELD_EVENTS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
new_gauge_md(
MetricName::ScannerCurrentCycleYieldEvents,
"Number of scanner self-throttle yield events in the currently running scanner cycle.",
&[],
subsystems::SCANNER,
)
});
pub static SCANNER_CURRENT_CYCLE_YIELD_DURATION_SECONDS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
new_gauge_md(
MetricName::ScannerCurrentCycleYieldDurationSeconds,
"Total scanner self-throttle yield duration in seconds for the currently running scanner cycle.",
&[],
subsystems::SCANNER,
)
});
pub static SCANNER_CURRENT_CYCLE_ILM_ACTIONS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
new_gauge_md(
MetricName::ScannerCurrentCycleIlmActions,
"Number of lifecycle actions applied by the currently running scanner cycle.",
&[],
subsystems::SCANNER,
)
});
pub static SCANNER_CURRENT_CYCLE_HEAL_OBJECTS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
new_gauge_md(
MetricName::ScannerCurrentCycleHealObjects,
"Number of object heal candidates enqueued by the currently running scanner cycle.",
&[],
subsystems::SCANNER,
)
});
pub static SCANNER_CURRENT_CYCLE_REPLICATION_CHECKS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
new_gauge_md(
MetricName::ScannerCurrentCycleReplicationChecks,
"Number of replication heal checks run by the currently running scanner cycle.",
&[],
subsystems::SCANNER,
)
});
pub static SCANNER_CURRENT_CYCLE_USAGE_SAVES_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
new_gauge_md(
MetricName::ScannerCurrentCycleUsageSaves,
"Number of data-usage save operations run by the currently running scanner cycle.",
&[],
subsystems::SCANNER,
)
});
pub static SCANNER_CURRENT_SCAN_MODE_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
new_gauge_md(
MetricName::ScannerCurrentScanMode,
@@ -215,6 +350,15 @@ pub static SCANNER_LAST_CYCLE_BUCKET_DRIVE_SCANS_MD: LazyLock<MetricDescriptor>
)
});
pub static SCANNER_LAST_CYCLE_BUCKET_DRIVE_FAILURES_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
new_gauge_md(
MetricName::ScannerLastCycleBucketDriveFailures,
"Number of bucket-drive scans that failed in the last finished scanner cycle.",
&[],
subsystems::SCANNER,
)
});
pub static SCANNER_LAST_CYCLE_OBJECTS_PER_SECOND_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
new_gauge_md(
MetricName::ScannerLastCycleObjectsPerSecond,
@@ -242,6 +386,60 @@ pub static SCANNER_LAST_CYCLE_BUCKET_DRIVE_SCANS_PER_SECOND_MD: LazyLock<MetricD
)
});
pub static SCANNER_LAST_CYCLE_YIELD_EVENTS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
new_gauge_md(
MetricName::ScannerLastCycleYieldEvents,
"Number of scanner self-throttle yield events in the last finished scanner cycle.",
&[],
subsystems::SCANNER,
)
});
pub static SCANNER_LAST_CYCLE_YIELD_DURATION_SECONDS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
new_gauge_md(
MetricName::ScannerLastCycleYieldDurationSeconds,
"Total scanner self-throttle yield duration in seconds for the last finished scanner cycle.",
&[],
subsystems::SCANNER,
)
});
pub static SCANNER_LAST_CYCLE_ILM_ACTIONS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
new_gauge_md(
MetricName::ScannerLastCycleIlmActions,
"Number of lifecycle actions applied by the last finished scanner cycle.",
&[],
subsystems::SCANNER,
)
});
pub static SCANNER_LAST_CYCLE_HEAL_OBJECTS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
new_gauge_md(
MetricName::ScannerLastCycleHealObjects,
"Number of object heal candidates enqueued by the last finished scanner cycle.",
&[],
subsystems::SCANNER,
)
});
pub static SCANNER_LAST_CYCLE_REPLICATION_CHECKS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
new_gauge_md(
MetricName::ScannerLastCycleReplicationChecks,
"Number of replication heal checks run by the last finished scanner cycle.",
&[],
subsystems::SCANNER,
)
});
pub static SCANNER_LAST_CYCLE_USAGE_SAVES_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
new_gauge_md(
MetricName::ScannerLastCycleUsageSaves,
"Number of data-usage save operations run by the last finished scanner cycle.",
&[],
subsystems::SCANNER,
)
});
pub static SCANNER_FAILED_CYCLES_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
new_counter_md(
MetricName::ScannerFailedCycles,