rustfs-obs 1.0.1

Observability and monitoring tools for RustFS, providing metrics, logging, and tracing capabilities.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
// Copyright 2024 RustFS Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use crate::{MetricDescriptor, MetricName, new_counter_md, new_gauge_md, subsystems};
use std::sync::LazyLock;

pub const SERVER_LABEL: &str = "server";
pub const SOURCE_LABEL: &str = "source";
pub const STATE_LABEL: &str = "state";
pub const CYCLE_SCOPE_LABEL: &str = "cycle_scope";
pub const BUCKET_LABEL: &str = "bucket";
pub const DRIVE_LABEL: &str = "drive";
pub const RESULT_LABEL: &str = "result";

pub static SCANNER_SOURCE_WORK_TOTAL_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::Custom("source_work_total".to_string()),
        "Total scanner work by source and state since server start",
        &[SERVER_LABEL, SOURCE_LABEL, STATE_LABEL],
        subsystems::SCANNER,
    )
});

pub static SCANNER_CYCLE_SOURCE_WORK_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::Custom("cycle_source_work".to_string()),
        "Scanner work by cycle scope, source, and state",
        &[SERVER_LABEL, CYCLE_SCOPE_LABEL, SOURCE_LABEL, STATE_LABEL],
        subsystems::SCANNER,
    )
});

pub static SCANNER_BUCKET_DRIVE_RESULT_TOTAL_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::Custom("bucket_drive_result_total".to_string()),
        "Total scanner bucket-drive scan results by server, bucket, drive, and result",
        &[SERVER_LABEL, BUCKET_LABEL, DRIVE_LABEL, RESULT_LABEL],
        subsystems::SCANNER,
    )
});

pub static SCANNER_CYCLE_BUCKET_DRIVE_RESULT_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::Custom("cycle_bucket_drive_result".to_string()),
        "Scanner bucket-drive scan results by cycle scope, server, bucket, drive, and result",
        &[SERVER_LABEL, CYCLE_SCOPE_LABEL, BUCKET_LABEL, DRIVE_LABEL, RESULT_LABEL],
        subsystems::SCANNER,
    )
});

pub static SCANNER_ACTIVE_BUCKET_DRIVE_SCANS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::Custom("active_bucket_drive_scans".to_string()),
        "Current active scanner bucket-drive scans by server, source, bucket, and drive",
        &[SERVER_LABEL, SOURCE_LABEL, BUCKET_LABEL, DRIVE_LABEL],
        subsystems::SCANNER,
    )
});

pub static SCANNER_ACTIVE_BUCKET_DRIVE_SCAN_AGE_SECONDS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::Custom("active_bucket_drive_scan_age_seconds".to_string()),
        "Age of the oldest active scanner bucket-drive scan by server, source, bucket, and drive",
        &[SERVER_LABEL, SOURCE_LABEL, BUCKET_LABEL, DRIVE_LABEL],
        subsystems::SCANNER,
    )
});

pub static SCANNER_DIRTY_USAGE_PENDING_BUCKETS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::Custom("dirty_usage_pending_buckets".to_string()),
        "Current number of buckets with pending scanner dirty-usage acknowledgements.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_DIRTY_USAGE_LAST_MARK_UNIX_SECONDS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::Custom("dirty_usage_last_mark_unix_seconds".to_string()),
        "Unix timestamp of the last scanner dirty-usage mark, or zero when none has been recorded.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_DIRTY_USAGE_LAST_CLEAR_UNIX_SECONDS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::Custom("dirty_usage_last_clear_unix_seconds".to_string()),
        "Unix timestamp of the last scanner dirty-usage clear, or zero when none has been recorded.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_DIRTY_USAGE_LAST_CYCLE_BUCKETS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::Custom("dirty_usage_last_cycle_buckets".to_string()),
        "Number of dirty-usage buckets observed by the last scanner cycle.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_DIRTY_USAGE_LAST_CYCLE_CLEARED_BUCKETS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::Custom("dirty_usage_last_cycle_cleared_buckets".to_string()),
        "Number of dirty-usage buckets cleared by the last scanner cycle.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_USAGE_LAST_SAVE_UNIX_SECONDS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::Custom("usage_last_save_unix_seconds".to_string()),
        "Unix timestamp of the last scanner usage-cache save attempt, or zero when none has been recorded.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_USAGE_LAST_SAVE_RESULT_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::Custom("usage_last_save_result".to_string()),
        "Last scanner usage-cache save result code: 0 unknown, 1 success, 2 failed, 3 skipped_stale, 4 encode_failed.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_USAGE_LAST_DURABLE_SUCCESS_UNIX_SECONDS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::Custom("usage_last_durable_success_unix_seconds".to_string()),
        "Unix timestamp of the last durable scanner usage-cache publication success, or zero when none has been recorded.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_USAGE_LAST_PUBLICATION_UNIX_SECONDS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::Custom("usage_last_publication_unix_seconds".to_string()),
        "Unix timestamp of the last scanner usage-cache publication state update, or zero when none has been recorded.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_USAGE_LAST_PUBLICATION_RESULT_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::Custom("usage_last_publication_result".to_string()),
        "Last scanner usage-cache publication result code: 0 unknown, 1 success, 2 deferred, 3 failed, 4 no_update.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_USAGE_DEFERRED_PENDING_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::Custom("usage_deferred_pending".to_string()),
        "Whether scanner usage-cache publication is currently deferred: 1 deferred, 0 not deferred.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_USAGE_DEFERRED_TOTAL_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::Custom("usage_deferred_total".to_string()),
        "Total scanner usage-cache publication deferrals since server start.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_USAGE_LAST_DEFERRED_UNIX_SECONDS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::Custom("usage_last_deferred_unix_seconds".to_string()),
        "Unix timestamp of the last scanner usage-cache publication deferral, or zero when none has been recorded.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_BUCKET_SCANS_FINISHED_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::ScannerBucketScansFinished,
        "Total number of bucket-drive scans finished since server start",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_BUCKET_SCANS_STARTED_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::ScannerBucketScansStarted,
        "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,
    )
});

pub static SCANNER_DIRECTORIES_SCANNED_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::ScannerDirectoriesScanned,
        "Total number of directories scanned since server start",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_OBJECTS_SCANNED_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::ScannerObjectsScanned,
        "Total number of unique objects scanned since server start",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_VERSIONS_SCANNED_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::ScannerVersionsScanned,
        "Total number of object versions scanned since server start",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_LAST_ACTIVITY_SECONDS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::ScannerLastActivitySeconds,
        "Time elapsed (in seconds) since last scan activity.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_ACTIVE_PATHS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::ScannerActivePaths,
        "Current number of scanner paths being processed.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_OLDEST_ACTIVE_PATH_AGE_SECONDS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::ScannerOldestActivePathAgeSeconds,
        "Time elapsed (in seconds) since the oldest active scanner path was last updated, or zero when idle.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_CURRENT_SET_SCAN_CONCURRENCY_LIMIT_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::ScannerCurrentSetScanConcurrencyLimit,
        "Current aggregate scanner set scan concurrency limit across active scanner work.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_CURRENT_SET_SCANS_QUEUED_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::ScannerCurrentSetScansQueued,
        "Current number of queued scanner set scans across active scanner work.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_CURRENT_SET_SCANS_ACTIVE_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::ScannerCurrentSetScansActive,
        "Current number of active scanner set scans across active scanner work.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_CURRENT_DISK_SCAN_CONCURRENCY_LIMIT_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::ScannerCurrentDiskScanConcurrencyLimit,
        "Current aggregate scanner disk-bucket scan concurrency limit across active scanner work.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_CURRENT_DISK_BUCKET_SCANS_QUEUED_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::ScannerCurrentDiskBucketScansQueued,
        "Current number of queued scanner disk-bucket scans across active scanner work.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_CURRENT_DISK_BUCKET_SCANS_ACTIVE_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::ScannerCurrentDiskBucketScansActive,
        "Current number of active scanner disk-bucket scans across active scanner work.",
        &[],
        subsystems::SCANNER,
    )
});

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_CYCLE_MAX_DURATION_SECONDS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::ScannerCycleMaxDurationSeconds,
        "Effective maximum scanner cycle runtime in seconds; zero means unlimited.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_CYCLE_MAX_OBJECTS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::ScannerCycleMaxObjects,
        "Effective maximum objects processed by one scanner cycle; zero means unlimited.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_CYCLE_MAX_DIRECTORIES_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::ScannerCycleMaxDirectories,
        "Effective maximum directories entered by one scanner cycle; zero means unlimited.",
        &[],
        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,
        "Current scanner cycle number, or zero when no cycle is running.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_COMPLETED_CYCLES_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::ScannerCompletedCycles,
        "Total number of scanner cycles completed since server start.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_CURRENT_CYCLE_AGE_SECONDS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::ScannerCurrentCycleAgeSeconds,
        "Time elapsed (in seconds) since the current scanner cycle started, or zero when no cycle is running.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_CURRENT_CYCLE_OBJECTS_SCANNED_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::ScannerCurrentCycleObjectsScanned,
        "Number of objects scanned by the currently running scanner cycle.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_CURRENT_CYCLE_DIRECTORIES_SCANNED_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::ScannerCurrentCycleDirectoriesScanned,
        "Number of directories scanned by the currently running scanner cycle.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_CURRENT_CYCLE_BUCKET_DRIVE_SCANS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::ScannerCurrentCycleBucketDriveScans,
        "Number of bucket-drive scans finished by the currently running scanner cycle.",
        &[],
        subsystems::SCANNER,
    )
});

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,
        "Object scan rate for the currently running scanner cycle.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_CURRENT_CYCLE_DIRECTORIES_PER_SECOND_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::ScannerCurrentCycleDirectoriesPerSecond,
        "Directory scan rate for the currently running scanner cycle.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_CURRENT_CYCLE_BUCKET_DRIVE_SCANS_PER_SECOND_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::ScannerCurrentCycleBucketDriveScansPerSecond,
        "Bucket-drive scan rate for the currently running scanner cycle.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_CURRENT_CYCLE_YIELD_EVENTS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::ScannerCurrentCycleYieldEvents,
        "Number of scanner cooperative 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 cooperative yield duration in seconds for the currently running scanner cycle.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_CURRENT_CYCLE_THROTTLE_SLEEP_EVENTS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::ScannerCurrentCycleThrottleSleepEvents,
        "Number of scanner self-throttle sleep events in the currently running scanner cycle.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_CURRENT_CYCLE_THROTTLE_SLEEP_DURATION_SECONDS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::ScannerCurrentCycleThrottleSleepDurationSeconds,
        "Total scanner self-throttle sleep 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,
        "Current scanner mode: 0 unknown or idle, 1 normal, 2 deep bitrot scan.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_LAST_CYCLE_RESULT_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::ScannerLastCycleResult,
        "Last scanner cycle result: 0 unknown, 1 success, 2 error, 3 partial, 4 superseded, 5 deferred.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_LAST_CYCLE_PARTIAL_REASON_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::ScannerLastCyclePartialReason,
        "Last scanner partial cycle reason: 0 unknown, 1 runtime budget, 2 object budget, 3 directory budget.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_LAST_CYCLE_DURATION_SECONDS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::ScannerLastCycleDurationSeconds,
        "Duration in seconds of the last finished scanner cycle.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_LAST_CYCLE_OBJECTS_SCANNED_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::ScannerLastCycleObjectsScanned,
        "Number of objects scanned by the last finished scanner cycle.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_LAST_CYCLE_DIRECTORIES_SCANNED_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::ScannerLastCycleDirectoriesScanned,
        "Number of directories scanned by the last finished scanner cycle.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_LAST_CYCLE_BUCKET_DRIVE_SCANS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::ScannerLastCycleBucketDriveScans,
        "Number of bucket-drive scans finished by the last scanner cycle.",
        &[],
        subsystems::SCANNER,
    )
});

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,
        "Object scan rate for the last finished scanner cycle.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_LAST_CYCLE_DIRECTORIES_PER_SECOND_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::ScannerLastCycleDirectoriesPerSecond,
        "Directory scan rate for the last finished scanner cycle.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_LAST_CYCLE_BUCKET_DRIVE_SCANS_PER_SECOND_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::ScannerLastCycleBucketDriveScansPerSecond,
        "Bucket-drive scan rate for the last finished scanner cycle.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_LAST_CYCLE_YIELD_EVENTS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::ScannerLastCycleYieldEvents,
        "Number of scanner cooperative 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 cooperative yield duration in seconds for the last finished scanner cycle.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_LAST_CYCLE_THROTTLE_SLEEP_EVENTS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::ScannerLastCycleThrottleSleepEvents,
        "Number of scanner self-throttle sleep events in the last finished scanner cycle.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_LAST_CYCLE_THROTTLE_SLEEP_DURATION_SECONDS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::ScannerLastCycleThrottleSleepDurationSeconds,
        "Total scanner self-throttle sleep 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,
        "Total number of scanner cycles that failed since server start.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_SUPERSEDED_CYCLES_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::ScannerSupersededCycles,
        "Total number of clean scanner cycles superseded by concurrent cluster, configuration, topology, or namespace activity since server start.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_PARTIAL_CYCLES_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::ScannerPartialCycles,
        "Total number of scanner cycles stopped before completion by cycle budget.",
        &[],
        subsystems::SCANNER,
    )
});

pub static SCANNER_PARTIAL_CYCLES_BY_REASON_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::ScannerPartialCyclesByReason,
        "Total number of scanner cycles stopped before completion by cycle budget reason.",
        &["reason"],
        subsystems::SCANNER,
    )
});