@@ -981,6 +981,16 @@ where
981981 Operation < F , update:: Unordered < K , V > > : Codec ,
982982{
983983 /// Resolve mutations into operations, merkleize, and return an `Arc<MerkleizedBatch>`.
984+ #[ allow( clippy:: type_complexity) ]
985+ #[ tracing:: instrument(
986+ name = "qmdb::any::batch::merkleize" ,
987+ level = "info" ,
988+ skip_all,
989+ fields(
990+ variant = "unordered" ,
991+ mutations = self . mutations. len( ) as u64 ,
992+ ) ,
993+ ) ]
984994 pub async fn merkleize < E , C , I , const N : usize > (
985995 self ,
986996 db : & Db < F , E , C , I , H , update:: Unordered < K , V > , N , S > ,
@@ -1143,6 +1153,16 @@ where
11431153 Operation < F , update:: Ordered < K , V > > : Codec ,
11441154{
11451155 /// Resolve mutations into operations, merkleize, and return an `Arc<MerkleizedBatch>`.
1156+ #[ allow( clippy:: type_complexity) ]
1157+ #[ tracing:: instrument(
1158+ name = "qmdb::any::batch::merkleize" ,
1159+ level = "info" ,
1160+ skip_all,
1161+ fields(
1162+ variant = "ordered" ,
1163+ mutations = self . mutations. len( ) as u64 ,
1164+ ) ,
1165+ ) ]
11461166 pub async fn merkleize < E , C , I , const N : usize > (
11471167 self ,
11481168 db : & Db < F , E , C , I , H , update:: Ordered < K , V > , N , S > ,
@@ -1508,6 +1528,17 @@ where
15081528 /// All uncommitted ancestors in the chain must be kept alive until the child (or any
15091529 /// descendant) is merkleized. Dropping an uncommitted ancestor causes data
15101530 /// loss detected at `apply_batch` time.
1531+ #[ tracing:: instrument(
1532+ name = "qmdb::any::batch::new" ,
1533+ level = "debug" ,
1534+ skip_all,
1535+ fields(
1536+ source = "batch" ,
1537+ base_size = self . bounds. base_size,
1538+ total_size = self . bounds. total_size,
1539+ ancestor_batches = self . ancestor_diffs. len( ) as u64 ,
1540+ ) ,
1541+ ) ]
15111542 pub fn new_batch < H > ( self : & Arc < Self > ) -> UnmerkleizedBatch < F , H , U , S >
15121543 where
15131544 H : Hasher < Digest = D > ,
@@ -1616,6 +1647,17 @@ where
16161647 Operation < F , U > : Codec ,
16171648{
16181649 /// Create a new speculative batch of operations with this database as its parent.
1650+ #[ tracing:: instrument(
1651+ name = "qmdb::any::batch::new" ,
1652+ level = "debug" ,
1653+ skip_all,
1654+ fields(
1655+ source = "db" ,
1656+ base_size = * self . last_commit_loc + 1 ,
1657+ inactivity_floor = * self . inactivity_floor_loc,
1658+ active_keys = self . active_keys as u64 ,
1659+ ) ,
1660+ ) ]
16191661 pub fn new_batch ( & self ) -> UnmerkleizedBatch < F , H , U , S > {
16201662 // The DB is always committed, so journal size = last_commit_loc + 1.
16211663 let journal_size = * self . last_commit_loc + 1 ;
@@ -1651,6 +1693,17 @@ where
16511693 /// This publishes the batch to the in-memory database state and appends it to the
16521694 /// journal, but does not durably persist it. Call [`Db::commit`] or [`Db::sync`] to
16531695 /// guarantee durability.
1696+ #[ tracing:: instrument(
1697+ name = "qmdb::any::Db::apply_batch" ,
1698+ level = "info" ,
1699+ skip_all,
1700+ fields(
1701+ batch_total_size = batch. bounds. total_size,
1702+ batch_base_size = batch. bounds. base_size,
1703+ db_size = * self . last_commit_loc + 1 ,
1704+ ancestor_batches = batch. ancestor_diffs. len( ) as u64 ,
1705+ ) ,
1706+ ) ]
16541707 pub async fn apply_batch (
16551708 & mut self ,
16561709 batch : Arc < MerkleizedBatch < F , H :: Digest , U , S > > ,
@@ -1742,6 +1795,16 @@ where
17421795 /// Create an initial [`MerkleizedBatch`] from the committed DB state.
17431796 ///
17441797 /// This is the starting point for building owned batch chains.
1798+ #[ tracing:: instrument(
1799+ name = "qmdb::any::Db::to_batch" ,
1800+ level = "info" ,
1801+ skip_all,
1802+ fields(
1803+ db_size = * self . last_commit_loc + 1 ,
1804+ inactivity_floor = * self . inactivity_floor_loc,
1805+ active_keys = self . active_keys as u64 ,
1806+ ) ,
1807+ ) ]
17451808 pub fn to_batch ( & self ) -> Arc < MerkleizedBatch < F , H :: Digest , U , S > > {
17461809 // The DB is always committed, so journal size = last_commit_loc + 1.
17471810 let journal_size = * self . last_commit_loc + 1 ;
0 commit comments