From e706429b0859eb0eedabb1ffd0bfb40083282055 Mon Sep 17 00:00:00 2001 From: aniketfuryrocks Date: Wed, 1 Feb 2023 00:14:24 +0530 Subject: [PATCH] rm procinfo --- Cargo.lock | 156 ++++++++++++++++++++++++++------- Cargo.toml | 1 - src/bridge.rs | 3 +- src/workers/metrics_capture.rs | 19 +--- 4 files changed, 128 insertions(+), 51 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ef9a41a1..de00eacf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -222,7 +222,7 @@ dependencies = [ "asn1-rs-derive", "asn1-rs-impl", "displaydoc", - "nom 7.1.3", + "nom", "num-traits", "rusticata-macros", "thiserror", @@ -1047,7 +1047,7 @@ checksum = "42d4bc9b0db0a0df9ae64634ac5bdefb7afcb534e182275ca0beadbe486701c1" dependencies = [ "asn1-rs", "displaydoc", - "nom 7.1.3", + "nom", "num-bigint 0.4.3", "num-traits", "rusticata-macros", @@ -2208,7 +2208,6 @@ dependencies = [ "log", "native-tls", "postgres-native-tls", - "procinfo", "serde", "serde_json", "serde_prometheus", @@ -2364,12 +2363,6 @@ dependencies = [ "pin-utils", ] -[[package]] -name = "nom" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf51a729ecf40266a2368ad335a5fdde43471f545a967109cd62146ecf8b66ff" - [[package]] name = "nom" version = "7.1.3" @@ -2900,18 +2893,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "procinfo" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ab1427f3d2635891f842892dda177883dca0639e05fe66796a62c9d2f23b49c" -dependencies = [ - "byteorder", - "libc", - "nom 2.2.1", - "rustc_version 0.2.3", -] - [[package]] name = "qstring" version = "0.7.2" @@ -3225,6 +3206,7 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustc_version" +<<<<<<< HEAD version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" @@ -3243,11 +3225,13 @@ dependencies = [ [[package]] name = "rustc_version" +======= +>>>>>>> 107e06a (rm procinfo) version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.16", + "semver", ] [[package]] @@ -3256,7 +3240,7 @@ version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "faf0c4a6ece9950b9abdb62b1cfcf2a68b3b67a10ba445b3bb85be2a293d0632" dependencies = [ - "nom 7.1.3", + "nom", ] [[package]] @@ -3394,6 +3378,7 @@ dependencies = [ [[package]] name = "semver" +<<<<<<< HEAD version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" @@ -3412,11 +3397,14 @@ dependencies = [ [[package]] name = "semver" +======= +>>>>>>> 107e06a (rm procinfo) version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" [[package]] +<<<<<<< HEAD name = "semver-parser" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3432,6 +3420,8 @@ dependencies = [ ] [[package]] +======= +>>>>>>> 107e06a (rm procinfo) name = "send_wrapper" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3729,7 +3719,7 @@ dependencies = [ "log", "num-derive", "num-traits", - "rustc_version 0.4.0", + "rustc_version", "serde", "solana-frozen-abi 1.15.0", "solana-frozen-abi-macro 1.15.0", @@ -3740,6 +3730,97 @@ dependencies = [ ] [[package]] +<<<<<<< HEAD +======= +name = "solana-clap-utils" +version = "1.14.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36228e03e14bc7d7707189b66f625981993f1a000b0b192d5b42367349901d91" +dependencies = [ + "chrono", + "clap 2.34.0", + "rpassword", + "solana-perf", + "solana-remote-wallet", + "solana-sdk", + "thiserror", + "tiny-bip39", + "uriparse", + "url", +] + +[[package]] +name = "solana-cli-config" +version = "1.14.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c43b08f24fd605eaeaafe0e834dc9b209137ac253bc874d32a5bdd791cbd318" +dependencies = [ + "dirs-next", + "lazy_static", + "serde", + "serde_derive", + "serde_yaml", + "solana-clap-utils", + "solana-sdk", + "url", +] + +[[package]] +name = "solana-client" +version = "1.14.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e270b1afd0b360c2aec42ae302ae7980ebb226017275b32a6156ab2ccbdad9" +dependencies = [ + "async-mutex", + "async-trait", + "base64 0.13.1", + "bincode", + "bs58", + "bytes", + "clap 2.34.0", + "crossbeam-channel", + "enum_dispatch", + "futures", + "futures-util", + "indexmap", + "indicatif", + "itertools", + "jsonrpc-core", + "lazy_static", + "log", + "quinn", + "quinn-proto", + "rand 0.7.3", + "rand_chacha 0.2.2", + "rayon", + "reqwest", + "rustls", + "semver", + "serde", + "serde_derive", + "serde_json", + "solana-account-decoder", + "solana-clap-utils", + "solana-faucet", + "solana-measure", + "solana-metrics", + "solana-net-utils", + "solana-sdk", + "solana-streamer", + "solana-transaction-status", + "solana-version", + "solana-vote-program", + "spl-token-2022", + "thiserror", + "tokio", + "tokio-stream", + "tokio-tungstenite", + "tungstenite", + "url", +] + +[[package]] +>>>>>>> 107e06a (rm procinfo) name = "solana-config-program" version = "1.15.0" dependencies = [ @@ -3774,7 +3855,7 @@ dependencies = [ "memmap2", "once_cell", "rand_core 0.6.4", - "rustc_version 0.4.0", + "rustc_version", "serde", "serde_bytes", "serde_derive", @@ -3825,7 +3906,7 @@ checksum = "be23cc7a382f54dfe1348edb94610e5cc146b8eb21563cdd04062a403c75ba62" dependencies = [ "proc-macro2 1.0.50", "quote 1.0.23", - "rustc_version 0.4.0", + "rustc_version", "syn 1.0.107", ] @@ -3956,7 +4037,7 @@ dependencies = [ "parking_lot", "rand 0.7.3", "rand_chacha 0.2.2", - "rustc_version 0.4.0", + "rustc_version", "rustversion", "serde", "serde_bytes", @@ -4040,7 +4121,7 @@ dependencies = [ "num-derive", "num-traits", "rand 0.7.3", - "rustc_version 0.4.0", + "rustc_version", "serde", "solana-frozen-abi 1.15.0", "solana-frozen-abi-macro 1.15.0", @@ -4117,6 +4198,7 @@ dependencies = [ "bs58", "indicatif", "log", +<<<<<<< HEAD "reqwest", "semver 1.0.16", "serde", @@ -4148,6 +4230,14 @@ dependencies = [ "solana-transaction-status", "solana-version", "spl-token-2022", +======= + "num-derive", + "num-traits", + "parking_lot", + "qstring", + "semver", + "solana-sdk", +>>>>>>> 107e06a (rm procinfo) "thiserror", ] @@ -4184,7 +4274,7 @@ dependencies = [ "qstring", "rand 0.7.3", "rand_chacha 0.2.2", - "rustc_version 0.4.0", + "rustc_version", "rustversion", "serde", "serde_bytes", @@ -4358,8 +4448,8 @@ name = "solana-version" version = "1.15.0" dependencies = [ "log", - "rustc_version 0.4.0", - "semver 1.0.16", + "rustc_version", + "semver", "serde", "serde_derive", "solana-frozen-abi 1.15.0", @@ -4375,7 +4465,7 @@ dependencies = [ "log", "num-derive", "num-traits", - "rustc_version 0.4.0", + "rustc_version", "serde", "serde_derive", "solana-frozen-abi 1.15.0", @@ -5315,7 +5405,7 @@ dependencies = [ "data-encoding", "der-parser", "lazy_static", - "nom 7.1.3", + "nom", "oid-registry", "rusticata-macros", "thiserror", diff --git a/Cargo.toml b/Cargo.toml index 7788c8de..8f4b9bee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,7 +37,6 @@ dashmap = "5.4.0" const_env = "0.1.2" jsonrpsee = { version = "0.16.2", features = ["macros", "full"] } tracing-subscriber = "0.3.16" -procinfo = "0.4.2" tokio-postgres = "0.7.7" native-tls = "0.2.11" postgres-native-tls = "0.5.0" diff --git a/src/bridge.rs b/src/bridge.rs index 68f40eca..77e774f2 100644 --- a/src/bridge.rs +++ b/src/bridge.rs @@ -124,6 +124,7 @@ impl LiteBridge { let metrics_capture = MetricsCapture::new(self.tx_sender.clone()); let prometheus_sync = PrometheusSync::new(metrics_capture.clone()).sync(); + let metrics_capture = metrics_capture.capture(); let finalized_block_listener = self .finalized_block_listener @@ -176,7 +177,7 @@ impl LiteBridge { tx_sender, finalized_block_listener, confirmed_block_listener, - metrics_capture.capture(postgres_send), + metrics_capture, prometheus_sync, cleaner, ]; diff --git a/src/workers/metrics_capture.rs b/src/workers/metrics_capture.rs index fdb2b965..0c66059a 100644 --- a/src/workers/metrics_capture.rs +++ b/src/workers/metrics_capture.rs @@ -1,10 +1,10 @@ use std::sync::Arc; -use log::{info, warn}; +use log::info; use solana_transaction_status::TransactionConfirmationStatus; use tokio::{sync::RwLock, task::JoinHandle}; -use super::{PostgresMpscSend, TxSender}; +use super::TxSender; use serde::{Deserialize, Serialize}; /// Background worker which captures metrics @@ -22,7 +22,6 @@ pub struct Metrics { pub txs_ps: usize, pub txs_confirmed_ps: usize, pub txs_finalized_ps: usize, - pub mem_used: Option, } impl MetricsCapture { @@ -37,7 +36,7 @@ impl MetricsCapture { self.metrics.read().await.to_owned() } - pub fn capture(self, postgres: Option) -> JoinHandle> { + pub fn capture(self) -> JoinHandle> { let mut one_second = tokio::time::interval(std::time::Duration::from_secs(1)); tokio::spawn(async move { @@ -76,18 +75,6 @@ impl MetricsCapture { metrics.txs_sent = txs_sent; metrics.txs_confirmed = txs_confirmed; metrics.txs_finalized = txs_finalized; - - metrics.mem_used = match procinfo::pid::statm_self() { - Ok(statm) => Some(statm.size), - Err(err) => { - warn!("Error capturing memory consumption {err}"); - None - } - }; - - if let Some(_postgres) = &postgres { - // postgres.send_metrics(metrics.clone()).await?; - } } }) }