diff --git a/server/src/tantivy.rs b/server/src/tantivy.rs index 8005503..5607177 100644 --- a/server/src/tantivy.rs +++ b/server/src/tantivy.rs @@ -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 {}",