Skip to content

Commit

Permalink
[CHORE] Add tracing to blockfile gets (#2485)
Browse files Browse the repository at this point in the history
## Description of changes

*Summarize the changes made by this PR.*
 - Improvements & Bug fixes
	 - Adds some tracing to reading block from cache/storage
	 - Adds some tracing to read from the block itself
 - New functionality
	 - None

## Test plan
*How are these changes tested?*
- [x] Tests pass locally with `pytest` for python, `yarn test` for js,
`cargo test` for rust

## Documentation Changes
None
  • Loading branch information
HammadB authored Jul 10, 2024
1 parent 0c37b73 commit eb783ff
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions rust/worker/src/blockstore/arrow/blockfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use parking_lot::Mutex;
use std::{collections::HashMap, sync::Arc};
use std::{collections::HashSet, mem::transmute};
use thiserror::Error;
use tracing::{trace_span, Instrument};
use uuid::Uuid;

#[derive(Clone)]
Expand Down Expand Up @@ -280,9 +281,15 @@ impl<'me, K: ArrowReadableKey<'me> + Into<KeyWrapper>, V: ArrowReadableValue<'me
pub(crate) async fn get(&'me self, prefix: &str, key: K) -> Result<V, Box<dyn ChromaError>> {
let search_key = CompositeKey::new(prefix.to_string(), key.clone());
let target_block_id = self.sparse_index.get_target_block_id(&search_key);
let block = self.get_block(target_block_id).await;
let block = self
.get_block(target_block_id)
.instrument(tracing::info_span!("Get Block", block_id = %target_block_id))
.await;
let res = match block {
Some(block) => block.get(prefix, key.clone()),
Some(block) => {
let block_get_span = tracing::info_span!("Block Get", block_id = %target_block_id);
block_get_span.in_scope(|| block.get(prefix, key.clone()))
}
None => {
tracing::error!("Block with id {:?} not found", target_block_id);
return Err(Box::new(ArrowBlockfileError::BlockNotFound));
Expand Down

0 comments on commit eb783ff

Please sign in to comment.