@@ -36,6 +36,7 @@ use common::{
3636 report_error,
3737 LeaseLostError ,
3838 } ,
39+ fastrace_helpers:: get_sampled_span,
3940 index:: {
4041 IndexEntry ,
4142 SplitKey ,
@@ -102,6 +103,10 @@ use common::{
102103 } ,
103104} ;
104105use errors:: ErrorMetadata ;
106+ use fastrace:: {
107+ future:: FutureExt as _,
108+ Span ,
109+ } ;
105110use futures:: {
106111 future:: try_join_all,
107112 pin_mut,
@@ -584,6 +589,9 @@ impl<RT: Runtime> LeaderRetentionManager<RT> {
584589 } )
585590 . collect ( ) ,
586591 )
592+ . in_span ( Span :: enter_with_local_parent (
593+ "previous_revisions_of_documents" ,
594+ ) )
587595 . await ?;
588596 for DocumentLogEntry {
589597 ts,
@@ -692,6 +700,7 @@ impl<RT: Runtime> LeaderRetentionManager<RT> {
692700 /// entries is the number of index entries we found were expired, not
693701 /// necessarily the total we deleted or wanted to delete, though they're
694702 /// correlated.
703+ #[ fastrace:: trace]
695704 async fn delete (
696705 min_snapshot_ts : RepeatableTimestamp ,
697706 persistence : Arc < dyn Persistence > ,
@@ -1016,6 +1025,7 @@ impl<RT: Runtime> LeaderRetentionManager<RT> {
10161025 parts
10171026 }
10181027
1028+ #[ fastrace:: trace]
10191029 async fn delete_chunk (
10201030 delete_chunk : Vec < ( Timestamp , IndexEntry ) > ,
10211031 persistence : Arc < dyn Persistence > ,
@@ -1138,7 +1148,8 @@ impl<RT: Runtime> LeaderRetentionManager<RT> {
11381148 "go_delete_indexes: running, is_working: {is_working}, current_bounds: \
11391149 {min_snapshot_ts}",
11401150 ) ;
1141- let r: anyhow:: Result < ( ) > = try {
1151+ let span = get_sampled_span ( "" , "delete_indexes" , & mut rt. rng ( ) , BTreeMap :: new ( ) ) ;
1152+ let r: anyhow:: Result < ( ) > = async {
11421153 let _timer = retention_delete_timer ( ) ;
11431154 let cursor = Self :: get_checkpoint (
11441155 reader. as_ref ( ) ,
@@ -1208,7 +1219,10 @@ impl<RT: Runtime> LeaderRetentionManager<RT> {
12081219 "go_delete: processed {expired_index_entries_processed:?} rows, more to go"
12091220 ) ;
12101221 }
1211- } ;
1222+ Ok ( ( ) )
1223+ }
1224+ . in_span ( span)
1225+ . await ;
12121226 if let Err ( mut err) = r {
12131227 report_error ( & mut err) . await ;
12141228 let delay = error_backoff. fail ( & mut rt. rng ( ) ) ;
@@ -1447,6 +1461,7 @@ impl<RT: Runtime> LeaderRetentionManager<RT> {
14471461 Ok ( ( ) )
14481462 }
14491463
1464+ #[ fastrace:: trace]
14501465 async fn accumulate_indexes (
14511466 persistence : & dyn Persistence ,
14521467 all_indexes : & mut BTreeMap < IndexId , ( GenericIndexName < TabletId > , IndexedFields ) > ,
0 commit comments