@@ -31,6 +31,7 @@ use tokio::sync::{RwLock, mpsc};
3131use tokio:: task:: JoinHandle ;
3232use tokio:: time:: { Interval , interval_at} ;
3333use tokio_util:: sync:: CancellationToken ;
34+ use tracing:: instrument;
3435use uuid:: Uuid ;
3536
3637pub use super :: index:: {
@@ -942,6 +943,7 @@ impl RegionWriter {
942943 ///
943944 /// The `base_path` should come from `ObjectStore::from_uri()` to ensure
944945 /// WAL files are written inside the dataset directory.
946+ #[ instrument( level = "info" , skip( object_store, base_path, base_uri, schema, index_configs) , fields( region_id = %config. region_id, index_count = index_configs. len( ) ) ) ]
945947 pub async fn open (
946948 object_store : Arc < ObjectStore > ,
947949 base_path : Path ,
@@ -1102,6 +1104,7 @@ impl RegionWriter {
11021104 /// Fencing is detected lazily during WAL flush via atomic writes.
11031105 /// If another writer has taken over, the WAL flush will fail with
11041106 /// `AlreadyExists`, indicating this writer has been fenced.
1107+ #[ instrument( level = "info" , skip( self , batches) , fields( batch_count = batches. len( ) , region_id = %self . config. region_id) ) ]
11051108 pub async fn put ( & self , batches : Vec < RecordBatch > ) -> Result < WriteResult > {
11061109 if batches. is_empty ( ) {
11071110 return Err ( Error :: invalid_input ( "Cannot write empty batch list" ) ) ;
@@ -1257,6 +1260,7 @@ impl RegionWriter {
12571260 /// Close the writer gracefully.
12581261 ///
12591262 /// Flushes pending data and shuts down background tasks.
1263+ #[ instrument( level = "info" , skip( self ) , fields( region_id = %self . config. region_id, epoch = self . epoch) ) ]
12601264 pub async fn close ( self ) -> Result < ( ) > {
12611265 info ! ( "Closing RegionWriter for region {}" , self . config. region_id) ;
12621266
@@ -1373,6 +1377,11 @@ impl WalFlushHandler {
13731377 /// * `batch_store` - The batch store to flush from
13741378 /// * `indexes` - Optional indexes to update in parallel with WAL I/O
13751379 /// * `end_batch_position` - End batch ID (exclusive). Flush batches in (max_flushed, end_batch_position).
1380+ #[ instrument(
1381+ level = "debug" ,
1382+ skip( self , batch_store, indexes) ,
1383+ fields( end_batch_position)
1384+ ) ]
13761385 async fn do_flush (
13771386 & self ,
13781387 batch_store : Arc < BatchStore > ,
@@ -1486,6 +1495,7 @@ impl MemTableFlushHandler {
14861495 /// This method waits for the WAL flush to complete (sent at freeze time),
14871496 /// then flushes to Lance storage. The WAL flush is already queued by
14881497 /// freeze_memtable to ensure strict ordering of WAL entries.
1498+ #[ instrument( level = "info" , skip( self , memtable) , fields( generation = memtable. generation( ) , row_count = memtable. row_count( ) ) ) ]
14891499 async fn flush_memtable (
14901500 & mut self ,
14911501 memtable : Arc < MemTable > ,
0 commit comments