@@ -12,10 +12,7 @@ use metrics::{
1212 log_counter_with_labels,
1313 log_distribution,
1414 log_distribution_with_labels,
15- log_gauge,
16- log_gauge_with_labels,
1715 register_convex_counter,
18- register_convex_gauge,
1916 register_convex_histogram,
2017 IntoLabel ,
2118 StaticMetricLabel ,
@@ -33,25 +30,25 @@ use crate::{
3330 Transaction ,
3431} ;
3532
36- register_convex_gauge ! (
33+ register_convex_histogram ! (
3734 DOCUMENTS_SIZE_BYTES ,
3835 "Total size of document store in bytes"
3936) ;
4037pub fn log_document_store_size ( total_size : u64 ) {
41- log_gauge ( & DOCUMENTS_SIZE_BYTES , total_size as f64 ) ;
38+ log_distribution ( & DOCUMENTS_SIZE_BYTES , total_size as f64 ) ;
4239}
4340
44- register_convex_gauge ! ( DOCUMENTS_KEYS_TOTAL , "Total number of document keys" ) ;
41+ register_convex_histogram ! ( DOCUMENTS_KEYS_TOTAL , "Total number of document keys" ) ;
4542pub fn log_num_keys ( num_keys : u64 ) {
46- log_gauge ( & DOCUMENTS_KEYS_TOTAL , num_keys as f64 ) ;
43+ log_distribution ( & DOCUMENTS_KEYS_TOTAL , num_keys as f64 ) ;
4744}
4845
49- register_convex_gauge ! (
46+ register_convex_histogram ! (
5047 INDEXES_TO_BACKFILL_TOTAL ,
5148 "Number of indexes needing backfill"
5249) ;
5350pub fn log_num_indexes_to_backfill ( num_indexes : usize ) {
54- log_gauge ( & INDEXES_TO_BACKFILL_TOTAL , num_indexes as f64 ) ;
51+ log_distribution ( & INDEXES_TO_BACKFILL_TOTAL , num_indexes as f64 ) ;
5552}
5653
5754register_convex_counter ! ( INDEXES_BACKFILLED_TOTAL , "Number of indexes backfilled" ) ;
@@ -406,49 +403,49 @@ pub fn retention_delete_document_chunk_timer() -> Timer<VMHistogram> {
406403 Timer :: new ( & RETENTION_DELETE_DOCUMENT_CHUNK_SECONDS )
407404}
408405
409- register_convex_gauge ! ( RETENTION_CURSOR_AGE_SECONDS , "Age of the retention cursor" ) ;
406+ register_convex_histogram ! ( RETENTION_CURSOR_AGE_SECONDS , "Age of the retention cursor" ) ;
410407pub fn log_retention_cursor_age ( age_secs : f64 ) {
411- log_gauge ( & RETENTION_CURSOR_AGE_SECONDS , age_secs)
408+ log_distribution ( & RETENTION_CURSOR_AGE_SECONDS , age_secs)
412409}
413410
414- register_convex_gauge ! (
411+ register_convex_histogram ! (
415412 RETENTION_CURSOR_LAG_SECONDS ,
416413 "Lag between the retention cursor and the min index snapshot"
417414) ;
418415pub fn log_retention_cursor_lag ( age_secs : f64 ) {
419- log_gauge ( & RETENTION_CURSOR_LAG_SECONDS , age_secs)
416+ log_distribution ( & RETENTION_CURSOR_LAG_SECONDS , age_secs)
420417}
421418
422- register_convex_gauge ! (
419+ register_convex_histogram ! (
423420 DOCUMENT_RETENTION_CURSOR_AGE_SECONDS ,
424421 "Age of the document retention cursor"
425422) ;
426423pub fn log_document_retention_cursor_age ( age_secs : f64 ) {
427- log_gauge ( & DOCUMENT_RETENTION_CURSOR_AGE_SECONDS , age_secs)
424+ log_distribution ( & DOCUMENT_RETENTION_CURSOR_AGE_SECONDS , age_secs)
428425}
429426
430- register_convex_gauge ! (
427+ register_convex_histogram ! (
431428 DOCUMENT_RETENTION_CURSOR_LAG_SECONDS ,
432429 "Lag between the retention cursor and the min document snapshot"
433430) ;
434431pub fn log_document_retention_cursor_lag ( age_secs : f64 ) {
435- log_gauge ( & DOCUMENT_RETENTION_CURSOR_LAG_SECONDS , age_secs)
432+ log_distribution ( & DOCUMENT_RETENTION_CURSOR_LAG_SECONDS , age_secs)
436433}
437434
438- register_convex_gauge ! (
435+ register_convex_counter ! (
439436 RETENTION_MISSING_CURSOR_INFO ,
440437 "Index retention has no cursor"
441438) ;
442439pub fn log_retention_no_cursor ( ) {
443- log_gauge ( & RETENTION_MISSING_CURSOR_INFO , 1.0 )
440+ log_counter ( & RETENTION_MISSING_CURSOR_INFO , 1 )
444441}
445442
446- register_convex_gauge ! (
443+ register_convex_counter ! (
447444 DOCUMENT_RETENTION_MISSING_CURSOR_INFO ,
448445 "Document retention has no cursor"
449446) ;
450447pub fn log_document_retention_no_cursor ( ) {
451- log_gauge ( & DOCUMENT_RETENTION_MISSING_CURSOR_INFO , 1.0 )
448+ log_counter ( & DOCUMENT_RETENTION_MISSING_CURSOR_INFO , 1 )
452449}
453450
454451register_convex_counter ! (
@@ -645,34 +642,6 @@ pub fn log_virtual_table_query() {
645642 log_counter ( & VIRTUAL_TABLE_QUERY_REQUESTS_TOTAL , 1 ) ;
646643}
647644
648- pub struct DatabaseWorkerStatus {
649- name : & ' static str ,
650- }
651-
652- impl Drop for DatabaseWorkerStatus {
653- fn drop ( & mut self ) {
654- log_worker_status ( false , self . name ) ;
655- }
656- }
657-
658- register_convex_gauge ! (
659- DATABASE_WORKER_IN_PROGRESS_TOTAL ,
660- "1 if a worker is working, 0 otherwise" ,
661- & [ "worker" ] ,
662- ) ;
663- pub fn log_worker_starting ( name : & ' static str ) -> DatabaseWorkerStatus {
664- log_worker_status ( true , name) ;
665- DatabaseWorkerStatus { name }
666- }
667-
668- fn log_worker_status ( is_working : bool , name : & ' static str ) {
669- log_gauge_with_labels (
670- & DATABASE_WORKER_IN_PROGRESS_TOTAL ,
671- if is_working { 1f64 } else { 0f64 } ,
672- vec ! [ StaticMetricLabel :: new( "worker" , name) ] ,
673- )
674- }
675-
676645register_convex_histogram ! (
677646 SEARCH_AND_VECTOR_BOOTSTRAP_SECONDS ,
678647 "Time taken to bootstrap text and vector indexes" ,
0 commit comments