diff options
author | Alex Auvolat <alex@adnab.me> | 2024-03-28 15:01:05 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2024-03-28 15:01:05 +0100 |
commit | 8bfc16ba7d5e0c2806aa32e0257fbdc21cb93860 (patch) | |
tree | 49d6c32376708147e90ba64ea32cea7835e751c1 /src/block/metrics.rs | |
parent | 25c196f34d958f4f61d50c89a1c5d40b96d7cd24 (diff) | |
parent | ecf641d88c264f7278d13a6d988288feb24a5dfe (diff) | |
download | garage-8bfc16ba7d5e0c2806aa32e0257fbdc21cb93860.tar.gz garage-8bfc16ba7d5e0c2806aa32e0257fbdc21cb93860.zip |
Merge branch 'main' into next-0.10
Diffstat (limited to 'src/block/metrics.rs')
-rw-r--r-- | src/block/metrics.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/block/metrics.rs b/src/block/metrics.rs index 8e10afdf..2d41e365 100644 --- a/src/block/metrics.rs +++ b/src/block/metrics.rs @@ -1,3 +1,7 @@ +use std::sync::Arc; + +use tokio::sync::Semaphore; + use opentelemetry::{global, metrics::*}; use garage_db as db; @@ -8,6 +12,7 @@ pub struct BlockManagerMetrics { pub(crate) _rc_size: ValueObserver<u64>, pub(crate) _resync_queue_len: ValueObserver<u64>, pub(crate) _resync_errored_blocks: ValueObserver<u64>, + pub(crate) _buffer_free_kb: ValueObserver<u64>, pub(crate) resync_counter: BoundCounter<u64>, pub(crate) resync_error_counter: BoundCounter<u64>, @@ -30,6 +35,7 @@ impl BlockManagerMetrics { rc_tree: db::Tree, resync_queue: db::Tree, resync_errors: db::Tree, + buffer_semaphore: Arc<Semaphore>, ) -> Self { let meter = global::meter("garage_model/block"); Self { @@ -69,6 +75,15 @@ impl BlockManagerMetrics { .with_description("Number of block hashes whose last resync resulted in an error") .init(), + _buffer_free_kb: meter + .u64_value_observer("block.ram_buffer_free_kb", move |observer| { + observer.observe(buffer_semaphore.available_permits() as u64, &[]) + }) + .with_description( + "Available RAM in KiB to use for buffering data blocks to be written to remote nodes", + ) + .init(), + resync_counter: meter .u64_counter("block.resync_counter") .with_description("Number of calls to resync_block") |