diff options
author | Alex Auvolat <alex@adnab.me> | 2022-02-16 14:23:04 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-03-14 10:51:50 +0100 |
commit | 2cab84b1fe423a41b356211e592a614c95ec4e0c (patch) | |
tree | c7dc3227feccbd6f4a8aba0bf8025201f3acc229 /src/table/metrics.rs | |
parent | 1e2cf26373ef1812a3152a0057774f6381e66914 (diff) | |
download | garage-2cab84b1fe423a41b356211e592a614c95ec4e0c.tar.gz garage-2cab84b1fe423a41b356211e592a614c95ec4e0c.zip |
Add many metrics in table/ and rpc/
Diffstat (limited to 'src/table/metrics.rs')
-rw-r--r-- | src/table/metrics.rs | 75 |
1 files changed, 70 insertions, 5 deletions
diff --git a/src/table/metrics.rs b/src/table/metrics.rs index 38e93904..548bf0d6 100644 --- a/src/table/metrics.rs +++ b/src/table/metrics.rs @@ -2,15 +2,27 @@ use opentelemetry::{global, metrics::*, KeyValue}; /// TableMetrics reference all counter used for metrics pub struct TableMetrics { - merkle_updater_todo_queue_length: ValueObserver<u64>, + pub(crate) _merkle_todo_len: ValueObserver<u64>, + pub(crate) _gc_todo_len: ValueObserver<u64>, + + pub(crate) get_request_counter: BoundCounter<u64>, + pub(crate) get_request_duration: BoundValueRecorder<f64>, + pub(crate) put_request_counter: BoundCounter<u64>, + pub(crate) put_request_duration: BoundValueRecorder<f64>, + + pub(crate) internal_update_counter: BoundCounter<u64>, + pub(crate) internal_delete_counter: BoundCounter<u64>, + + pub(crate) sync_items_sent: Counter<u64>, + pub(crate) sync_items_received: Counter<u64>, } impl TableMetrics { - pub fn new(table_name: &'static str, merkle_todo: sled::Tree) -> Self { + pub fn new(table_name: &'static str, merkle_todo: sled::Tree, gc_todo: sled::Tree) -> Self { let meter = global::meter(table_name); TableMetrics { - merkle_updater_todo_queue_length: meter + _merkle_todo_len: meter .u64_value_observer( - format!("merkle_updater_todo_queue_length"), + "table.merkle_updater_todo_queue_length", move |observer| { observer.observe( merkle_todo.len() as u64, @@ -18,7 +30,60 @@ impl TableMetrics { ) }, ) - .with_description("Bucket merkle updater TODO queue length") + .with_description("Merkle tree updater TODO queue length") + .init(), + _gc_todo_len: meter + .u64_value_observer( + "table.gc_todo_queue_length", + move |observer| { + observer.observe( + gc_todo.len() as u64, + &[KeyValue::new("table_name", table_name)], + ) + }, + ) + .with_description("Table garbage collector TODO queue length") + .init(), + + get_request_counter: meter + .u64_counter("table.get_request_counter") + .with_description("Number of get/get_range requests internally made on this table") + .init() + .bind(&[KeyValue::new("table_name", table_name)]), + get_request_duration: meter + .f64_value_recorder("table.get_request_duration") + .with_description("Duration of get/get_range requests internally made on this table, in seconds") + .init() + .bind(&[KeyValue::new("table_name", table_name)]), + put_request_counter: meter + .u64_counter("table.put_request_counter") + .with_description("Number of insert/insert_many requests internally made on this table") + .init() + .bind(&[KeyValue::new("table_name", table_name)]), + put_request_duration: meter + .f64_value_recorder("table.put_request_duration") + .with_description("Duration of insert/insert_many requests internally made on this table, in seconds") + .init() + .bind(&[KeyValue::new("table_name", table_name)]), + + internal_update_counter: meter + .u64_counter("table.internal_update_counter") + .with_description("Number of value updates where the value actually changes (includes creation of new key and update of existing key)") + .init() + .bind(&[KeyValue::new("table_name", table_name)]), + internal_delete_counter: meter + .u64_counter("table.internal_delete_counter") + .with_description("Number of value deletions in the tree (due to GC or repartitioning)") + .init() + .bind(&[KeyValue::new("table_name", table_name)]), + + sync_items_sent: meter + .u64_counter("table.sync_items_sent") + .with_description("Number of data items sent to other nodes during resync procedures") + .init(), + sync_items_received: meter + .u64_counter("table.sync_items_received") + .with_description("Number of data items received from other nodes during resync procedures") .init(), } } |