Skip to content

Commit

Permalink
fix: run dns resolution in the same tracing-span as the caller
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
joshka committed Jul 3, 2024
1 parent 866ada8 commit 2f77b84
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/client/legacy/connect/dns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ impl Service<Name> for GaiResolver {
}

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

0 comments on commit 2f77b84

Please sign in to comment.