diff options
author | Alex <alex@adnab.me> | 2023-01-11 16:00:31 +0000 |
---|---|---|
committer | Alex <alex@adnab.me> | 2023-01-11 16:00:31 +0000 |
commit | be6b8f419d71640e64bccfe195a573daeeab2263 (patch) | |
tree | 7274359a6c9203ad711287c0e98a23b0001bc570 /src/block/metrics.rs | |
parent | 02e8eb167efa1f08d69fe7f8e6192cde726c45aa (diff) | |
parent | 4cfb469d2bcce5bd41fe0af0022b34716ac7279a (diff) | |
download | garage-be6b8f419d71640e64bccfe195a573daeeab2263.tar.gz garage-be6b8f419d71640e64bccfe195a573daeeab2263.zip |
Merge pull request 'Implemented system metrics' (#472) from jpds/garage:system-metrics into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/472
Reviewed-by: Alex <alex@adnab.me>
Diffstat (limited to 'src/block/metrics.rs')
-rw-r--r-- | src/block/metrics.rs | 17 |
1 files changed, 16 insertions, 1 deletions
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() { |