mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 06:57:58 +00:00
Additional Metrics collected and exposed via prometheus (#5414)
This PR refactors the metrics measuring and Prometheus exposing entity in sc-service into its own submodule and extends the parameters it exposes by: - system load average (over one, five and 15min) - the TCP connection state of the process (lsof), refs #5304 - number of tokio threads - number of known forks - counter for items in each unbounded queue (with internal unbounded channels) - number of file descriptors opened by this process (*nix only at this point) - number of system threads (*nix only at this point) refs #4679 Co-authored-by: Max Inden <mail@max-inden.de> Co-authored-by: Ashley <ashley.ruglys@gmail.com>
This commit is contained in:
committed by
GitHub
parent
6847f8452e
commit
247822bb33
@@ -20,6 +20,7 @@ use futures::{Future, future, future::FutureExt};
|
||||
use futures::select;
|
||||
use futures::pin_mut;
|
||||
use sc_service::{AbstractService, Configuration};
|
||||
use sp_utils::metrics::{TOKIO_THREADS_ALIVE, TOKIO_THREADS_TOTAL};
|
||||
use crate::error;
|
||||
|
||||
#[cfg(target_family = "unix")]
|
||||
@@ -73,6 +74,13 @@ fn build_runtime() -> Result<tokio::runtime::Runtime, std::io::Error> {
|
||||
tokio::runtime::Builder::new()
|
||||
.thread_name("main-tokio-")
|
||||
.threaded_scheduler()
|
||||
.on_thread_start(||{
|
||||
TOKIO_THREADS_ALIVE.inc();
|
||||
TOKIO_THREADS_TOTAL.inc();
|
||||
})
|
||||
.on_thread_stop(||{
|
||||
TOKIO_THREADS_ALIVE.dec();
|
||||
})
|
||||
.enable_all()
|
||||
.build()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user