fix: Propagate Span correctly in MockIngester

pull/24376/head
Carol (Nichols || Goulding) 2022-10-20 09:18:09 -04:00
parent 712cfc3f38
commit 444eaec319
No known key found for this signature in database
GPG Key ID: E907EE5A736F87D4
1 changed files with 15 additions and 10 deletions

View File

@ -41,7 +41,10 @@ use std::{
time::Duration,
};
use tokio::runtime::Handle;
use trace::ctx::SpanContext;
use trace::{
ctx::SpanContext,
span::{SpanExt, SpanRecorder},
};
// Structs, enums, and functions used to exhaust all test scenarios of chunk lifecycle
// & when delete predicates are applied
@ -946,19 +949,21 @@ impl IngesterFlightClient for MockIngester {
&self,
_ingester_address: Arc<str>,
request: IngesterQueryRequest,
_span_context: Option<SpanContext>,
span_context: Option<SpanContext>,
) -> Result<Box<dyn IngesterFlightClientQueryData>, IngesterFlightClientError> {
let span = None;
let span_recorder = SpanRecorder::new(span_context.child_span("ingester"));
// NOTE: we MUST NOT unwrap errors here because some query tests assert error behavior
// (e.g. passing predicates of wrong types)
let request = Arc::new(request);
let response = prepare_data_to_querier(&self.ingester_data, &request, span)
.await
.map_err(|e| IngesterFlightClientError::Flight {
source: FlightError::ArrowError(arrow::error::ArrowError::ExternalError(Box::new(
e,
))),
})?;
let response = prepare_data_to_querier(
&self.ingester_data,
&request,
span_recorder.child_span("prepare_data_to_querier"),
)
.await
.map_err(|e| IngesterFlightClientError::Flight {
source: FlightError::ArrowError(arrow::error::ArrowError::ExternalError(Box::new(e))),
})?;
Ok(Box::new(QueryDataAdapter::new(response).await))
}