@@ -673,7 +673,7 @@ fn log_worker_status(is_working: bool, name: &'static str) {
673673
674674register_convex_histogram ! (
675675 SEARCH_AND_VECTOR_BOOTSTRAP_SECONDS ,
676- "Time taken to bootstrap search and vector indexes" ,
676+ "Time taken to bootstrap text and vector indexes" ,
677677 & STATUS_LABEL
678678) ;
679679pub fn bootstrap_timer ( ) -> StatusTimer {
@@ -682,18 +682,18 @@ pub fn bootstrap_timer() -> StatusTimer {
682682
683683register_convex_histogram ! (
684684 SEARCH_AND_VECTOR_BOOTSTRAP_COMMITTER_UPDATE_SECONDS ,
685- "Time to update search and vector index bootstrap in the committer"
685+ "Time to update text and vector index bootstrap in the committer"
686686) ;
687687pub fn bootstrap_update_timer ( ) -> Timer < VMHistogram > {
688688 Timer :: new ( & SEARCH_AND_VECTOR_BOOTSTRAP_COMMITTER_UPDATE_SECONDS )
689689}
690690register_convex_counter ! (
691691 SEARCH_AND_VECTOR_BOOTSTRAP_COMMITTER_UPDATE_REVISIONS_TOTAL ,
692- "Number of revisions loaded during search and vector bootstrap updates in the committer"
692+ "Number of revisions loaded during text and vector bootstrap updates in the committer"
693693) ;
694694register_convex_counter ! (
695695 SEARCH_AND_VECTOR_BOOTSTRAP_COMMITTER_UPDATE_REVISIONS_BYTES ,
696- "Total size of revisions loaded during search and vector bootstrap updates in the committer"
696+ "Total size of revisions loaded during text and vector bootstrap updates in the committer"
697697) ;
698698
699699pub fn finish_bootstrap_update ( num_revisions : usize , bytes : usize ) {
@@ -709,11 +709,11 @@ pub fn finish_bootstrap_update(num_revisions: usize, bytes: usize) {
709709
710710register_convex_counter ! (
711711 SEARCH_AND_VECTOR_BOOTSTRAP_REVISIONS_TOTAL ,
712- "Number of revisions loaded during search and vector bootstrap"
712+ "Number of revisions loaded during text and vector bootstrap"
713713) ;
714714register_convex_counter ! (
715715 SEARCH_AND_VECTOR_BOOTSTRAP_REVISIONS_BYTES ,
716- "Total size of revisions loaded during search and vector bootstrap"
716+ "Total size of revisions loaded during text and vector bootstrap"
717717) ;
718718pub fn finish_bootstrap ( num_revisions : usize , bytes : usize , timer : StatusTimer ) {
719719 log_counter (
@@ -877,6 +877,76 @@ pub fn log_non_deleted_documents_per_search_index(count: u64, search_type: Searc
877877 ) ;
878878}
879879
880+ const COMPACTION_REASON_LABEL : & str = "compaction_reason" ;
881+
882+ pub enum CompactionReason {
883+ Unknown ,
884+ SmallSegments ,
885+ LargeSegments ,
886+ Deletes ,
887+ }
888+
889+ impl CompactionReason {
890+ fn metric_label ( & self ) -> StaticMetricLabel {
891+ let label = match self {
892+ CompactionReason :: Unknown => "unknown" ,
893+ CompactionReason :: SmallSegments => "small" ,
894+ CompactionReason :: LargeSegments => "large" ,
895+ CompactionReason :: Deletes => "deletes" ,
896+ } ;
897+ StaticMetricLabel :: new ( COMPACTION_REASON_LABEL , label)
898+ }
899+ }
900+
901+ register_convex_histogram ! (
902+ COMPACTION_BUILD_ONE_SECONDS ,
903+ "Time to run a single vector/text index compaction" ,
904+ & [ STATUS_LABEL [ 0 ] , COMPACTION_REASON_LABEL , SEARCH_TYPE_LABEL ] ,
905+ ) ;
906+ pub fn compaction_build_one_timer ( search_type : SearchType ) -> StatusTimer {
907+ let mut timer = StatusTimer :: new ( & COMPACTION_BUILD_ONE_SECONDS ) ;
908+ timer. add_label ( CompactionReason :: Unknown . metric_label ( ) ) ;
909+ timer. add_label ( search_type. tag ( ) ) ;
910+ timer
911+ }
912+
913+ pub fn finish_compaction_timer ( mut timer : StatusTimer , reason : CompactionReason ) {
914+ timer. replace_label (
915+ CompactionReason :: Unknown . metric_label ( ) ,
916+ reason. metric_label ( ) ,
917+ ) ;
918+ timer. finish ( ) ;
919+ }
920+
921+ register_convex_histogram ! (
922+ COMPACTION_COMPACTED_SEGMENTS_TOTAL ,
923+ "Total number of compacted segments" ,
924+ & [ SEARCH_TYPE_LABEL ] ,
925+ ) ;
926+ pub fn log_compaction_total_segments ( total_segments : usize , search_type : SearchType ) {
927+ log_distribution_with_labels (
928+ & COMPACTION_COMPACTED_SEGMENTS_TOTAL ,
929+ total_segments as f64 ,
930+ vec ! [ search_type. tag( ) ] ,
931+ ) ;
932+ }
933+
934+ register_convex_histogram ! (
935+ COMPACTION_COMPACTED_SEGMENT_NUM_DOCUMENTS_TOTAL ,
936+ "The number of documents in the newly generated compacted segment" ,
937+ & [ SEARCH_TYPE_LABEL ] ,
938+ ) ;
939+ pub fn log_compaction_compacted_segment_num_documents_total (
940+ total_vectors : u64 ,
941+ search_type : SearchType ,
942+ ) {
943+ log_distribution_with_labels (
944+ & COMPACTION_COMPACTED_SEGMENT_NUM_DOCUMENTS_TOTAL ,
945+ total_vectors as f64 ,
946+ vec ! [ search_type. tag( ) ] ,
947+ ) ;
948+ }
949+
880950pub mod search {
881951
882952 use metrics:: {
@@ -941,7 +1011,7 @@ pub mod search {
9411011
9421012register_convex_histogram ! (
9431013 DATABASE_VECTOR_AND_SEARCH_BOOTSTRAP_SECONDS ,
944- "Time to bootstrap vector and search indexes" ,
1014+ "Time to bootstrap vector and text indexes" ,
9451015 & STATUS_LABEL
9461016) ;
9471017pub fn search_and_vector_bootstrap_timer ( ) -> StatusTimer {
@@ -950,18 +1020,16 @@ pub fn search_and_vector_bootstrap_timer() -> StatusTimer {
9501020
9511021register_convex_counter ! (
9521022 SEARCH_AND_VECTOR_BOOTSTRAP_DOCUMENTS_SKIPPED_TOTAL ,
953- "Number of documents skipped during vector and search index bootstrap" ,
1023+ "Number of documents skipped during vector and text index bootstrap" ,
9541024) ;
9551025pub fn log_document_skipped ( ) {
9561026 log_counter ( & SEARCH_AND_VECTOR_BOOTSTRAP_DOCUMENTS_SKIPPED_TOTAL , 1 ) ;
9571027}
9581028
9591029pub mod vector {
9601030 use metrics:: {
961- log_distribution,
9621031 register_convex_histogram,
9631032 CancelableTimer ,
964- StaticMetricLabel ,
9651033 StatusTimer ,
9661034 STATUS_LABEL ,
9671035 } ;
@@ -992,66 +1060,4 @@ pub mod vector {
9921060 pub fn vector_search_with_retries_timer ( ) -> CancelableTimer {
9931061 CancelableTimer :: new ( & DATABASE_VECTOR_SEARCH_WITH_RETRIES_QUERY_SECONDS )
9941062 }
995-
996- const COMPACTION_REASON_LABEL : & str = "compaction_reason" ;
997-
998- pub enum CompactionReason {
999- Unknown ,
1000- SmallSegments ,
1001- LargeSegments ,
1002- Deletes ,
1003- }
1004-
1005- impl CompactionReason {
1006- fn metric_label ( & self ) -> StaticMetricLabel {
1007- let label = match self {
1008- CompactionReason :: Unknown => "unknown" ,
1009- CompactionReason :: SmallSegments => "small" ,
1010- CompactionReason :: LargeSegments => "large" ,
1011- CompactionReason :: Deletes => "deletes" ,
1012- } ;
1013- StaticMetricLabel :: new ( COMPACTION_REASON_LABEL , label)
1014- }
1015- }
1016-
1017- register_convex_histogram ! (
1018- VECTOR_COMPACTION_BUILD_ONE_SECONDS ,
1019- "Time to run a single vector compaction" ,
1020- & [ STATUS_LABEL [ 0 ] , COMPACTION_REASON_LABEL ] ,
1021- ) ;
1022- pub fn vector_compaction_build_one_timer ( ) -> StatusTimer {
1023- let mut timer = StatusTimer :: new ( & VECTOR_COMPACTION_BUILD_ONE_SECONDS ) ;
1024- timer. add_label ( CompactionReason :: Unknown . metric_label ( ) ) ;
1025- timer
1026- }
1027-
1028- pub fn finish_compaction_timer ( mut timer : StatusTimer , reason : CompactionReason ) {
1029- timer. replace_label (
1030- CompactionReason :: Unknown . metric_label ( ) ,
1031- reason. metric_label ( ) ,
1032- ) ;
1033- timer. finish ( ) ;
1034- }
1035-
1036- register_convex_histogram ! (
1037- VECTOR_COMPACTION_COMPACTED_SEGMENTS_TOTAL ,
1038- "Total number of compacted segments" ,
1039- ) ;
1040- pub fn log_vector_compaction_total_segments ( total_segments : usize ) {
1041- log_distribution (
1042- & VECTOR_COMPACTION_COMPACTED_SEGMENTS_TOTAL ,
1043- total_segments as f64 ,
1044- ) ;
1045- }
1046-
1047- register_convex_histogram ! (
1048- VECTOR_COMPACTION_COMPACTED_SEGMENT_NUM_VECTORS_TOTAL ,
1049- "Size of the newly generated compacted segment" ,
1050- ) ;
1051- pub fn log_vector_compaction_compacted_segment_num_vectors_total ( total_vectors : u64 ) {
1052- log_distribution (
1053- & VECTOR_COMPACTION_COMPACTED_SEGMENT_NUM_VECTORS_TOTAL ,
1054- total_vectors as f64 ,
1055- ) ;
1056- }
10571063}
0 commit comments