diff options
author | Alex Auvolat <alex@adnab.me> | 2022-02-22 14:52:41 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-03-14 10:53:36 +0100 |
commit | 2a5609b292de019085f93a79b7b73f7a8341bf51 (patch) | |
tree | 7175cbeb1fc4eabcec936ccb8aee2945a92b1c60 /src/model/block.rs | |
parent | 818daa5c786813fdf50fecb6022e29b18e509b62 (diff) | |
download | garage-2a5609b292de019085f93a79b7b73f7a8341bf51.tar.gz garage-2a5609b292de019085f93a79b7b73f7a8341bf51.zip |
Add metrics to API endpoint
Diffstat (limited to 'src/model/block.rs')
-rw-r--r-- | src/model/block.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/model/block.rs b/src/model/block.rs index 058c71fd..d97e64a8 100644 --- a/src/model/block.rs +++ b/src/model/block.rs @@ -1,7 +1,7 @@ use std::convert::TryInto; use std::path::{Path, PathBuf}; use std::sync::Arc; -use std::time::{Duration}; +use std::time::Duration; use arc_swap::ArcSwapOption; use async_trait::async_trait; @@ -21,9 +21,9 @@ use opentelemetry::{ use garage_util::data::*; use garage_util::error::*; +use garage_util::metrics::RecordDuration; use garage_util::time::*; use garage_util::tranquilizer::Tranquilizer; -use garage_util::metrics::RecordDuration; use garage_rpc::system::System; use garage_rpc::*; @@ -409,11 +409,14 @@ impl BlockManager { /// Read block from disk, verifying it's integrity async fn read_block(&self, hash: &Hash) -> Result<BlockRpc, Error> { - let data = self.read_block_internal(hash) + let data = self + .read_block_internal(hash) .bound_record_duration(&self.metrics.block_read_duration) .await?; - self.metrics.bytes_read.add(data.inner_buffer().len() as u64); + self.metrics + .bytes_read + .add(data.inner_buffer().len() as u64); Ok(BlockRpc::PutBlock { hash: *hash, data }) } |