1
0
mirror of https://github.com/romanz/electrs.git synced 2024-11-19 09:54:09 +01:00

Don't use prometheus::process_collector::ProcessCollector by default

Following #491.

It can be re-enabled by:

```
cargo build --release --features prometheus/process
```
This commit is contained in:
Roman Zeyde 2021-09-19 10:34:46 +03:00
parent a53048f2ef
commit 2ded459d0c
4 changed files with 9 additions and 60 deletions

59
Cargo.lock generated
View File

@ -1,11 +1,5 @@
# This file is automatically @generated by Cargo. # This file is automatically @generated by Cargo.
# It is not intended for manual editing. # 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]] [[package]]
name = "aho-corasick" name = "aho-corasick"
version = "0.7.18" version = "0.7.18"
@ -249,15 +243,6 @@ dependencies = [
"serde_json", "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]] [[package]]
name = "crossbeam-channel" name = "crossbeam-channel"
version = "0.5.1" version = "0.5.1"
@ -389,18 +374,6 @@ dependencies = [
"termcolor", "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]] [[package]]
name = "fmt2io" name = "fmt2io"
version = "0.1.0" version = "0.1.0"
@ -455,12 +428,6 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "hex"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]] [[package]]
name = "humantime" name = "humantime"
version = "1.3.0" version = "1.3.0"
@ -593,16 +560,6 @@ dependencies = [
"autocfg 1.0.1", "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]] [[package]]
name = "nom" name = "nom"
version = "5.1.2" version = "5.1.2"
@ -700,20 +657,6 @@ dependencies = [
"unicode-xid", "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]] [[package]]
name = "prometheus" name = "prometheus"
version = "0.12.0" version = "0.12.0"
@ -723,10 +666,8 @@ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"fnv", "fnv",
"lazy_static", "lazy_static",
"libc",
"memchr", "memchr",
"parking_lot", "parking_lot",
"procfs",
"protobuf", "protobuf",
"thiserror", "thiserror",
] ]

View File

@ -28,7 +28,7 @@ dirs-next = "2.0"
env_logger = "0.7" env_logger = "0.7"
log = "0.4" log = "0.4"
parking_lot = "0.11" parking_lot = "0.11"
prometheus = { version = "0.12", features = ["process"], optional = true } prometheus = { version = "0.12", optional = true }
rayon = "1.5" rayon = "1.5"
serde = "1.0" serde = "1.0"
serde_derive = "1.0" serde_derive = "1.0"

View File

@ -1,3 +1,7 @@
# 0.9.0 (TBD)
* Don't collect process' Prometheus metrics by default (#492)
# 0.9.0-rc1 (Sep 17 2021) # 0.9.0-rc1 (Sep 17 2021)
**IMPORTANT: This release contains major changes, please read carefully!** **IMPORTANT: This release contains major changes, please read carefully!**

View File

@ -1,7 +1,10 @@
#[cfg(feature = "metrics")] #[cfg(feature = "metrics")]
mod metrics_impl { mod metrics_impl {
use anyhow::{Context, Result}; use anyhow::{Context, Result};
#[cfg(feature = "prometheus/process")]
use prometheus::process_collector::ProcessCollector; use prometheus::process_collector::ProcessCollector;
use prometheus::{self, Encoder, HistogramOpts, HistogramVec, Registry}; use prometheus::{self, Encoder, HistogramOpts, HistogramVec, Registry};
use tiny_http::{Response, Server}; use tiny_http::{Response, Server};
@ -17,6 +20,7 @@ mod metrics_impl {
pub fn new(addr: SocketAddr) -> Result<Self> { pub fn new(addr: SocketAddr) -> Result<Self> {
let reg = Registry::new(); let reg = Registry::new();
#[cfg(feature = "prometheus/process")]
reg.register(Box::new(ProcessCollector::for_self())) reg.register(Box::new(ProcessCollector::for_self()))
.expect("failed to register ProcessCollector"); .expect("failed to register ProcessCollector");