Why axum always in dependency tree?
tisonkun opened this issue · comments
I'm trying to remove axum in the final dependency tree (and thus any binary that depends on opentelemetry) - fast/logforth#102
But it seems axum is always included.
IIUC opentelemetry-rust is only a client library that don't need such server-side dependency and I can see that our dependency to tonic is marked default-features = false
.
Why do we still get a dependency to axum in the end?
cc @djc
Suggest you use cargo tree to figure out the dependency tree. IIRC tonic pulls in Axum for some stuff. I don't think there's something we can do in this project.
@djc Thanks for your reply!
AFAICS the dep to axum in tonic is optional:
https://github.com/hyperium/tonic/blob/fc940ce158513d5d989772c571a34ee5f6f43292/tonic/Cargo.toml#L88
If you're sure that this issue should be resolved at the tonic repo, I'd create an issue there. But running cargo tree against tonic without any other features doesn't give axum:
cargo tree -p tonic --no-default-features --prefix none --edges normal --no-dedupe | sort | uniq
base64 v0.22.1
bytes v1.10.0
fnv v1.0.7
futures-core v0.3.30
futures-task v0.3.30
futures-util v0.3.30
http v1.2.0
http-body v1.0.1
http-body-util v0.1.2
itoa v1.0.11
once_cell v1.19.0
percent-encoding v2.3.1
pin-project v1.1.5
pin-project-internal v1.1.5 (proc-macro)
pin-project-lite v0.2.13
pin-utils v0.1.0
proc-macro2 v1.0.93
quote v1.0.35
syn v2.0.98
tokio v1.37.0
tokio-stream v0.1.17
tonic v0.13.0 (/Users/tison/Brittani/tonic/tonic)
tower-layer v0.3.3
tower-service v0.3.3
tracing v0.1.40
tracing-attributes v0.1.27 (proc-macro)
tracing-core v0.1.32
unicode-ident v1.0.12
I fount it:
I depend on opentelemetry-otlp
's grpc-tonic
feature, it transitively enables opentelemetry-proto
's gen-tonic
feature, and then tonic
's transport
feature, which adds server
-> router
-> axum
.
Theoretically, a client library should not depend on server-side framework. If so then we can figure out how to drop this dependency.
#2666 should resolve this issue
cc @cijothomas