Skip to content

Commit 8ebdab9

Browse files
committed
Place new functionality behind a new 'tracing' feature
1 parent f2ce897 commit 8ebdab9

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Cargo.toml

+4-1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ full = [
5555
"http1",
5656
"http2",
5757
"tokio",
58+
"tracing",
5859
]
5960

6061
client = ["hyper/client", "dep:tracing", "dep:futures-channel", "dep:tower-service"]
@@ -69,7 +70,9 @@ service = ["dep:tower-service"]
6970
http1 = ["hyper/http1"]
7071
http2 = ["hyper/http2"]
7172

72-
tokio = ["dep:tokio", "tokio/net", "tokio/rt", "tokio/time", "dep:tracing"]
73+
tokio = ["dep:tokio", "tokio/net", "tokio/rt", "tokio/time"]
74+
75+
tracing = ["dep:tracing"]
7376

7477
# internal features used in CI
7578
__internal_happy_eyeballs_tests = []

src/rt/tokio.rs

+6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ use std::{
99

1010
use hyper::rt::{Executor, Sleep, Timer};
1111
use pin_project_lite::pin_project;
12+
13+
#[cfg(feature = "tracing")]
1214
use tracing::instrument::Instrument;
1315

1416
/// Future executor that utilises `tokio` threads.
@@ -50,7 +52,11 @@ where
5052
Fut::Output: Send + 'static,
5153
{
5254
fn execute(&self, fut: Fut) {
55+
#[cfg(feature = "tracing")]
5356
tokio::spawn(fut.in_current_span());
57+
58+
#[cfg(not(feature = "tracing"))]
59+
tokio::spawn(fut);
5460
}
5561
}
5662

0 commit comments

Comments
 (0)