From 4cfb469d2bcce5bd41fe0af0022b34716ac7279a Mon Sep 17 00:00:00 2001 From: Jonathan Davies Date: Mon, 9 Jan 2023 18:49:33 +0000 Subject: block/metrics.rs: Added compression_level metric. --- src/block/metrics.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/block/metrics.rs') diff --git a/src/block/metrics.rs b/src/block/metrics.rs index fbef95af..500022fc 100644 --- a/src/block/metrics.rs +++ b/src/block/metrics.rs @@ -5,6 +5,7 @@ use garage_db::counted_tree_hack::CountedTree; /// TableMetrics reference all counter used for metrics pub struct BlockManagerMetrics { + pub(crate) _compression_level: ValueObserver, pub(crate) _rc_size: ValueObserver, pub(crate) _resync_queue_len: ValueObserver, pub(crate) _resync_errored_blocks: ValueObserver, @@ -25,9 +26,23 @@ pub struct BlockManagerMetrics { } impl BlockManagerMetrics { - pub fn new(rc_tree: db::Tree, resync_queue: CountedTree, resync_errors: CountedTree) -> Self { + pub fn new( + compression_level: Option, + rc_tree: db::Tree, + resync_queue: CountedTree, + resync_errors: CountedTree, + ) -> Self { let meter = global::meter("garage_model/block"); Self { + _compression_level: meter + .u64_value_observer("block.compression_level", move |observer| { + match compression_level { + Some(v) => observer.observe(v as u64, &[]), + None => observer.observe(0 as u64, &[]), + } + }) + .with_description("Garage compression level for node") + .init(), _rc_size: meter .u64_value_observer("block.rc_size", move |observer| { if let Ok(Some(v)) = rc_tree.fast_len() { -- cgit v1.2.3 From 8e93d6997415d60ba5c371da8b27065a57254a8c Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Thu, 26 Jan 2023 17:26:32 +0100 Subject: More clippy fixes --- src/block/metrics.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/block/metrics.rs') diff --git a/src/block/metrics.rs b/src/block/metrics.rs index 500022fc..6659df32 100644 --- a/src/block/metrics.rs +++ b/src/block/metrics.rs @@ -38,7 +38,7 @@ impl BlockManagerMetrics { .u64_value_observer("block.compression_level", move |observer| { match compression_level { Some(v) => observer.observe(v as u64, &[]), - None => observer.observe(0 as u64, &[]), + None => observer.observe(0_u64, &[]), } }) .with_description("Garage compression level for node") -- cgit v1.2.3