-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Description
#[tokio::main]
async fn main() -> anyhow::Result<()> {
tracing_subscriber::fmt()
.with_env_filter(EnvFilter::from_str(&format!(
"off,{}=trace",
env!("CARGO_BIN_NAME").replace("-", "_")
))?)
.with_span_events(FmtSpan::NEW | FmtSpan::CLOSE)
.init();
let client = reqwest::Client::new();
client.get("https://google.com").send().instrument(debug_span!("request")).await?;
// drop(client);
tokio::time::sleep(Duration::from_secs(3)).await;
Ok(())
}When running the code above, the span close event is not printed until the program terminates, with the time.idle exceeding 3 seconds. If the comment for drop(client) is removed, the span close event will be printed immediately after the request is completed, with the time.idle less than 1 second.
Is this a bug with reqwest or tracing?
Metadata
Metadata
Assignees
Labels
No labels