From 74563d16f848cf89994cef657130b974719365dd Mon Sep 17 00:00:00 2001 From: ControlCplusControlV <44706811+ControlCplusControlV@users.noreply.github.com> Date: Thu, 27 Oct 2022 17:45:57 -0600 Subject: [PATCH 1/9] added metrics config option --- fuel-block-executor/src/config.rs | 3 +++ fuel-block-importer/src/config.rs | 4 +++- fuel-block-producer/src/config.rs | 1 + fuel-block-producer/tests/integration.rs | 1 + fuel-core/src/cli/run.rs | 1 + fuel-core/src/service/modules.rs | 1 + fuel-p2p/src/config.rs | 4 ++++ fuel-poa-coordinator/src/config.rs | 1 + fuel-poa-coordinator/tests/test_trigger.rs | 7 +++++++ fuel-txpool/src/config.rs | 4 ++++ 10 files changed, 26 insertions(+), 1 deletion(-) diff --git a/fuel-block-executor/src/config.rs b/fuel-block-executor/src/config.rs index 580c7749d5a..6b253ae3cd2 100644 --- a/fuel-block-executor/src/config.rs +++ b/fuel-block-executor/src/config.rs @@ -2,4 +2,7 @@ pub struct Config { /// Print execution backtraces if transaction execution reverts. pub backtrace: bool, + + /// Enabled prometheus metrics for this fuel-servive + pub metrics: bool, } diff --git a/fuel-block-importer/src/config.rs b/fuel-block-importer/src/config.rs index fd170939531..476292ea8d8 100644 --- a/fuel-block-importer/src/config.rs +++ b/fuel-block-importer/src/config.rs @@ -1,2 +1,4 @@ #[derive(Default, Debug, Clone)] -pub struct Config {} +pub struct Config { + pub metrics: bool, +} diff --git a/fuel-block-producer/src/config.rs b/fuel-block-producer/src/config.rs index 234fea0a460..34cade8a895 100644 --- a/fuel-block-producer/src/config.rs +++ b/fuel-block-producer/src/config.rs @@ -4,4 +4,5 @@ use fuel_core_interfaces::common::fuel_tx::Address; pub struct Config { pub utxo_validation: bool, pub coinbase_recipient: Address, + pub metrics: bool, } diff --git a/fuel-block-producer/tests/integration.rs b/fuel-block-producer/tests/integration.rs index 136150d36d5..4e560347207 100644 --- a/fuel-block-producer/tests/integration.rs +++ b/fuel-block-producer/tests/integration.rs @@ -150,6 +150,7 @@ async fn block_producer() -> Result<()> { config: fuel_block_producer::config::Config { utxo_validation: true, coinbase_recipient: Address::default(), + metrics: false, }, db: Box::new(mock_db.clone()), txpool: Box::new(TxPoolAdapter { diff --git a/fuel-core/src/cli/run.rs b/fuel-core/src/cli/run.rs index 38c075eb0d1..373ab4c6409 100644 --- a/fuel-core/src/cli/run.rs +++ b/fuel-core/src/cli/run.rs @@ -190,6 +190,7 @@ impl Command { block_producer: fuel_block_producer::Config { utxo_validation, coinbase_recipient, + metrics: true, }, block_executor: Default::default(), #[cfg(feature = "relayer")] diff --git a/fuel-core/src/service/modules.rs b/fuel-core/src/service/modules.rs index 1d1e92f59e7..2edd45852f9 100644 --- a/fuel-core/src/service/modules.rs +++ b/fuel-core/src/service/modules.rs @@ -97,6 +97,7 @@ pub async fn start_modules(config: &Config, database: &Database) -> Result>, + pub metrics: bool, } /// Block production trigger for PoA operation diff --git a/fuel-poa-coordinator/tests/test_trigger.rs b/fuel-poa-coordinator/tests/test_trigger.rs index 1ee6b1b39ea..db340958bd0 100644 --- a/fuel-poa-coordinator/tests/test_trigger.rs +++ b/fuel-poa-coordinator/tests/test_trigger.rs @@ -349,6 +349,7 @@ async fn clean_startup_shutdown_each_trigger() -> anyhow::Result<()> { trigger, block_gas_limit: 100_000, signing_key: Some(test_signing_key()), + metrics: false, }); let (txpool, broadcast_rx) = MockTxPool::spawn(); @@ -425,6 +426,7 @@ async fn never_trigger_never_produces_blocks() -> anyhow::Result<()> { trigger: Trigger::Never, block_gas_limit: 100_000, signing_key: Some(test_signing_key()), + metrics: false, }); let (mut txpool, broadcast_rx) = MockTxPool::spawn(); @@ -470,6 +472,7 @@ async fn instant_trigger_produces_block_instantly() -> anyhow::Result<()> { trigger: Trigger::Instant, block_gas_limit: 100_000, signing_key: Some(test_signing_key()), + metrics: false, }); let (mut txpool, broadcast_rx) = MockTxPool::spawn(); @@ -532,6 +535,7 @@ async fn interval_trigger_produces_blocks_periodically() -> anyhow::Result<()> { }, block_gas_limit: 100_000, signing_key: Some(test_signing_key()), + metrics: false, }); let (mut txpool, broadcast_rx) = MockTxPool::spawn(); @@ -625,6 +629,7 @@ async fn interval_trigger_doesnt_react_to_full_txpool() -> anyhow::Result<()> { }, block_gas_limit: 100_000, signing_key: Some(test_signing_key()), + metrics: false, }); let (mut txpool, broadcast_rx) = MockTxPool::spawn(); @@ -683,6 +688,7 @@ async fn hybrid_trigger_produces_blocks_correctly() -> anyhow::Result<()> { }, block_gas_limit: 100_000, signing_key: Some(test_signing_key()), + metrics: false, }); let (mut txpool, broadcast_rx) = MockTxPool::spawn(); @@ -763,6 +769,7 @@ async fn hybrid_trigger_reacts_correctly_to_full_txpool() -> anyhow::Result<()> }, block_gas_limit: 100_000, signing_key: Some(test_signing_key()), + metrics: false, }); let (mut txpool, broadcast_rx) = MockTxPool::spawn(); diff --git a/fuel-txpool/src/config.rs b/fuel-txpool/src/config.rs index fdeb9e2576f..1a11604f056 100644 --- a/fuel-txpool/src/config.rs +++ b/fuel-txpool/src/config.rs @@ -12,6 +12,9 @@ pub struct Config { pub utxo_validation: bool, /// chain config pub chain_config: ChainConfig, + + /// Enable prometheus metrics for this fuel-servive + pub metrics: bool, } impl Default for Config { @@ -22,6 +25,7 @@ impl Default for Config { min_gas_price: 0, utxo_validation: true, chain_config: ChainConfig::default(), + metrics: true, } } } From 0cca225d4255b7044fb8e37bb1c9659b1bf64f27 Mon Sep 17 00:00:00 2001 From: ControlCplusControlV <44706811+ControlCplusControlV@users.noreply.github.com> Date: Thu, 27 Oct 2022 18:32:20 -0600 Subject: [PATCH 2/9] oops --- fuel-core/src/cli/run/p2p.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/fuel-core/src/cli/run/p2p.rs b/fuel-core/src/cli/run/p2p.rs index c9a741d38d7..2e2ac368612 100644 --- a/fuel-core/src/cli/run/p2p.rs +++ b/fuel-core/src/cli/run/p2p.rs @@ -172,6 +172,7 @@ impl From for anyhow::Result { set_connection_keep_alive: Duration::from_secs(args.connection_keep_alive), info_interval: Some(Duration::from_secs(args.info_interval)), identify_interval: Some(Duration::from_secs(args.identify_interval)), + metrics: true, }) } } From 5082b55187b372b76cba7fd8f5a95167defed03a Mon Sep 17 00:00:00 2001 From: ControlCplusControlV <44706811+ControlCplusControlV@users.noreply.github.com> Date: Thu, 27 Oct 2022 18:42:16 -0600 Subject: [PATCH 3/9] added cli arg --- fuel-core/src/cli/run.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fuel-core/src/cli/run.rs b/fuel-core/src/cli/run.rs index 373ab4c6409..e9080a45986 100644 --- a/fuel-core/src/cli/run.rs +++ b/fuel-core/src/cli/run.rs @@ -110,6 +110,9 @@ pub struct Command { #[cfg(feature = "p2p")] #[clap(flatten)] pub p2p_args: p2p::P2pArgs, + + #[clap(default_value = "true")] + pub metrics: bool, } impl Command { @@ -131,6 +134,7 @@ impl Command { relayer_args, #[cfg(feature = "p2p")] p2p_args, + metrics, } = self; let addr = net::SocketAddr::new(ip, port); From 0dcab922a61788d70d145eed9068aa8fd1ba6326 Mon Sep 17 00:00:00 2001 From: ControlCplusControlV <44706811+ControlCplusControlV@users.noreply.github.com> Date: Thu, 27 Oct 2022 18:59:21 -0600 Subject: [PATCH 4/9] cli --- fuel-core/src/cli/run.rs | 1 + fuel-core/src/cli/run/p2p.rs | 2 +- fuel-core/src/cli/run/relayer.rs | 1 + fuel-relayer/src/config.rs | 4 ++++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/fuel-core/src/cli/run.rs b/fuel-core/src/cli/run.rs index e9080a45986..a38dfa6d8f1 100644 --- a/fuel-core/src/cli/run.rs +++ b/fuel-core/src/cli/run.rs @@ -1,3 +1,4 @@ +#![allow(unused_variables)] use crate::{ cli::DEFAULT_DB_PATH, FuelService, diff --git a/fuel-core/src/cli/run/p2p.rs b/fuel-core/src/cli/run/p2p.rs index 2e2ac368612..40eddfb9d3b 100644 --- a/fuel-core/src/cli/run/p2p.rs +++ b/fuel-core/src/cli/run/p2p.rs @@ -172,7 +172,7 @@ impl From for anyhow::Result { set_connection_keep_alive: Duration::from_secs(args.connection_keep_alive), info_interval: Some(Duration::from_secs(args.info_interval)), identify_interval: Some(Duration::from_secs(args.identify_interval)), - metrics: true, + metrics: false, }) } } diff --git a/fuel-core/src/cli/run/relayer.rs b/fuel-core/src/cli/run/relayer.rs index ab692d3326f..10d6690241f 100644 --- a/fuel-core/src/cli/run/relayer.rs +++ b/fuel-core/src/cli/run/relayer.rs @@ -59,6 +59,7 @@ impl From for Config { sync_minimum_duration: Duration::from_secs(args.sync_minimum_duration_secs), syncing_call_frequency: Duration::from_secs(args.syncing_call_frequency_secs), syncing_log_frequency: Duration::from_secs(args.syncing_log_frequency_secs), + metrics: false, } } } diff --git a/fuel-relayer/src/config.rs b/fuel-relayer/src/config.rs index a691d46a07f..1d073142d9d 100644 --- a/fuel-relayer/src/config.rs +++ b/fuel-relayer/src/config.rs @@ -36,6 +36,9 @@ pub struct Config { /// How often progress logs are printed when the DA node is /// syncing. pub syncing_log_frequency: Duration, + + /// Enables metrics on this fuel service + pub metrics: bool, } #[allow(missing_docs)] @@ -62,6 +65,7 @@ impl Default for Config { sync_minimum_duration: Self::DEFAULT_SYNC_MINIMUM_DURATION, syncing_call_frequency: Self::DEFAULT_SYNCING_CALL_FREQ, syncing_log_frequency: Self::DEFAULT_SYNCING_LOG_FREQ, + metrics: true, } } } From 0df2c2c7650531b0896783c424d1198c161b960f Mon Sep 17 00:00:00 2001 From: ControlCplusControlV <44706811+ControlCplusControlV@users.noreply.github.com> Date: Thu, 27 Oct 2022 19:14:22 -0600 Subject: [PATCH 5/9] metrics --- fuel-core/src/cli/run.rs | 2 +- fuel-core/src/service/modules.rs | 2 +- fuel-p2p/src/config.rs | 2 +- fuel-relayer/src/config.rs | 2 +- fuel-txpool/src/config.rs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fuel-core/src/cli/run.rs b/fuel-core/src/cli/run.rs index a38dfa6d8f1..232ef33fa45 100644 --- a/fuel-core/src/cli/run.rs +++ b/fuel-core/src/cli/run.rs @@ -195,7 +195,7 @@ impl Command { block_producer: fuel_block_producer::Config { utxo_validation, coinbase_recipient, - metrics: true, + metrics: false, }, block_executor: Default::default(), #[cfg(feature = "relayer")] diff --git a/fuel-core/src/service/modules.rs b/fuel-core/src/service/modules.rs index 2edd45852f9..83f6c43cada 100644 --- a/fuel-core/src/service/modules.rs +++ b/fuel-core/src/service/modules.rs @@ -97,7 +97,7 @@ pub async fn start_modules(config: &Config, database: &Database) -> Result Date: Thu, 27 Oct 2022 19:15:19 -0600 Subject: [PATCH 6/9] disable metrics by default --- fuel-core/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fuel-core/Cargo.toml b/fuel-core/Cargo.toml index 534f7ec1582..c8e7bf2b34f 100644 --- a/fuel-core/Cargo.toml +++ b/fuel-core/Cargo.toml @@ -88,7 +88,7 @@ mockall = "0.11" [features] metrics = ["dep:fuel-metrics"] -default = ["rocksdb", "metrics", "debug"] +default = ["rocksdb", "debug"] debug = ["fuel-core-interfaces/debug"] relayer = ["dep:fuel-relayer"] p2p = ["dep:fuel-p2p"] From 4e711d33c836fd44fc9a821b25205f5f8c06509e Mon Sep 17 00:00:00 2001 From: ControlCplusControlV <44706811+ControlCplusControlV@users.noreply.github.com> Date: Thu, 27 Oct 2022 19:22:59 -0600 Subject: [PATCH 7/9] typos --- fuel-block-executor/src/config.rs | 2 +- fuel-core/Cargo.toml | 2 +- fuel-core/src/cli/run.rs | 2 +- fuel-p2p/src/config.rs | 2 +- fuel-txpool/src/config.rs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fuel-block-executor/src/config.rs b/fuel-block-executor/src/config.rs index 6b253ae3cd2..532be32551e 100644 --- a/fuel-block-executor/src/config.rs +++ b/fuel-block-executor/src/config.rs @@ -3,6 +3,6 @@ pub struct Config { /// Print execution backtraces if transaction execution reverts. pub backtrace: bool, - /// Enabled prometheus metrics for this fuel-servive + /// Enables prometheus metrics for this fuel-servive pub metrics: bool, } diff --git a/fuel-core/Cargo.toml b/fuel-core/Cargo.toml index c8e7bf2b34f..534f7ec1582 100644 --- a/fuel-core/Cargo.toml +++ b/fuel-core/Cargo.toml @@ -88,7 +88,7 @@ mockall = "0.11" [features] metrics = ["dep:fuel-metrics"] -default = ["rocksdb", "debug"] +default = ["rocksdb", "metrics", "debug"] debug = ["fuel-core-interfaces/debug"] relayer = ["dep:fuel-relayer"] p2p = ["dep:fuel-p2p"] diff --git a/fuel-core/src/cli/run.rs b/fuel-core/src/cli/run.rs index 232ef33fa45..12700503641 100644 --- a/fuel-core/src/cli/run.rs +++ b/fuel-core/src/cli/run.rs @@ -112,7 +112,7 @@ pub struct Command { #[clap(flatten)] pub p2p_args: p2p::P2pArgs, - #[clap(default_value = "true")] + #[clap(default_value = "false")] pub metrics: bool, } diff --git a/fuel-p2p/src/config.rs b/fuel-p2p/src/config.rs index 8efae92bfb0..645329a43fa 100644 --- a/fuel-p2p/src/config.rs +++ b/fuel-p2p/src/config.rs @@ -89,7 +89,7 @@ pub struct P2PConfig { /// Sets the keep-alive timeout of idle connections. pub set_connection_keep_alive: Duration, - /// Enabled prometheus metrics for this fuel-servive + /// Enables prometheus metrics for this fuel-servive pub metrics: bool, } diff --git a/fuel-txpool/src/config.rs b/fuel-txpool/src/config.rs index c2653d43388..8f606470c5b 100644 --- a/fuel-txpool/src/config.rs +++ b/fuel-txpool/src/config.rs @@ -13,7 +13,7 @@ pub struct Config { /// chain config pub chain_config: ChainConfig, - /// Enable prometheus metrics for this fuel-servive + /// Enables prometheus metrics for this fuel-servive pub metrics: bool, } From cbfd149133589bf3a3c20b97401141b3c1a89a10 Mon Sep 17 00:00:00 2001 From: ControlCplusControlV <44706811+ControlCplusControlV@users.noreply.github.com> Date: Thu, 27 Oct 2022 19:25:37 -0600 Subject: [PATCH 8/9] another typo --- fuel-block-executor/src/config.rs | 2 +- fuel-p2p/src/config.rs | 2 +- fuel-txpool/src/config.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fuel-block-executor/src/config.rs b/fuel-block-executor/src/config.rs index 532be32551e..1586a6ec302 100644 --- a/fuel-block-executor/src/config.rs +++ b/fuel-block-executor/src/config.rs @@ -3,6 +3,6 @@ pub struct Config { /// Print execution backtraces if transaction execution reverts. pub backtrace: bool, - /// Enables prometheus metrics for this fuel-servive + /// Enables prometheus metrics for this fuel-service pub metrics: bool, } diff --git a/fuel-p2p/src/config.rs b/fuel-p2p/src/config.rs index 645329a43fa..9b25784cac0 100644 --- a/fuel-p2p/src/config.rs +++ b/fuel-p2p/src/config.rs @@ -89,7 +89,7 @@ pub struct P2PConfig { /// Sets the keep-alive timeout of idle connections. pub set_connection_keep_alive: Duration, - /// Enables prometheus metrics for this fuel-servive + /// Enables prometheus metrics for this fuel-service pub metrics: bool, } diff --git a/fuel-txpool/src/config.rs b/fuel-txpool/src/config.rs index 8f606470c5b..32bbac7d1e9 100644 --- a/fuel-txpool/src/config.rs +++ b/fuel-txpool/src/config.rs @@ -13,7 +13,7 @@ pub struct Config { /// chain config pub chain_config: ChainConfig, - /// Enables prometheus metrics for this fuel-servive + /// Enables prometheus metrics for this fuel-service pub metrics: bool, } From cc0b3a1b47481a5118a979c253bf177fd8a39aa8 Mon Sep 17 00:00:00 2001 From: Brandon Kite Date: Thu, 27 Oct 2022 18:32:25 -0700 Subject: [PATCH 9/9] Update fuel-core/src/cli/run.rs --- fuel-core/src/cli/run.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fuel-core/src/cli/run.rs b/fuel-core/src/cli/run.rs index 12700503641..ea26ab00276 100644 --- a/fuel-core/src/cli/run.rs +++ b/fuel-core/src/cli/run.rs @@ -112,7 +112,7 @@ pub struct Command { #[clap(flatten)] pub p2p_args: p2p::P2pArgs, - #[clap(default_value = "false")] + #[clap(long = "metrics")] pub metrics: bool, }