fix(bin): process metrics version mismatch (#5985)

This commit is contained in:
Alexey Shekhirin
2024-01-09 16:59:55 +00:00
committed by GitHub
parent 6ad221fd28
commit a1225be077
23 changed files with 69 additions and 55 deletions

58
Cargo.lock generated
View File

@ -4283,16 +4283,6 @@ dependencies = [
"portable-atomic",
]
[[package]]
name = "metrics"
version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77b9e10a211c839210fd7f99954bda26e5f8e26ec686ad68da6a32df7c80e782"
dependencies = [
"ahash",
"portable-atomic",
]
[[package]]
name = "metrics-exporter-prometheus"
version = "0.12.2"
@ -4303,7 +4293,7 @@ dependencies = [
"hyper",
"indexmap 1.9.3",
"ipnet",
"metrics 0.21.1",
"metrics",
"metrics-util",
"quanta",
"thiserror",
@ -4324,13 +4314,13 @@ dependencies = [
[[package]]
name = "metrics-process"
version = "1.2.0"
version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97ab55aa892047d9fa19d390afc5318492f956de3ec88a098adb4c0e663b4914"
checksum = "6aa2a67e2580fbeba4d5a96e659945981e700a383b4cea1432e0cfc18f58c5da"
dependencies = [
"libproc",
"mach2",
"metrics 0.22.0",
"metrics",
"once_cell",
"procfs",
"rlimit",
@ -4348,7 +4338,7 @@ dependencies = [
"crossbeam-utils",
"hashbrown 0.13.2",
"indexmap 1.9.3",
"metrics 0.21.1",
"metrics",
"num_cpus",
"ordered-float",
"quanta",
@ -5667,7 +5657,7 @@ dependencies = [
"itertools 0.12.0",
"jemalloc-ctl",
"jemallocator",
"metrics 0.21.1",
"metrics",
"metrics-exporter-prometheus",
"metrics-process",
"metrics-util",
@ -5757,7 +5747,7 @@ dependencies = [
"alloy-rlp",
"futures-core",
"futures-util",
"metrics 0.21.1",
"metrics",
"reth-interfaces",
"reth-metrics",
"reth-payload-builder",
@ -5778,7 +5768,7 @@ dependencies = [
"assert_matches",
"cfg-if",
"futures",
"metrics 0.21.1",
"metrics",
"reth-beacon-consensus-core",
"reth-blockchain-tree",
"reth-db",
@ -5822,7 +5812,7 @@ dependencies = [
"assert_matches",
"linked_hash_set",
"lru 0.11.1",
"metrics 0.21.1",
"metrics",
"parking_lot 0.12.1",
"reth-db",
"reth-interfaces",
@ -5894,7 +5884,7 @@ dependencies = [
"heapless",
"iai",
"itertools 0.12.0",
"metrics 0.21.1",
"metrics",
"modular-bitfield",
"once_cell",
"page_size",
@ -5981,7 +5971,7 @@ dependencies = [
"futures",
"futures-util",
"itertools 0.12.0",
"metrics 0.21.1",
"metrics",
"pin-project",
"rayon",
"reth-config",
@ -6042,7 +6032,7 @@ dependencies = [
"derive_more",
"ethers-core",
"futures",
"metrics 0.21.1",
"metrics",
"pin-project",
"proptest",
"proptest-derive",
@ -6168,7 +6158,7 @@ name = "reth-metrics"
version = "0.1.0-alpha.13"
dependencies = [
"futures",
"metrics 0.21.1",
"metrics",
"reth-metrics-derive",
"tokio",
"tokio-util",
@ -6178,7 +6168,7 @@ dependencies = [
name = "reth-metrics-derive"
version = "0.1.0-alpha.13"
dependencies = [
"metrics 0.21.1",
"metrics",
"once_cell",
"proc-macro2",
"quote",
@ -6230,7 +6220,7 @@ dependencies = [
"humantime-serde",
"linked-hash-map",
"linked_hash_set",
"metrics 0.21.1",
"metrics",
"parking_lot 0.12.1",
"pin-project",
"pprof",
@ -6318,7 +6308,7 @@ version = "0.1.0-alpha.13"
dependencies = [
"alloy-rlp",
"futures-util",
"metrics 0.21.1",
"metrics",
"reth-interfaces",
"reth-metrics",
"reth-primitives",
@ -6403,7 +6393,7 @@ dependencies = [
"auto_impl",
"dashmap",
"itertools 0.12.0",
"metrics 0.21.1",
"metrics",
"parking_lot 0.12.1",
"pin-project",
"rand 0.8.5",
@ -6428,7 +6418,7 @@ version = "0.1.0-alpha.13"
dependencies = [
"assert_matches",
"itertools 0.12.0",
"metrics 0.21.1",
"metrics",
"rayon",
"reth-config",
"reth-db",
@ -6494,7 +6484,7 @@ dependencies = [
"jsonrpsee",
"jsonwebtoken",
"lazy_static",
"metrics 0.21.1",
"metrics",
"pin-project",
"rand 0.8.5",
"rayon",
@ -6559,7 +6549,7 @@ version = "0.1.0-alpha.13"
dependencies = [
"hyper",
"jsonrpsee",
"metrics 0.21.1",
"metrics",
"reth-beacon-consensus",
"reth-interfaces",
"reth-ipc",
@ -6595,7 +6585,7 @@ dependencies = [
"async-trait",
"jsonrpsee-core",
"jsonrpsee-types",
"metrics 0.21.1",
"metrics",
"reth-beacon-consensus",
"reth-interfaces",
"reth-metrics",
@ -6679,7 +6669,7 @@ dependencies = [
"criterion",
"futures-util",
"itertools 0.12.0",
"metrics 0.21.1",
"metrics",
"num-traits",
"paste",
"pin-project",
@ -6713,7 +6703,7 @@ version = "0.1.0-alpha.13"
dependencies = [
"dyn-clone",
"futures-util",
"metrics 0.21.1",
"metrics",
"reth-metrics",
"thiserror",
"tokio",
@ -6756,7 +6746,7 @@ dependencies = [
"criterion",
"fnv",
"futures-util",
"metrics 0.21.1",
"metrics",
"parking_lot 0.12.1",
"paste",
"proptest",

View File

@ -76,7 +76,7 @@ toml = { workspace = true, features = ["display"] }
# metrics
metrics-exporter-prometheus = "0.12.1"
metrics-util = "0.15.0"
metrics-process = "1.0.9"
metrics-process = "=1.0.14"
reth-metrics.workspace = true
metrics.workspace = true
once_cell.workspace = true

View File

@ -239,3 +239,27 @@ fn collect_io_stats() {}
#[cfg(not(target_os = "linux"))]
fn describe_io_stats() {}
#[cfg(test)]
mod tests {
use crate::builder::PROMETHEUS_RECORDER_HANDLE;
use std::ops::Deref;
// Dependencies using different version of the `metrics` crate (to be exact, 0.21 vs 0.22)
// may not be able to communicate with each other through the global recorder.
//
// This test ensures that `metrics-process` dependency plays well with the current
// `metrics-exporter-prometheus` dependency version.
#[test]
fn process_metrics() {
// initialize the lazy handle
let _ = PROMETHEUS_RECORDER_HANDLE.deref();
let process = metrics_process::Collector::default();
process.describe();
process.collect();
let metrics = PROMETHEUS_RECORDER_HANDLE.render();
assert!(metrics.contains("process_cpu_seconds_total"));
}
}

View File

@ -385,7 +385,7 @@ pub fn random_log<R: Rng>(rng: &mut R, address: Option<Address>, topics_count: O
}
#[cfg(test)]
mod test {
mod tests {
use super::*;
use reth_primitives::{
hex, public_key_to_address, AccessList, Signature, TransactionKind, TxEip1559,

View File

@ -352,7 +352,7 @@ impl CanDisconnect<Bytes> for StreamClone {
}
#[cfg(test)]
mod test {
mod tests {
use std::{net::SocketAddr, pin::Pin};
use futures::{Future, SinkExt, StreamExt};

View File

@ -90,7 +90,7 @@ impl From<Vec<BlockBody>> for BlockBodies {
}
#[cfg(test)]
mod test {
mod tests {
use crate::types::{
message::RequestPair, BlockBodies, BlockHeaders, GetBlockBodies, GetBlockHeaders,
};

View File

@ -435,7 +435,7 @@ where
}
#[cfg(test)]
mod test {
mod tests {
use crate::{
errors::EthStreamError, types::message::RequestPair, EthMessage, EthMessageID, GetNodeData,
NodeData, ProtocolMessage,

View File

@ -33,7 +33,7 @@ pub struct Receipts(
);
#[cfg(test)]
mod test {
mod tests {
use crate::{
types::{message::RequestPair, GetReceipts},
Receipts,

View File

@ -26,7 +26,7 @@ pub struct GetNodeData(pub Vec<B256>);
pub struct NodeData(pub Vec<Bytes>);
#[cfg(test)]
mod test {
mod tests {
use reth_primitives::hex;
use crate::{message::RequestPair, GetNodeData, NodeData};

View File

@ -54,7 +54,7 @@ impl From<Vec<TransactionSigned>> for PooledTransactions {
}
#[cfg(test)]
mod test {
mod tests {
use crate::{message::RequestPair, GetPooledTransactions, PooledTransactions};
use alloy_rlp::{Decodable, Encodable};
use reth_primitives::{

View File

@ -112,7 +112,7 @@ impl From<EthVersion> for &'static str {
}
#[cfg(test)]
mod test {
mod tests {
use super::{EthVersion, ParseVersionError};
use std::{convert::TryFrom, string::ToString};

View File

@ -71,7 +71,7 @@ where
}
#[cfg(test)]
mod test {
mod tests {
use super::*;
#[test]

View File

@ -1335,7 +1335,7 @@ impl Display for InboundConnectionError {
}
#[cfg(test)]
mod test {
mod tests {
use super::PeersManager;
use crate::{
error::BackoffKind,

View File

@ -496,7 +496,7 @@ impl BlockBody {
}
#[cfg(test)]
mod test {
mod tests {
use super::{BlockId, BlockNumberOrTag::*, *};
use crate::hex_literal::hex;
use alloy_rlp::{Decodable, Encodable};

View File

@ -154,7 +154,7 @@ pub enum EliasFanoError {
}
#[cfg(test)]
mod test {
mod tests {
use super::*;
#[test]

View File

@ -40,7 +40,7 @@ pub fn deserialize_opt_prune_mode_with_min_blocks<
}
#[cfg(test)]
mod test {
mod tests {
use crate::PruneMode;
use assert_matches::assert_matches;
use serde::Deserialize;

View File

@ -174,7 +174,7 @@ where
}
#[cfg(test)]
mod test {
mod tests {
use super::JsonU256;
use alloy_primitives::U256;
use serde::{Deserialize, Serialize};

View File

@ -95,7 +95,7 @@ impl EthSigner for DevSigner {
}
#[cfg(test)]
mod test {
mod tests {
use super::*;
use reth_primitives::U256;
use std::str::FromStr;

View File

@ -123,7 +123,7 @@ impl Decode for BlockNumberAddress {
impl_fixed_arbitrary!(BlockNumberAddress, 28);
#[cfg(test)]
mod test {
mod tests {
use super::*;
use rand::{thread_rng, Rng};
use std::str::FromStr;

View File

@ -87,7 +87,7 @@ pub struct StoredBlockWithdrawals {
pub type HeaderHash = B256;
#[cfg(test)]
mod test {
mod tests {
use super::*;
use crate::table::{Compress, Decompress};

View File

@ -225,7 +225,7 @@ macro_rules! mdbx_try_optional {
}
#[cfg(test)]
mod test {
mod tests {
use super::*;
#[test]

View File

@ -39,7 +39,7 @@ impl Deref for LoadedJar {
}
#[cfg(test)]
mod test {
mod tests {
use super::*;
use crate::{test_utils::create_test_provider_factory, HeaderProvider};
use rand::{self, seq::SliceRandom};

View File

@ -403,7 +403,7 @@ pub struct AccessListItem {
pub type AccessList = Vec<AccessListItem>;
#[cfg(test)]
mod test {
mod tests {
use super::*;
use serde_json;