Skip to content

Commit 72625bb

Browse files
committed
chore: add traces
1 parent 00bb2ea commit 72625bb

File tree

6 files changed

+19
-3
lines changed

6 files changed

+19
-3
lines changed

src/mito2/src/read/scan_region.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,7 @@ impl ScanInput {
660660
}
661661

662662
/// Prunes a file to scan and returns the builder to build readers.
663+
#[tracing::instrument(level = tracing::Level::DEBUG, skip_all)]
663664
async fn prune_file(
664665
&self,
665666
file_index: usize,
@@ -818,6 +819,7 @@ impl StreamContext {
818819
}
819820

820821
/// Creates file ranges to scan.
822+
#[tracing::instrument(level = tracing::Level::DEBUG, skip_all)]
821823
pub(crate) async fn build_file_ranges(
822824
&self,
823825
index: RowGroupIndex,
@@ -892,6 +894,7 @@ impl RangeBuilderList {
892894
}
893895

894896
/// Builds file ranges to read the row group at `index`.
897+
#[tracing::instrument(level = tracing::Level::DEBUG, skip_all)]
895898
async fn build_file_ranges(
896899
&self,
897900
input: &ScanInput,

src/mito2/src/read/scan_util.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use std::sync::{Arc, Mutex};
1818
use std::time::{Duration, Instant};
1919

2020
use async_stream::try_stream;
21-
use common_telemetry::debug;
21+
use common_telemetry::{debug, tracing};
2222
use futures::Stream;
2323
use store_api::storage::RegionId;
2424

@@ -148,6 +148,7 @@ pub(crate) fn scan_mem_ranges(
148148
}
149149

150150
/// Scans file ranges at `index`.
151+
#[tracing::instrument(level = tracing::Level::DEBUG, skip_all)]
151152
pub(crate) fn scan_file_ranges(
152153
stream_ctx: Arc<StreamContext>,
153154
part_metrics: PartitionMetrics,

src/mito2/src/read/seq_scan.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ impl fmt::Debug for SeqScan {
348348
}
349349

350350
/// Builds sources for the partition range.
351+
#[tracing::instrument(level = tracing::Level::DEBUG, skip_all)]
351352
fn build_sources(
352353
stream_ctx: &Arc<StreamContext>,
353354
part_range: &PartitionRange,

src/mito2/src/sst/parquet/file_range.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use std::ops::BitAnd;
1919
use std::sync::Arc;
2020

2121
use api::v1::{OpType, SemanticType};
22-
use common_telemetry::error;
22+
use common_telemetry::{error, tracing};
2323
use datatypes::arrow::array::BooleanArray;
2424
use datatypes::arrow::buffer::BooleanBuffer;
2525
use parquet::arrow::arrow_reader::RowSelection;
@@ -80,6 +80,7 @@ impl FileRange {
8080
}
8181

8282
/// Returns a reader to read the [FileRange].
83+
#[tracing::instrument(level = tracing::Level::DEBUG, skip_all)]
8384
pub(crate) async fn reader(
8485
&self,
8586
selector: Option<TimeSeriesRowSelector>,

src/mito2/src/sst/parquet/reader.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use std::time::{Duration, Instant};
2222
use api::v1::SemanticType;
2323
use async_trait::async_trait;
2424
use common_recordbatch::filter::SimpleFilterEvaluator;
25-
use common_telemetry::{debug, warn};
25+
use common_telemetry::{debug, tracing, warn};
2626
use common_time::range::TimestampRange;
2727
use common_time::timestamp::TimeUnit;
2828
use common_time::Timestamp;
@@ -183,6 +183,7 @@ impl ParquetReaderBuilder {
183183
/// Builds a [FileRangeContext] and collects row groups to read.
184184
///
185185
/// This needs to perform IO operation.
186+
#[tracing::instrument(level = tracing::Level::DEBUG, skip_all)]
186187
pub(crate) async fn build_reader_input(
187188
&self,
188189
metrics: &mut ReaderMetrics,
@@ -336,6 +337,7 @@ impl ParquetReaderBuilder {
336337
}
337338

338339
/// Computes row groups to read, along with their respective row selections.
340+
#[tracing::instrument(level = tracing::Level::DEBUG, skip_all)]
339341
async fn row_groups_to_read(
340342
&self,
341343
read_format: &ReadFormat,
@@ -381,6 +383,7 @@ impl ParquetReaderBuilder {
381383
}
382384

383385
/// Prunes row groups by fulltext index. Returns `true` if the row groups are pruned.
386+
#[tracing::instrument(level = tracing::Level::DEBUG, skip_all)]
384387
async fn prune_row_groups_by_fulltext_index(
385388
&self,
386389
row_group_size: usize,
@@ -461,6 +464,7 @@ impl ParquetReaderBuilder {
461464
/// TODO(zhongzc): Devise a mechanism to enforce the non-use of indices
462465
/// as an escape route in case of index issues, and it can be used to test
463466
/// the correctness of the index.
467+
#[tracing::instrument(level = tracing::Level::DEBUG, skip_all)]
464468
async fn prune_row_groups_by_inverted_index(
465469
&self,
466470
row_group_size: usize,
@@ -528,6 +532,7 @@ impl ParquetReaderBuilder {
528532
}
529533

530534
/// Prunes row groups by min-max index.
535+
#[tracing::instrument(level = tracing::Level::DEBUG, skip_all)]
531536
fn prune_row_groups_by_minmax(
532537
&self,
533538
read_format: &ReadFormat,
@@ -869,6 +874,7 @@ impl RowGroupReaderBuilder {
869874
}
870875

871876
/// Builds a [ParquetRecordBatchReader] to read the row group at `row_group_idx`.
877+
#[tracing::instrument(level = tracing::Level::DEBUG, skip_all)]
872878
pub(crate) async fn build(
873879
&self,
874880
row_group_idx: usize,

src/mito2/src/sst/parquet/row_group.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use std::ops::Range;
1818
use std::sync::Arc;
1919

2020
use bytes::{Buf, Bytes};
21+
use common_telemetry::tracing;
2122
use object_store::ObjectStore;
2223
use parquet::arrow::arrow_reader::{RowGroups, RowSelection};
2324
use parquet::arrow::ProjectionMask;
@@ -97,6 +98,7 @@ impl<'a> InMemoryRowGroup<'a> {
9798
}
9899

99100
/// Fetches the necessary column data into memory
101+
#[tracing::instrument(level = tracing::Level::DEBUG, skip_all)]
100102
pub async fn fetch(
101103
&mut self,
102104
projection: &ProjectionMask,
@@ -235,6 +237,7 @@ impl<'a> InMemoryRowGroup<'a> {
235237

236238
/// Fetches pages for columns if cache is enabled.
237239
/// If the page is in the cache, sets the column chunk or `column_uncompressed_pages` for the column.
240+
#[tracing::instrument(level = tracing::Level::DEBUG, skip_all)]
238241
fn fetch_pages_from_cache(&mut self, projection: &ProjectionMask) {
239242
let _timer = READ_STAGE_FETCH_PAGES.start_timer();
240243
self.column_chunks
@@ -276,6 +279,7 @@ impl<'a> InMemoryRowGroup<'a> {
276279

277280
/// Try to fetch data from WriteCache,
278281
/// if not in WriteCache, fetch data from object store directly.
282+
#[tracing::instrument(level = tracing::Level::DEBUG, skip_all)]
279283
async fn fetch_bytes(&self, ranges: &[Range<u64>]) -> Result<Vec<Bytes>> {
280284
let key = IndexKey::new(self.region_id, self.file_id, FileType::Parquet);
281285
match self.fetch_ranges_from_write_cache(key, ranges).await {

0 commit comments

Comments
 (0)