use std::sync::Arc;
pub trait Metrics: Send + Sync {
fn frames_shipped(&self, count: u32);
fn snapshot_taken(&self, db_size: u64, wal_size: u64);
fn sync_completed(&self, duration_ms: u64);
fn restore_completed(&self, duration_ms: u64);
fn segment_uploaded(&self, key: &str, size: u64);
fn segment_deleted(&self, key: &str);
fn shipper_error(&self, detail: &str);
fn snapshot_error(&self, detail: &str) {
let _ = detail;
}
fn restore_error(&self, detail: &str) {
let _ = detail;
}
fn orphan_deleted(&self, key: &str) {
let _ = key;
}
fn checksum_warning(&self, detail: &str) {
let _ = detail;
}
fn segment_compacted(&self, l0_count: u32, l1_key: &str) {
let _ = l0_count;
let _ = l1_key;
}
}
pub struct NoopMetrics;
impl Metrics for NoopMetrics {
fn frames_shipped(&self, _count: u32) {}
fn snapshot_taken(&self, _db_size: u64, _wal_size: u64) {}
fn sync_completed(&self, _duration_ms: u64) {}
fn restore_completed(&self, _duration_ms: u64) {}
fn segment_uploaded(&self, _key: &str, _size: u64) {}
fn segment_deleted(&self, _key: &str) {}
fn shipper_error(&self, _detail: &str) {}
}
pub fn noop_metrics() -> Arc<dyn Metrics> {
Arc::new(NoopMetrics)
}