Skip to content
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

Why axum always in dependency tree? #2665

Closed
tisonkun opened this issue Feb 14, 2025 · 5 comments · Fixed by #2666
Closed

Why axum always in dependency tree? #2665

tisonkun opened this issue Feb 14, 2025 · 5 comments · Fixed by #2666

Comments

@tisonkun
Copy link
Contributor

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

@djc
Copy link
Contributor

djc commented Feb 14, 2025

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.

@tisonkun
Copy link
Contributor Author

@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

@tisonkun
Copy link
Contributor Author

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.

@tisonkun
Copy link
Contributor Author

Theoretically, a client library should not depend on server-side framework. If so then we can figure out how to drop this dependency.

@tisonkun
Copy link
Contributor Author

#2666 should resolve this issue

cc @cijothomas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants