server: more instrumentation

This commit is contained in:
Bill Thiede 2024-12-16 19:21:05 -08:00
parent 607e9e2251
commit 0697a5ea41

View File

@ -9,7 +9,7 @@ use tantivy::{
schema::{Facet, IndexRecordOption, Value},
DocAddress, Index, IndexReader, Searcher, TantivyDocument, TantivyError, Term,
};
use tracing::{info_span, instrument};
use tracing::{info_span, instrument, Instrument};
use crate::{
compute_offset_limit,
@ -55,6 +55,7 @@ impl TantivyConnection {
let start_time = std::time::Instant::now();
let p_uids: Vec<_> = sqlx::query_file!("sql/all-uids.sql")
.fetch_all(pool)
.instrument(info_span!("postgres query"))
.await?
.into_iter()
.map(|r| r.uid)
@ -65,6 +66,8 @@ impl TantivyConnection {
start_time.elapsed().as_secs_f32()
);
let t_span = info_span!("tantivy query");
let _enter = t_span.enter();
let start_time = std::time::Instant::now();
let (searcher, _query) = self.searcher_and_query(&Query::default())?;
let docs = searcher.search(&AllQuery, &DocSetCollector)?;
@ -85,6 +88,7 @@ impl TantivyConnection {
.expect("searcher.doc")
})
.collect();
drop(_enter);
info!(
"refresh tantivy got {} uids in {}",