diff --git a/Cargo.toml b/Cargo.toml index e2197605..52fca5e0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,10 @@ default = ["protobuf"] gen = ["protobuf-codegen-pure"] nightly = ["libc"] process = ["libc", "procfs"] -push = ["reqwest", "libc", "protobuf"] +push = ["push-reqwest-ssl", "push-deps"] +push-no-tls = ["push-deps"] +push-reqwest-ssl = ["reqwest?/default-tls"] +push-deps = ["reqwest", "libc", "protobuf"] [dependencies] cfg-if = "^1.0" @@ -32,7 +35,7 @@ libc = { version = "^0.2", optional = true } parking_lot = "^0.12" protobuf = { version = "^2.0", optional = true } memchr = "^2.3" -reqwest = { version = "^0.11", features = ["blocking"], optional = true } +reqwest = { version = "^0.11", default-features = false, features = ["blocking"], optional = true } thiserror = "^1.0" [target.'cfg(target_os = "linux")'.dependencies] diff --git a/README.md b/README.md index 47b862ba..777e2bf1 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,9 @@ This crate provides several optional components which can be enabled via [Cargo - `push`: Enable [push metrics](https://prometheus.io/docs/instrumenting/pushing/) support. +- `push-no-tls`: An alternative to `push`, which will not link in TLS libraries, disabling HTTPS support but resulting in a leaner build. + By default, the Pushgateway uses HTTP and not HTTPS. + ### Static Metric When using a `MetricVec` with label values known at compile time diff --git a/src/lib.rs b/src/lib.rs index 55cbea35..3dc6b4b1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -159,7 +159,7 @@ mod gauge; mod histogram; mod metrics; mod pulling_gauge; -#[cfg(feature = "push")] +#[cfg(feature = "push-deps")] mod push; mod registry; mod value; @@ -221,7 +221,7 @@ pub use self::histogram::{exponential_buckets, linear_buckets}; pub use self::histogram::{Histogram, HistogramOpts, HistogramTimer, HistogramVec}; pub use self::metrics::Opts; pub use self::pulling_gauge::PullingGauge; -#[cfg(feature = "push")] +#[cfg(feature = "push-deps")] pub use self::push::{ hostname_grouping_key, push_add_collector, push_add_metrics, push_collector, push_metrics, BasicAuthentication,