Skip to content

Commit 10725e3

Browse files
traskCopilot
andcommitted
Address review finding: declare tokio's net feature
Review finding: This line adds tokio's `sync` feature for the new Tower server's `oneshot::channel`, but the same new binary also calls `tokio::net::TcpListener::bind` in `scenarios/http/rust/tower/opentelemetry-instrumentation-tower/server/src/main.rs`, and `net` is not in the declared feature list. `tokio::net` is gated behind tokio's `net` feature, so the crate compiles only because axum 0.8.9's `tokio` feature (enabled two lines above) transitively turns on `tokio/net`. That makes a direct API use depend on another dependency's feature choice. A fix is to add `net` to the tokio feature list so the feature the code uses directly is declared where it is used. Analysis: Tokio exports `TcpListener` inside `cfg_net!`, so `tokio::net` exists only when the `net` feature is on. The workspace declaration listed `macros`, `rt-multi-thread` and `sync`, and axum 0.8.9's `tokio` feature turns on `tokio/net` for the whole build, which is what let the Tower server compile. Listing `net` beside `sync` states the feature the scenario binary uses directly. Cargo resolves the same versions, so `Cargo.lock` is unchanged. Upsides: The Tower server no longer depends on axum's feature list to reach `tokio::net`, so dropping or narrowing the axum dependency fails at the manifest rather than deep in a compile error. The declaration now matches the same rule the `sync` entry follows. Downsides: No material downside identified. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 3abcb45 commit 10725e3

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎scenarios/http/rust/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ opentelemetry-otlp = { version = "0.32.0", default-features = false, features =
3131
opentelemetry_sdk = { version = "0.32.0", features = ["metrics", "rt-tokio", "trace"] }
3232
serde = { version = "1.0.228", features = ["derive"] }
3333
serde_json = "1.0.145"
34-
tokio = { version = "1.48.0", features = ["macros", "rt-multi-thread", "sync"] }
34+
tokio = { version = "1.48.0", features = ["macros", "net", "rt-multi-thread", "sync"] }
3535

3636
otel-conformance-http = { path = "../../../tools/http/test-client/rust" }
3737
otel-conformance-scenario = { path = "../../../tools/rust/scenario" }

0 commit comments

Comments
 (0)