risingwave_storage/monitor/
pin_cache_metrics.rs1use std::sync::LazyLock;
16
17use prometheus::{IntGauge, Registry, register_int_gauge_with_registry};
18use risingwave_common::monitor::GLOBAL_METRICS_REGISTRY;
19
20pub(crate) static GLOBAL_PIN_CACHE_METRICS: LazyLock<PinCacheMetrics> =
21 LazyLock::new(|| PinCacheMetrics::new(&GLOBAL_METRICS_REGISTRY));
22
23pub(crate) struct PinCacheMetrics {
25 pub published_objects: IntGauge,
26 pub published_bytes: IntGauge,
27}
28
29impl PinCacheMetrics {
30 fn new(registry: &Registry) -> Self {
31 let published_objects = register_int_gauge_with_registry!(
32 "pin_cache_published_objects",
33 "Complete SST objects currently routed to the local Pin Cache",
34 registry
35 )
36 .unwrap();
37 let published_bytes = register_int_gauge_with_registry!(
38 "pin_cache_published_bytes",
39 "Complete SST bytes currently routed to the local Pin Cache",
40 registry
41 )
42 .unwrap();
43 Self {
44 published_objects,
45 published_bytes,
46 }
47 }
48}