diff --git a/Cargo.toml b/Cargo.toml index 637b2e9c4..48ea4ce44 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,6 +19,7 @@ oneshot = "0.1.5" base64 = "0.21.0" byteorder = "1.4.3" crc32fast = "1.3.2" +tracing = "0.1" once_cell = "1.10.0" regex = { version = "1.5.5", default-features = false, features = ["std", "unicode"] } aho-corasick = "1.0" diff --git a/sstable/Cargo.toml b/sstable/Cargo.toml index 763cb6a7d..fc520ca93 100644 --- a/sstable/Cargo.toml +++ b/sstable/Cargo.toml @@ -14,6 +14,7 @@ common = {version= "0.6", path="../common", package="tantivy-common"} tantivy-fst = "0.4" # experimental gives us access to Decompressor::upper_bound zstd = { version = "0.13", features = ["experimental"] } +tracing = "0.1" [dev-dependencies] proptest = "1" diff --git a/sstable/src/dictionary.rs b/sstable/src/dictionary.rs index 0eb5822d9..2d1f2362f 100644 --- a/sstable/src/dictionary.rs +++ b/sstable/src/dictionary.rs @@ -3,6 +3,7 @@ use std::io; use std::marker::PhantomData; use std::ops::{Bound, RangeBounds}; use std::sync::Arc; +use tracing::instrument; use common::file_slice::FileSlice; use common::{BinarySerializable, OwnedBytes}; @@ -94,6 +95,7 @@ impl Dictionary { Ok(TSSTable::delta_reader(data)) } + #[instrument(skip_all)] pub(crate) async fn sstable_delta_reader_block_async( &self, block_addr: BlockAddr, @@ -232,6 +234,7 @@ impl Dictionary { /// If the key was not found, returns Ok(None). /// After calling this function, it is possible to call `DeltaReader::value` to get the /// associated value. + #[instrument(skip_all)] fn decode_up_to_key>( &self, key: K, @@ -344,6 +347,7 @@ impl Dictionary { } /// Lookups the value corresponding to the key. + #[instrument(skip_all)] pub async fn get_async>(&self, key: K) -> io::Result> { if let Some(block_addr) = self.sstable_index.get_block_with_key(key.as_ref()) { let sstable_reader = self.sstable_delta_reader_block_async(block_addr).await?; diff --git a/sstable/src/sstable_index.rs b/sstable/src/sstable_index.rs index 1ce85305c..2d51cdd6c 100644 --- a/sstable/src/sstable_index.rs +++ b/sstable/src/sstable_index.rs @@ -1,6 +1,7 @@ use std::io::{self, Write}; use std::ops::Range; +use tracing::instrument; use common::OwnedBytes; use crate::{common_prefix_len, SSTable, SSTableDataCorruption, TermOrdinal}; @@ -27,6 +28,7 @@ impl SSTableIndex { } /// Get the [`BlockAddr`] of the requested block. + #[instrument] pub(crate) fn get_block(&self, block_id: usize) -> Option { self.blocks .get(block_id) @@ -56,6 +58,7 @@ impl SSTableIndex { /// Get the [`BlockAddr`] of the block that would contain `key`. /// /// Returns None if `key` is lexicographically after the last key recorded. + #[instrument] pub fn get_block_with_key(&self, key: &[u8]) -> Option { self.locate_with_key(key).and_then(|id| self.get_block(id)) }