garage/src/rpc/system_metrics.rs
Jonathan Davies 8d8023b39a rpc/system_metrics.rs: Adjusted disk space metric names to match
node_exporter filesystem ones.
2023-01-30 20:03:57 +00:00

35 lines
1 KiB
Rust

use opentelemetry::{global, metrics::*};
/// 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>,
}
impl SystemMetrics {
pub fn new() -> Self {
let meter = global::meter("garage_system");
Self {
_garage_build_info: meter
.u64_observable_gauge("garage_build_info")
.with_description("Garage build info")
.init(),
_replication_factor: meter
.u64_observable_gauge("garage_replication_factor")
.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(),
}
}
}