Skip to content

Commit 2f77b84

Browse files
committed
fix: run dns resolution in the same tracing-span as the caller
This makes it possible to trace the entire request, including DNS resolution. The use case for this is to be able to suppress specific requests from being traced in a situation where the request is used to transmit logs to a remote server. This would result in an infinite loop of logs being sent to the remote server. tokio-rs/tokio#6659 has more details.
1 parent 866ada8 commit 2f77b84

File tree

1 file changed

+2
-0
lines changed
  • src/client/legacy/connect

1 file changed

+2
-0
lines changed

src/client/legacy/connect/dns.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ impl Service<Name> for GaiResolver {
118118
}
119119

120120
fn call(&mut self, name: Name) -> Self::Future {
121+
let current_span = tracing::Span::current();
121122
let blocking = tokio::task::spawn_blocking(move || {
123+
let _enter = current_span.enter();
122124
debug!("resolving host={:?}", name.host);
123125
(&*name.host, 0)
124126
.to_socket_addrs()

0 commit comments

Comments
 (0)