aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Davies <jpds@protonmail.com>2023-01-09 18:49:33 +0000
committerJonathan Davies <jpds@protonmail.com>2023-01-10 10:40:03 +0000
commit4cfb469d2bcce5bd41fe0af0022b34716ac7279a (patch)
tree7274359a6c9203ad711287c0e98a23b0001bc570
parentdf1d9a98737e8a38656de8ac71bb23e8d3ad2ce9 (diff)
downloadgarage-4cfb469d2bcce5bd41fe0af0022b34716ac7279a.tar.gz
garage-4cfb469d2bcce5bd41fe0af0022b34716ac7279a.zip
block/metrics.rs: Added compression_level metric.
-rw-r--r--src/block/manager.rs8
-rw-r--r--src/block/metrics.rs17
2 files changed, 22 insertions, 3 deletions
diff --git a/src/block/manager.rs b/src/block/manager.rs
index 1655be06..051a9f93 100644
--- a/src/block/manager.rs
+++ b/src/block/manager.rs
@@ -129,8 +129,12 @@ impl BlockManager {
.netapp
.endpoint("garage_block/manager.rs/Rpc".to_string());
- let metrics =
- BlockManagerMetrics::new(rc.rc.clone(), resync.queue.clone(), resync.errors.clone());
+ let metrics = BlockManagerMetrics::new(
+ compression_level,
+ rc.rc.clone(),
+ resync.queue.clone(),
+ resync.errors.clone(),
+ );
let scrub_persister = PersisterShared::new(&system.metadata_dir, "scrub_info");
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<u64>,
pub(crate) _rc_size: ValueObserver<u64>,
pub(crate) _resync_queue_len: ValueObserver<u64>,
pub(crate) _resync_errored_blocks: ValueObserver<u64>,
@@ -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<i32>,
+ 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() {