use metrics::{
counter,
gauge
};
#[derive(Debug)]
pub struct Metrics {}
impl Metrics {
pub fn set_keys_total(tree: &str, value: u64) {
gauge!("epochdb_keys_total", "tree" => tree.to_string()).set(value as f64);
}
pub fn inc_keys_total(tree: &str) {
gauge!("epochdb_keys_total", "tree" => tree.to_string()).increment(1);
}
pub fn dec_keys_total(tree: &str) {
gauge!("epochdb_keys_total", "tree" => tree.to_string()).decrement(1);
}
pub fn increment_operations(op: &str) {
counter!("epochdb_operations_total", "operation" => op.to_string()).increment(1);
}
pub fn set_disk_size(bytes: f64) {
gauge!("epochdb_disk_size_bytes").set(bytes);
}
pub fn set_backup_size(bytes: f64) {
gauge!("epochdb_backup_size_bytes").set(bytes);
}
pub fn increment_ttl_expired_keys() {
counter!("epochdb_ttl_expired_keys_total").increment(1);
}
pub fn inc_amount_keys_total(tree: &str, value: u64) {
gauge!("epochdb_keys_total", "tree" => tree.to_string()).set(value as f64);
}
pub fn dec_amount_keys_total(tree: &str, amount: u64) {
gauge!("epochdb_keys_total", "tree" => tree.to_string()).decrement(amount as f64);
}
pub fn increment_amount_operations(op: &str, amount: u64) {
counter!("epochdb_operations_total", "operation" => op.to_string()).increment(amount);
}
}