Skip to content

Commit 3b57a5b

Browse files
sjuddConvex, Inc.
authored and
Convex, Inc.
committed
Add a metric for querying term ordinals to searcher (#27121)
GitOrigin-RevId: a300b403cfcca811bb86eb78169ce3c447fe21c3
1 parent f6f335b commit 3b57a5b

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

crates/search/src/searcher/metrics.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ pub(crate) fn text_compaction_searcher_latency_seconds() -> StatusTimer {
6565
StatusTimer::new(&TEXT_COMPACTION_SEARCHER_LATENCY_SECONDS)
6666
}
6767

68+
register_convex_histogram!(
69+
TEXT_QUERY_TERM_ORDINALS_SEARCHER_LATENCY_SECONDS,
70+
"The amount of time it took to query for term ordinals for values in Searcher (searchlight)",
71+
&STATUS_LABEL,
72+
);
73+
pub(crate) fn text_query_term_ordinals_searcher_timer() -> StatusTimer {
74+
StatusTimer::new(&TEXT_QUERY_TERM_ORDINALS_SEARCHER_LATENCY_SECONDS)
75+
}
76+
6877
register_convex_histogram!(
6978
SEARCHLIGHT_VECTOR_COMPACTION_PREFETCH_SECONDS,
7079
"The amount of time it takes to prefetch a new segment produced by vector compaction",

crates/search/src/searcher/searcher.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ use crate::{
123123
text_number_of_segments_searcher_latency_seconds,
124124
text_query_bm25_searcher_latency_seconds,
125125
text_query_posting_lists_searcher_latency_seconds,
126+
text_query_term_ordinals_searcher_timer,
126127
text_query_tokens_searcher_latency_seconds,
127128
},
128129
searchlight_knobs::{
@@ -613,6 +614,7 @@ impl<RT: Runtime> SegmentTermMetadataFetcher for SearcherImpl<RT> {
613614
segment: ObjectKey,
614615
field_to_term_values: BTreeMap<Field, Vec<TermValue>>,
615616
) -> anyhow::Result<BTreeMap<Field, Vec<TermOrdinal>>> {
617+
let timer = text_query_term_ordinals_searcher_timer();
616618
let segment_path = self
617619
.archive_cache
618620
.get(search_storage, &segment, SearchFileType::Text)
@@ -638,6 +640,7 @@ impl<RT: Runtime> SegmentTermMetadataFetcher for SearcherImpl<RT> {
638640
}
639641
field_to_term_ordinals.insert(field, term_ordinals);
640642
}
643+
timer.finish();
641644
Ok(field_to_term_ordinals)
642645
}
643646
}

0 commit comments

Comments
 (0)