From 2ded459d0c32ba5f89cc04c4017502cdfcd82b22 Mon Sep 17 00:00:00 2001 From: Roman Zeyde Date: Sun, 19 Sep 2021 10:34:46 +0300 Subject: [PATCH] Don't use prometheus::process_collector::ProcessCollector by default Following #491. It can be re-enabled by: ``` cargo build --release --features prometheus/process ``` --- Cargo.lock | 59 ------------------------------------------------ Cargo.toml | 2 +- RELEASE-NOTES.md | 4 ++++ src/metrics.rs | 4 ++++ 4 files changed, 9 insertions(+), 60 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b81f7ce..d74fb68 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,11 +1,5 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - [[package]] name = "aho-corasick" version = "0.7.18" @@ -249,15 +243,6 @@ dependencies = [ "serde_json", ] -[[package]] -name = "crc32fast" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a" -dependencies = [ - "cfg-if 1.0.0", -] - [[package]] name = "crossbeam-channel" version = "0.5.1" @@ -389,18 +374,6 @@ dependencies = [ "termcolor", ] -[[package]] -name = "flate2" -version = "1.0.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80edafed416a46fb378521624fab1cfa2eb514784fd8921adbe8a8d8321da811" -dependencies = [ - "cfg-if 1.0.0", - "crc32fast", - "libc", - "miniz_oxide", -] - [[package]] name = "fmt2io" version = "0.1.0" @@ -455,12 +428,6 @@ dependencies = [ "libc", ] -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - [[package]] name = "humantime" version = "1.3.0" @@ -593,16 +560,6 @@ dependencies = [ "autocfg 1.0.1", ] -[[package]] -name = "miniz_oxide" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" -dependencies = [ - "adler", - "autocfg 1.0.1", -] - [[package]] name = "nom" version = "5.1.2" @@ -700,20 +657,6 @@ dependencies = [ "unicode-xid", ] -[[package]] -name = "procfs" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab8809e0c18450a2db0f236d2a44ec0b4c1412d0eb936233579f0990faa5d5cd" -dependencies = [ - "bitflags", - "byteorder", - "flate2", - "hex", - "lazy_static", - "libc", -] - [[package]] name = "prometheus" version = "0.12.0" @@ -723,10 +666,8 @@ dependencies = [ "cfg-if 1.0.0", "fnv", "lazy_static", - "libc", "memchr", "parking_lot", - "procfs", "protobuf", "thiserror", ] diff --git a/Cargo.toml b/Cargo.toml index 9423ae5..0f6e087 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ dirs-next = "2.0" env_logger = "0.7" log = "0.4" parking_lot = "0.11" -prometheus = { version = "0.12", features = ["process"], optional = true } +prometheus = { version = "0.12", optional = true } rayon = "1.5" serde = "1.0" serde_derive = "1.0" diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index d9ff7fd..f152066 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -1,3 +1,7 @@ +# 0.9.0 (TBD) + +* Don't collect process' Prometheus metrics by default (#492) + # 0.9.0-rc1 (Sep 17 2021) **IMPORTANT: This release contains major changes, please read carefully!** diff --git a/src/metrics.rs b/src/metrics.rs index 5e8bb44..89a7723 100644 --- a/src/metrics.rs +++ b/src/metrics.rs @@ -1,7 +1,10 @@ #[cfg(feature = "metrics")] mod metrics_impl { use anyhow::{Context, Result}; + + #[cfg(feature = "prometheus/process")] use prometheus::process_collector::ProcessCollector; + use prometheus::{self, Encoder, HistogramOpts, HistogramVec, Registry}; use tiny_http::{Response, Server}; @@ -17,6 +20,7 @@ mod metrics_impl { pub fn new(addr: SocketAddr) -> Result { let reg = Registry::new(); + #[cfg(feature = "prometheus/process")] reg.register(Box::new(ProcessCollector::for_self())) .expect("failed to register ProcessCollector");