Add dummy inner spans with no parent
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Aode (lion) 2022-04-06 18:16:56 -05:00
parent 107c091dfc
commit dbd7a6f369

View file

@ -142,7 +142,9 @@ where
}
TracingFuture {
future: span.in_scope(|| self.0.call(req)),
future: span
.in_scope(|| self.0.call(req))
.instrument(tracing::trace_span!(parent: None, "Http Request Inner")),
}
.instrument(span)
}
@ -151,7 +153,7 @@ where
pin_project_lite::pin_project! {
pub struct TracingFuture<F> {
#[pin]
future: F,
future: Instrumented<F>,
}
}
@ -217,6 +219,7 @@ where
pin_project_lite::pin_project! {
struct InstrumentedBody<S> {
span: Option<Span>,
dummy_span: Option<Span>,
#[pin]
body: S,
@ -228,7 +231,11 @@ where
S: Stream<Item = Result<Bytes, PayloadError>>,
{
fn new(body: S) -> InstrumentedBody<S> {
InstrumentedBody { span: None, body }
InstrumentedBody {
span: None,
dummy_span: None,
body,
}
}
}
@ -244,9 +251,14 @@ where
let span = this
.span
.get_or_insert_with(|| tracing::info_span!("HTTP Client Response Body"));
let dummy_span = this.dummy_span.get_or_insert_with(|| {
tracing::trace_span!(parent: None, "HTTP Client Response Body Inner")
});
let body = this.body;
span.in_scope(|| body.poll_next(cx))
span.in_scope(|| dummy_span.in_scope(|| body.poll_next(cx)))
}
}