rustfs-obs 1.0.0

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
// 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;

/// Bucket level replication metric descriptor
pub const BUCKET_L: &str = "bucket";
/// Replication operation
pub const OPERATION_L: &str = "operation";
/// Replication proxy result
pub const RESULT_L: &str = "result";
/// Replication target ARN
pub const TARGET_ARN_L: &str = "target_arn";
/// Replication range
pub const RANGE_L: &str = "range";

const PROXIED_PUT_REQUESTS_TOTAL: &str = "proxied_put_requests_total";
const PROXIED_PUT_REQUESTS_FAILURES: &str = "proxied_put_requests_failures";
const RESYNC_STARTED_TOTAL: &str = "resync_started_total";
const RESYNC_COMPLETED_TOTAL: &str = "resync_completed_total";
const RESYNC_FAILED_TOTAL: &str = "resync_failed_total";
const RESYNC_CANCELED_TOTAL: &str = "resync_canceled_total";
const RESYNC_DURATION_MS_TOTAL: &str = "resync_duration_ms_total";
const CURRENT_BACKLOG_COUNT: &str = "current_backlog_count";
const CURRENT_BACKLOG_BYTES: &str = "current_backlog_bytes";
const CURRENT_TARGET_BACKLOG_COUNT: &str = "current_target_backlog_count";
const CURRENT_TARGET_BACKLOG_BYTES: &str = "current_target_backlog_bytes";
const DURABLE_MRF_AVAILABLE: &str = "durable_mrf_available";
const DURABLE_MRF_BACKLOG_COUNT: &str = "durable_mrf_backlog_count";
const DURABLE_MRF_BACKLOG_BYTES: &str = "durable_mrf_backlog_bytes";
const DURABLE_MRF_TARGET_BACKLOG_COUNT: &str = "durable_mrf_target_backlog_count";
const DURABLE_MRF_TARGET_BACKLOG_BYTES: &str = "durable_mrf_target_backlog_bytes";
const MRF_PENDING_COUNT: &str = "mrf_pending_count";
const MRF_PENDING_BYTES: &str = "mrf_pending_bytes";
const MRF_DROPPED_COUNT: &str = "mrf_dropped_count";
const MRF_MISSED_COUNT: &str = "mrf_missed_count";
const MRF_FLUSH_FAILURES: &str = "mrf_flush_failures";
const MRF_LAST_FLUSH_DURATION_MILLIS: &str = "mrf_last_flush_duration_millis";
const TARGET_SENT_BYTES: &str = "target_sent_bytes";
const TARGET_SENT_COUNT: &str = "target_sent_count";
const TARGET_TOTAL_FAILED_BYTES: &str = "target_total_failed_bytes";
const TARGET_TOTAL_FAILED_COUNT: &str = "target_total_failed_count";
const TARGET_LAST_MIN_FAILED_BYTES: &str = "target_last_min_failed_bytes";
const TARGET_LAST_MIN_FAILED_COUNT: &str = "target_last_min_failed_count";
const TARGET_LAST_HOUR_FAILED_BYTES: &str = "target_last_hour_failed_bytes";
const TARGET_LAST_HOUR_FAILED_COUNT: &str = "target_last_hour_failed_count";

const BUCKET_TARGET_LABELS: [&str; 2] = [BUCKET_L, TARGET_ARN_L];

pub static BUCKET_REPL_LAST_HR_FAILED_BYTES_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::LastHourFailedBytes,
        "Total number of bytes failed at least once to replicate in the last hour on a bucket",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_TARGET_LAST_HOUR_FAILED_BYTES_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::from(TARGET_LAST_HOUR_FAILED_BYTES),
        "Total number of bytes failed at least once to replicate in the last hour on a bucket and target ARN",
        &BUCKET_TARGET_LABELS,
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_LAST_HR_FAILED_COUNT_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::LastHourFailedCount,
        "Total number of objects which failed replication in the last hour on a bucket",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_TARGET_LAST_HOUR_FAILED_COUNT_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::from(TARGET_LAST_HOUR_FAILED_COUNT),
        "Total number of objects which failed replication in the last hour on a bucket and target ARN",
        &BUCKET_TARGET_LABELS,
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_LAST_MIN_FAILED_BYTES_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::LastMinFailedBytes,
        "Total number of bytes failed at least once to replicate in the last full minute on a bucket",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_TARGET_LAST_MIN_FAILED_BYTES_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::from(TARGET_LAST_MIN_FAILED_BYTES),
        "Total number of bytes failed at least once to replicate in the last full minute on a bucket and target ARN",
        &BUCKET_TARGET_LABELS,
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_LAST_MIN_FAILED_COUNT_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::LastMinFailedCount,
        "Total number of objects which failed replication in the last full minute on a bucket",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_TARGET_LAST_MIN_FAILED_COUNT_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::from(TARGET_LAST_MIN_FAILED_COUNT),
        "Total number of objects which failed replication in the last full minute on a bucket and target ARN",
        &BUCKET_TARGET_LABELS,
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_LATENCY_MS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::LatencyMilliSec,
        "Replication latency on a bucket in milliseconds",
        &[BUCKET_L, OPERATION_L, RANGE_L, TARGET_ARN_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_CURRENT_BACKLOG_BYTES_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::from(CURRENT_BACKLOG_BYTES),
        "Current number of bytes admitted to the in-memory replication worker queues for a bucket",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_CURRENT_BACKLOG_COUNT_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::from(CURRENT_BACKLOG_COUNT),
        "Current number of objects admitted to the in-memory replication worker queues for a bucket",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_CURRENT_TARGET_BACKLOG_COUNT_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::from(CURRENT_TARGET_BACKLOG_COUNT),
        "Current number of target-scoped operations admitted to in-memory replication worker queues for a bucket and target ARN",
        &[BUCKET_L, TARGET_ARN_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_CURRENT_TARGET_BACKLOG_BYTES_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::from(CURRENT_TARGET_BACKLOG_BYTES),
        "Current bytes in target-scoped operations admitted to in-memory replication worker queues for a bucket and target ARN",
        &[BUCKET_L, TARGET_ARN_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_DURABLE_MRF_AVAILABLE_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::from(DURABLE_MRF_AVAILABLE),
        "Whether the durable MRF backlog snapshot is available for this bucket on this node",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_DURABLE_MRF_BACKLOG_COUNT_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::from(DURABLE_MRF_BACKLOG_COUNT),
        "Current number of objects in the durable MRF backlog file for a bucket on this node",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_DURABLE_MRF_BACKLOG_BYTES_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::from(DURABLE_MRF_BACKLOG_BYTES),
        "Current bytes in the durable MRF backlog file for a bucket on this node",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_DURABLE_MRF_TARGET_BACKLOG_COUNT_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::from(DURABLE_MRF_TARGET_BACKLOG_COUNT),
        "Current number of target-scoped operations in the durable MRF backlog file for a bucket and target ARN on this node",
        &[BUCKET_L, TARGET_ARN_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_DURABLE_MRF_TARGET_BACKLOG_BYTES_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::from(DURABLE_MRF_TARGET_BACKLOG_BYTES),
        "Current bytes in target-scoped operations in the durable MRF backlog file for a bucket and target ARN on this node",
        &[BUCKET_L, TARGET_ARN_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_MRF_PENDING_COUNT_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::from(MRF_PENDING_COUNT),
        "Current number of MRF entries waiting to be flushed to the durable recovery file for a bucket on this node",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_MRF_PENDING_BYTES_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::from(MRF_PENDING_BYTES),
        "Current bytes represented by MRF entries waiting to be flushed to the durable recovery file for a bucket on this node",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_MRF_DROPPED_COUNT_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::from(MRF_DROPPED_COUNT),
        "Total number of MRF entries dropped after the bounded pending backlog cap was reached for a bucket on this node",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_MRF_MISSED_COUNT_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::from(MRF_MISSED_COUNT),
        "Total number of MRF entries that could not be admitted to the save channel for a bucket on this node",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_MRF_FLUSH_FAILURES_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::from(MRF_FLUSH_FAILURES),
        "Total number of durable MRF flush failures observed while a bucket had pending MRF entries on this node",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_MRF_LAST_FLUSH_DURATION_MILLIS_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::from(MRF_LAST_FLUSH_DURATION_MILLIS),
        "Duration in milliseconds of the last durable MRF flush that touched pending entries for a bucket on this node",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_PROXIED_DELETE_TAGGING_REQUESTS_TOTAL_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::ProxiedDeleteTaggingRequestsTotal,
        "Number of DELETE tagging requests proxied to replication target",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_PROXIED_GET_REQUESTS_FAILURES_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::ProxiedGetRequestsFailures,
        "Number of failures in GET requests proxied to replication target",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_PROXIED_GET_REQUESTS_TOTAL_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::ProxiedGetRequestsTotal,
        "Number of GET requests proxied to replication target",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_PROXIED_GET_TAGGING_REQUESTS_FAILURES_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::ProxiedGetTaggingRequestFailures,
        "Number of failures in GET tagging requests proxied to replication target",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_PROXIED_GET_TAGGING_REQUESTS_TOTAL_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::ProxiedGetTaggingRequestsTotal,
        "Number of GET tagging requests proxied to replication target",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_PROXIED_HEAD_REQUESTS_FAILURES_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::ProxiedHeadRequestsFailures,
        "Number of failures in HEAD requests proxied to replication target",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_PROXIED_HEAD_REQUESTS_TOTAL_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::ProxiedHeadRequestsTotal,
        "Number of HEAD requests proxied to replication target",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_PROXIED_PUT_TAGGING_REQUESTS_FAILURES_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::ProxiedPutTaggingRequestFailures,
        "Number of failures in PUT tagging requests proxied to replication target",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_PROXIED_PUT_REQUESTS_FAILURES_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::from(PROXIED_PUT_REQUESTS_FAILURES),
        "Number of failures in PUT requests proxied to replication target",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_PROXIED_PUT_REQUESTS_TOTAL_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::from(PROXIED_PUT_REQUESTS_TOTAL),
        "Number of PUT requests proxied to replication target",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_PROXIED_PUT_TAGGING_REQUESTS_TOTAL_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::ProxiedPutTaggingRequestsTotal,
        "Number of PUT tagging requests proxied to replication target",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_SENT_BYTES_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::SentBytes,
        "Total number of bytes replicated to the target",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_TARGET_SENT_BYTES_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::from(TARGET_SENT_BYTES),
        "Total number of bytes replicated to a bucket replication target ARN",
        &BUCKET_TARGET_LABELS,
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_SENT_COUNT_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::SentCount,
        "Total number of objects replicated to the target",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_TARGET_SENT_COUNT_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::from(TARGET_SENT_COUNT),
        "Total number of objects replicated to a bucket replication target ARN",
        &BUCKET_TARGET_LABELS,
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_RESYNC_STARTED_TOTAL_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::from(RESYNC_STARTED_TOTAL),
        "Total number of bucket replication resync runs started",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_RESYNC_COMPLETED_TOTAL_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::from(RESYNC_COMPLETED_TOTAL),
        "Total number of bucket replication resync runs completed",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_RESYNC_FAILED_TOTAL_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::from(RESYNC_FAILED_TOTAL),
        "Total number of bucket replication resync runs failed",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_RESYNC_CANCELED_TOTAL_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::from(RESYNC_CANCELED_TOTAL),
        "Total number of bucket replication resync runs canceled",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_RESYNC_DURATION_MS_TOTAL_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::from(RESYNC_DURATION_MS_TOTAL),
        "Total elapsed time of finished bucket replication resync runs in milliseconds",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_TOTAL_FAILED_BYTES_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::TotalFailedBytes,
        "Total number of bytes failed at least once to replicate since server start",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_TARGET_TOTAL_FAILED_BYTES_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::from(TARGET_TOTAL_FAILED_BYTES),
        "Total number of bytes failed at least once to replicate since server start by bucket and target ARN",
        &BUCKET_TARGET_LABELS,
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_TOTAL_FAILED_COUNT_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::TotalFailedCount,
        "Total number of objects which failed replication since server start",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_TARGET_TOTAL_FAILED_COUNT_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::from(TARGET_TOTAL_FAILED_COUNT),
        "Total number of objects which failed replication since server start by bucket and target ARN",
        &BUCKET_TARGET_LABELS,
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_BANDWIDTH_LIMIT_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::BandwidthLimitBytesPerSecond,
        "Configured bandwidth limit for replication in bytes per second",
        &[BUCKET_L, TARGET_ARN_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_BANDWIDTH_CURRENT_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_gauge_md(
        MetricName::BandwidthCurrentBytesPerSecond,
        "Current replication bandwidth in bytes per second (EWMA)",
        &[BUCKET_L, TARGET_ARN_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_PROXIED_DELETE_TAGGING_REQUESTS_FAILURES_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::ProxiedDeleteTaggingRequestFailures,
        "Number of failures in DELETE tagging requests proxied to replication target",
        &[BUCKET_L],
        subsystems::BUCKET_REPLICATION,
    )
});

pub static BUCKET_REPL_PROXY_REQUESTS_TOTAL_MD: LazyLock<MetricDescriptor> = LazyLock::new(|| {
    new_counter_md(
        MetricName::Custom("proxy_requests_total".to_string()),
        "Total number of bucket replication proxy requests by operation and result",
        &[BUCKET_L, OPERATION_L, RESULT_L],
        subsystems::BUCKET_REPLICATION,
    )
});