1use metrics::{
11 counter,
12 gauge
13};
14
15#[derive(Debug)]
18pub struct Metrics {}
19
20impl Metrics {
21 pub fn set_keys_total(tree: &str, value: u64) {
23 gauge!("epochdb_keys_total", "tree" => tree.to_string()).set(value as f64);
24 }
25
26 pub fn inc_keys_total(tree: &str) {
28 gauge!("epochdb_keys_total", "tree" => tree.to_string()).increment(1);
29 }
30
31 pub fn dec_keys_total(tree: &str) {
33 gauge!("epochdb_keys_total", "tree" => tree.to_string()).decrement(1);
34 }
35
36 pub fn increment_operations(op: &str) {
38 counter!("epochdb_operations_total", "operation" => op.to_string()).increment(1);
39 }
40
41 pub fn set_disk_size(bytes: f64) {
43 gauge!("epochdb_disk_size_bytes").set(bytes);
44 }
45
46 pub fn set_backup_size(bytes: f64) {
48 gauge!("epochdb_backup_size_bytes").set(bytes);
49 }
50
51 pub fn increment_ttl_expired_keys() {
53 counter!("epochdb_ttl_expired_keys_total").increment(1);
54 }
55
56 pub fn inc_amount_keys_total(tree: &str, value: u64) {
58 gauge!("epochdb_keys_total", "tree" => tree.to_string()).set(value as f64);
59 }
60
61 pub fn dec_amount_keys_total(tree: &str, amount: u64) {
63 gauge!("epochdb_keys_total", "tree" => tree.to_string()).decrement(amount as f64);
64 }
65
66 pub fn increment_amount_operations(op: &str, amount: u64) {
68 counter!("epochdb_operations_total", "operation" => op.to_string()).increment(amount);
69 }
70}