-
Notifications
You must be signed in to change notification settings - Fork 158
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
Make tls optional and add rustls support (#418) #420
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,9 @@ keywords = ["metrics", "telemetry", "prometheus"] | |
default = ["http-listener", "push-gateway"] | ||
async-runtime = ["tokio", "hyper"] | ||
http-listener = ["async-runtime", "hyper/server", "ipnet"] | ||
push-gateway = ["async-runtime", "hyper/client", "hyper-tls", "tracing"] | ||
push-gateway = ["async-runtime", "hyper/client", "tracing"] | ||
native-tls = ["hyper-tls"] | ||
rustls-tls = ["hyper-rustls"] | ||
Comment on lines
+24
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After doing some reading, it seems like we should probably just switch to using I don't think the initial implementor choose to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I hope you won't mind a somewhat random drive-past, but its generally a good practice for mid-layer crates that sit between TLS and applications to not set TLS policy. The way to make this work comfortably is:
Then higher layer crates such as axum-prometheus can depend on your crate, with default-features=false, and the application layer crate using axum-prometheus can specify hyper-tls or hyper-rustls itself. |
||
|
||
[dependencies] | ||
metrics = { version = "^0.21", path = "../metrics" } | ||
|
@@ -36,6 +38,7 @@ ipnet = { version = "2", optional = true } | |
tokio = { version = "1", features = ["rt", "net", "time"], optional = true } | ||
tracing = { version = "0.1.26", optional = true } | ||
hyper-tls = { version = "0.5.0", optional = true } | ||
hyper-rustls = { version = "0.24.2", optional = true } | ||
|
||
[dev-dependencies] | ||
tracing = "0.1" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When it comes to the core crates (like
metrics
), I generally err on the side of making users opt-in to additional functionality, but that flips the opposite direction for exporters, where users generally want/expect to get the "full fat" support out of the box.I'd say we should add another feature called
push-gateway-https
, which pulls inhyper-rustls
, and have the feature be enabled by default.