Skip to content

Commit 3c15f09

Browse files
committed
Query Bootstrap Tracing (drasi-project#179)
* modified span * working * clean up * nit * deleted unused imports * cargo fmt Signed-off-by: ruokun-niu <[email protected]>
1 parent d47cb29 commit 3c15f09

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

query-container/query-host/src/query_worker.rs

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ use tokio::{
4040
task::JoinHandle,
4141
time::Instant,
4242
};
43-
use tracing::{instrument, Instrument};
43+
use tracing::{dispatcher, info_span, instrument, Dispatch, Instrument};
4444
use tracing_opentelemetry::OpenTelemetrySpanExt;
4545

4646
use crate::{
@@ -566,6 +566,8 @@ async fn bootstrap(
566566
element_index: Arc<dyn ElementIndex>,
567567
result_index: Arc<dyn ResultIndex>,
568568
) -> Result<(), BootstrapError> {
569+
let process_span = info_span!("process_bootstrap", query_id = query_id);
570+
569571
match publisher
570572
.publish(
571573
query_id,
@@ -609,6 +611,7 @@ async fn bootstrap(
609611

610612
let mut initial_data = pin!(initial_data);
611613

614+
let publish_span = info_span!("publish_bootstrap_data", query_id = query_id);
612615
while let Some(change) = initial_data.next().await {
613616
match change {
614617
Ok(change) => {
@@ -627,14 +630,25 @@ async fn bootstrap(
627630
};
628631

629632
let seq = seq_manager.increment("bootstrap");
630-
let output = ResultEvent::from_query_results(
631-
query_id,
632-
change_results,
633-
seq,
634-
timestamp,
635-
None,
633+
let output = dispatcher::with_default(
634+
&tracing::Dispatch::none(), // Disable tracing for this scope
635+
|| {
636+
ResultEvent::from_query_results(
637+
query_id,
638+
change_results,
639+
seq,
640+
timestamp,
641+
None,
642+
)
643+
},
636644
);
637-
match publisher.publish(query_id, output).await {
645+
646+
let result = {
647+
let _guard = tracing::dispatcher::set_default(&Dispatch::none());
648+
publisher.publish(query_id, output).await
649+
};
650+
651+
match result {
638652
Ok(_) => log::info!("Published result"),
639653
Err(err) => {
640654
log::error!("Error publishing result: {}", err);

0 commit comments

Comments
 (0)