commonware_storage/qmdb/sync/
metrics.rs1use commonware_runtime::telemetry::metrics::{Gauge, GaugeExt, MetricsExt};
2
3pub struct Metrics {
9 target_size: Gauge,
11 size: Gauge,
13}
14
15impl Metrics {
16 pub fn new(context: &impl commonware_runtime::Metrics) -> Self {
18 Self {
19 target_size: context.gauge("target_size", "Size of the current sync target"),
20 size: context.gauge(
21 "size",
22 "Database size reached by sync, equal to target_size when sync completes",
23 ),
24 }
25 }
26
27 pub fn record_target(&self, size: u64) {
29 let _ = self.target_size.try_set(size);
30 }
31
32 pub fn record_synced(&self, size: u64) {
34 let _ = self.size.try_set(size);
35 }
36}