-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: run dns resolution in the same tracing-span as the caller #134
Conversation
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.
Ping |
examples/client.rs
Outdated
@@ -28,7 +29,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { | |||
.uri(url) | |||
.body(Empty::<bytes::Bytes>::new())?; | |||
|
|||
let resp = client.request(req).await?; | |||
let span = info_span!("request", uri = %req.uri()); | |||
let resp = client.request(req).instrument(span).await?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we remove this too?
I agree it's useful when debugging, but I worry it distracts from the initial usage of someone just wanting to get the client working.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
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.