File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
crates/application/src/system_table_cleanup Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 1+ use chrono:: Utc ;
2+ use common:: document:: CreationTime ;
13use metrics:: {
24 log_counter,
35 log_counter_with_labels,
6+ log_distribution_with_labels,
47 prometheus:: VMHistogram ,
58 register_convex_counter,
69 register_convex_histogram,
@@ -37,3 +40,18 @@ register_convex_counter!(
3740pub fn log_exports_s3_cleanup ( ) {
3841 log_counter ( & EXPORT_TABLE_CLEANUP_ROWS_TOTAL , 1 )
3942}
43+
44+ register_convex_histogram ! (
45+ SYSTEM_TABLE_CLEANUP_CURSOR_LAG_SECONDS ,
46+ "Lag between system table cleanup cursor and now" ,
47+ & [ "table" ]
48+ ) ;
49+ pub fn log_system_table_cursor_lag ( table_name : & TableName , cursor : CreationTime ) {
50+ let now = Utc :: now ( ) . timestamp_millis ( ) ;
51+ let delay_ms = ( now as f64 ) - f64:: from ( cursor) ;
52+ log_distribution_with_labels (
53+ & SYSTEM_TABLE_CLEANUP_CURSOR_LAG_SECONDS ,
54+ delay_ms / 1000.0 ,
55+ vec ! [ StaticMetricLabel :: new( "table" , table_name. to_string( ) ) ] ,
56+ )
57+ }
Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ use keybroker::Identity;
5555use metrics:: {
5656 log_exports_s3_cleanup,
5757 log_system_table_cleanup_rows,
58+ log_system_table_cursor_lag,
5859 system_table_cleanup_timer,
5960} ;
6061use model:: {
@@ -334,6 +335,9 @@ impl<RT: Runtime> SystemTableCleanupWorker<RT> {
334335 . await ?;
335336 tracing:: info!( "deleted {deleted_count} documents from {table}" ) ;
336337 log_system_table_cleanup_rows ( table, deleted_count) ;
338+ if let Some ( cursor) = cursor {
339+ log_system_table_cursor_lag ( table, * cursor) ;
340+ }
337341 Ok ( deleted_count)
338342 }
339343
You can’t perform that action at this time.
0 commit comments