garage/src/rpc/system_metrics.rs

35 lines
1 KiB
Rust
Raw Normal View History

use opentelemetry::{global, metrics::*};
2023-01-09 17:13:41 +00:00
/// TableMetrics reference all counter used for metrics
pub struct SystemMetrics {
pub(crate) _garage_build_info: ObservableGauge<u64>,
pub(crate) _replication_factor: ObservableGauge<u64>,
pub(crate) _disk_avail: ObservableGauge<u64>,
pub(crate) _disk_total: ObservableGauge<u64>,
2023-01-09 17:13:41 +00:00
}
impl SystemMetrics {
pub fn new() -> Self {
2023-01-09 17:13:41 +00:00
let meter = global::meter("garage_system");
2023-01-09 17:13:41 +00:00
Self {
_garage_build_info: meter
.u64_observable_gauge("garage_build_info")
2023-01-09 17:13:41 +00:00
.with_description("Garage build info")
.init(),
_replication_factor: meter
.u64_observable_gauge("garage_replication_factor")
2023-01-09 17:13:41 +00:00
.with_description("Garage replication factor setting")
.init(),
_disk_avail: meter
.u64_observable_gauge("garage_local_disk_avail_bytes")
.with_description("Garage available disk space on each node")
.init(),
_disk_total: meter
.u64_observable_gauge("garage_local_size_bytes")
.with_description("Garage total disk space on each node")
.init(),
2023-01-09 17:13:41 +00:00
}
}
}