From 9e1ea9718af31e9236a0377d80722ae2ea3dcad8 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Thu, 18 Jul 2024 12:26:10 +0200 Subject: [PATCH] chore: clarify metrics and prometheus (#9603) --- crates/ethereum/node/src/launch.rs | 4 ++-- crates/node/builder/src/launch/common.rs | 11 +++++++++-- crates/node/builder/src/launch/mod.rs | 4 ++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/crates/ethereum/node/src/launch.rs b/crates/ethereum/node/src/launch.rs index eb699cea2..029e3960d 100644 --- a/crates/ethereum/node/src/launch.rs +++ b/crates/ethereum/node/src/launch.rs @@ -89,7 +89,7 @@ where .inspect(|_| { info!(target: "reth::cli", "Database opened"); }) - .with_prometheus().await? + .with_prometheus_server().await? .inspect(|this| { debug!(target: "reth::cli", chain=%this.chain_id(), genesis=?this.genesis_hash(), "Initializing genesis"); }) @@ -97,7 +97,7 @@ where .inspect(|this| { info!(target: "reth::cli", "\n{}", this.chain_spec().display_hardforks()); }) - .with_metrics() + .with_metrics_task() // passing FullNodeTypes as type parameter here so that we can build // later the components. .with_blockchain_db::()? diff --git a/crates/node/builder/src/launch/common.rs b/crates/node/builder/src/launch/common.rs index b141768d5..a2b281861 100644 --- a/crates/node/builder/src/launch/common.rs +++ b/crates/node/builder/src/launch/common.rs @@ -454,8 +454,10 @@ where self.right().static_file_provider() } + /// This launches the prometheus endpoint. + /// /// Convenience function to [`Self::start_prometheus_endpoint`] - pub async fn with_prometheus(self) -> eyre::Result { + pub async fn with_prometheus_server(self) -> eyre::Result { self.start_prometheus_endpoint().await?; Ok(self) } @@ -486,7 +488,12 @@ where /// Creates a new `WithMeteredProvider` container and attaches it to the /// launch context. - pub fn with_metrics(self) -> LaunchContextWith>> { + /// + /// This spawns a metrics task that listens for metrics related events and updates metrics for + /// prometheus. + pub fn with_metrics_task( + self, + ) -> LaunchContextWith>> { let (metrics_sender, metrics_receiver) = unbounded_channel(); let with_metrics = diff --git a/crates/node/builder/src/launch/mod.rs b/crates/node/builder/src/launch/mod.rs index fb22e7908..c18381a2d 100644 --- a/crates/node/builder/src/launch/mod.rs +++ b/crates/node/builder/src/launch/mod.rs @@ -135,7 +135,7 @@ where .inspect(|_| { info!(target: "reth::cli", "Database opened"); }) - .with_prometheus().await? + .with_prometheus_server().await? .inspect(|this| { debug!(target: "reth::cli", chain=%this.chain_id(), genesis=?this.genesis_hash(), "Initializing genesis"); }) @@ -143,7 +143,7 @@ where .inspect(|this| { info!(target: "reth::cli", "\n{}", this.chain_spec().display_hardforks()); }) - .with_metrics() + .with_metrics_task() // passing FullNodeTypes as type parameter here so that we can build // later the components. .with_blockchain_db::()?