fix: task executor metrics (#11738)

This commit is contained in:
greged93
2024-10-16 12:39:25 +02:00
committed by GitHub
parent d421931b7e
commit 248b6b5905
3 changed files with 6 additions and 6 deletions

View File

@ -18,6 +18,7 @@ use reth_db::DatabaseEnv;
use reth_ethereum_cli::chainspec::EthereumChainSpecParser; use reth_ethereum_cli::chainspec::EthereumChainSpecParser;
use reth_node_builder::{NodeBuilder, WithLaunchContext}; use reth_node_builder::{NodeBuilder, WithLaunchContext};
use reth_node_ethereum::{EthExecutorProvider, EthereumNode}; use reth_node_ethereum::{EthExecutorProvider, EthereumNode};
use reth_node_metrics::recorder::install_prometheus_recorder;
use reth_tracing::FileWorkerGuard; use reth_tracing::FileWorkerGuard;
use std::{ffi::OsString, fmt, future::Future, sync::Arc}; use std::{ffi::OsString, fmt, future::Future, sync::Arc};
use tracing::info; use tracing::info;
@ -145,6 +146,10 @@ impl<C: ChainSpecParser<ChainSpec = ChainSpec>, Ext: clap::Args + fmt::Debug> Cl
let _guard = self.init_tracing()?; let _guard = self.init_tracing()?;
info!(target: "reth::cli", "Initialized tracing, debug log directory: {}", self.logs.log_file_directory); info!(target: "reth::cli", "Initialized tracing, debug log directory: {}", self.logs.log_file_directory);
// Install the prometheus recorder to be sure to record task
// executor's metrics
let _ = install_prometheus_recorder();
let runner = CliRunner::default(); let runner = CliRunner::default();
match self.command { match self.command {
Commands::Node(command) => { Commands::Node(command) => {

View File

@ -16,7 +16,6 @@ use reth_node_core::{
node_config::NodeConfig, node_config::NodeConfig,
version, version,
}; };
use reth_node_metrics::recorder::install_prometheus_recorder;
use std::{ffi::OsString, fmt, future::Future, net::SocketAddr, path::PathBuf, sync::Arc}; use std::{ffi::OsString, fmt, future::Future, net::SocketAddr, path::PathBuf, sync::Arc};
/// Start the node /// Start the node
@ -180,10 +179,6 @@ impl<
pruning, pruning,
}; };
// Register the prometheus recorder before creating the database,
// because database init needs it to register metrics.
let _ = install_prometheus_recorder();
let data_dir = node_config.datadir(); let data_dir = node_config.datadir();
let db_path = data_dir.db(); let db_path = data_dir.db();

View File

@ -288,7 +288,7 @@ pub struct TaskExecutor {
on_shutdown: Shutdown, on_shutdown: Shutdown,
/// Sender half for sending panic signals to this type /// Sender half for sending panic signals to this type
panicked_tasks_tx: UnboundedSender<PanickedTaskError>, panicked_tasks_tx: UnboundedSender<PanickedTaskError>,
// Task Executor Metrics /// Task Executor Metrics
metrics: TaskExecutorMetrics, metrics: TaskExecutorMetrics,
/// How many [`GracefulShutdown`] tasks are currently active /// How many [`GracefulShutdown`] tasks are currently active
graceful_tasks: Arc<AtomicUsize>, graceful_tasks: Arc<AtomicUsize>,