Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(bin): process metrics version mismatch #5985

Merged
merged 2 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 24 additions & 34 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bin/reth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 22 additions & 0 deletions bin/reth/src/prometheus_exporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,3 +239,25 @@ fn collect_io_stats() {}

#[cfg(not(target_os = "linux"))]
fn describe_io_stats() {}

#[cfg(test)]
mod tests {
use crate::prometheus_exporter::install_recorder;

// 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() {
let handle = install_recorder().unwrap();

Copy link
Member

@Rjected Rjected Jan 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fails if running with cargo test --workspace --tests:

failures:
    cli::tests::parse_env_filter_directives
    prometheus_exporter::tests::process_metrics

reason: recorder installed twice

let process = metrics_process::Collector::default();
process.describe();
process.collect();

let metrics = handle.render();
assert!(metrics.contains("process_cpu_seconds_total"));
}
}
2 changes: 1 addition & 1 deletion crates/interfaces/src/test_utils/generators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion crates/net/eth-wire/src/muxdemux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion crates/net/eth-wire/src/types/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
2 changes: 1 addition & 1 deletion crates/net/eth-wire/src/types/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ where
}

#[cfg(test)]
mod test {
mod tests {
use crate::{
errors::EthStreamError, types::message::RequestPair, EthMessage, EthMessageID, GetNodeData,
NodeData, ProtocolMessage,
Expand Down
2 changes: 1 addition & 1 deletion crates/net/eth-wire/src/types/receipts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub struct Receipts(
);

#[cfg(test)]
mod test {
mod tests {
use crate::{
types::{message::RequestPair, GetReceipts},
Receipts,
Expand Down
2 changes: 1 addition & 1 deletion crates/net/eth-wire/src/types/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion crates/net/eth-wire/src/types/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down
2 changes: 1 addition & 1 deletion crates/net/eth-wire/src/types/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
2 changes: 1 addition & 1 deletion crates/net/network/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ where
}

#[cfg(test)]
mod test {
mod tests {
use super::*;

#[test]
Expand Down
2 changes: 1 addition & 1 deletion crates/net/network/src/peers/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1335,7 +1335,7 @@ impl Display for InboundConnectionError {
}

#[cfg(test)]
mod test {
mod tests {
use super::PeersManager;
use crate::{
error::BackoffKind,
Expand Down
2 changes: 1 addition & 1 deletion crates/primitives/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion crates/primitives/src/integer_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ pub enum EliasFanoError {
}

#[cfg(test)]
mod test {
mod tests {
use super::*;

#[test]
Expand Down
2 changes: 1 addition & 1 deletion crates/primitives/src/serde_helper/prune.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc-types/src/serde_helpers/json_u256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ where
}

#[cfg(test)]
mod test {
mod tests {
use super::JsonU256;
use alloy_primitives::U256;
use serde::{Deserialize, Serialize};
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc/src/eth/signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl EthSigner for DevSigner {
}

#[cfg(test)]
mod test {
mod tests {
use super::*;
use reth_primitives::U256;
use std::str::FromStr;
Expand Down
Loading
Loading