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

Fix process-related metrics collection feature

Previously, it wasn't enabled when building with:
```
cargo build --all --features "prometheus/process" --release
```
This commit is contained in:
Roman Zeyde 2021-10-05 13:12:18 +03:00
parent 1402d290dc
commit ca93d3c75c
4 changed files with 63 additions and 3 deletions

59
Cargo.lock generated
View File

@ -1,5 +1,11 @@
# 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"
@ -243,6 +249,15 @@ dependencies = [
"void",
]
[[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"
@ -374,6 +389,18 @@ dependencies = [
"termcolor",
]
[[package]]
name = "flate2"
version = "1.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e6988e897c1c9c485f43b47a529cef42fde0547f9d8d41a7062518f1d8fc53f"
dependencies = [
"cfg-if 1.0.0",
"crc32fast",
"libc",
"miniz_oxide",
]
[[package]]
name = "fmt2io"
version = "0.1.0"
@ -428,6 +455,12 @@ 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"
@ -560,6 +593,16 @@ 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"
@ -657,6 +700,20 @@ dependencies = [
"unicode-xid",
]
[[package]]
name = "procfs"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95e344cafeaeefe487300c361654bcfc85db3ac53619eeccced29f5ea18c4c70"
dependencies = [
"bitflags",
"byteorder",
"flate2",
"hex",
"lazy_static",
"libc",
]
[[package]]
name = "prometheus"
version = "0.13.0"
@ -666,8 +723,10 @@ dependencies = [
"cfg-if 1.0.0",
"fnv",
"lazy_static",
"libc",
"memchr",
"parking_lot",
"procfs",
"protobuf",
"thiserror",
]

View File

@ -15,6 +15,7 @@ build = "build.rs"
[features]
default = ["metrics"]
metrics = ["prometheus", "tiny_http"]
metrics_process = ["prometheus/process"]
[package.metadata.configure_me]
spec = "internal/config_specification.toml"

View File

@ -3,7 +3,7 @@ set -eux
cd `dirname $0`
cargo fmt --all
cargo build --all --features "prometheus/process" --release
cargo build --all --features "metrics_process" --release
NETWORK=$1
shift

View File

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