adding tokio metrics to prometheus
This commit is contained in:
parent
d130b83115
commit
3f8be135db
|
@ -4878,9 +4878,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
|||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.25.0"
|
||||
version = "1.26.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af"
|
||||
checksum = "03201d01c3c27a29c8a5cee5b55a93ddae1ccf6f08f65365c2c918f8c1b76f64"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"bytes",
|
||||
|
@ -4893,7 +4893,7 @@ dependencies = [
|
|||
"signal-hook-registry",
|
||||
"socket2",
|
||||
"tokio-macros",
|
||||
"windows-sys 0.42.0",
|
||||
"windows-sys 0.45.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
@ -9,6 +9,10 @@ members = [
|
|||
"bench"
|
||||
]
|
||||
|
||||
[build]
|
||||
rustflags = ["--cfg", "tokio_unstable"]
|
||||
rustdocflags = ["--cfg", "tokio_unstable"]
|
||||
|
||||
[dev-dependencies]
|
||||
bench = { path = "./bench" }
|
||||
|
||||
|
@ -24,7 +28,7 @@ solana-version= { git = "https://github.com/blockworks-foundation/solana", branc
|
|||
solana-client= { git = "https://github.com/blockworks-foundation/solana", branch="lite_rpc" }
|
||||
serde = { version = "1.0.152", features = ["derive"] }
|
||||
serde_json = "1.0.93"
|
||||
tokio = { version = "1.25.0", features = ["full"]}
|
||||
tokio = { version = "1.25.0", features = ["full"]}
|
||||
bincode = "1.3.3"
|
||||
bs58 = "0.4.0"
|
||||
base64 = "0.21.0"
|
||||
|
|
|
@ -10,6 +10,13 @@ use serde::{Deserialize, Serialize};
|
|||
|
||||
lazy_static::lazy_static! {
|
||||
static ref TXS_IN_STORE: GenericGauge<prometheus::core::AtomicI64> = register_int_gauge!(opts!("literpc_txs_in_store", "Transactions in store")).unwrap();
|
||||
static ref TOKIO_TASKS: GenericGauge<prometheus::core::AtomicI64> = register_int_gauge!(opts!("literpc_tokio_tasks", "Tokio tasks in lite rpc")).unwrap();
|
||||
static ref TOKIO_QUEUEDEPTH: GenericGauge<prometheus::core::AtomicI64> = register_int_gauge!(opts!("literpc_tokio_blocking_queue_depth", "Tokio tasks in blocking queue in lite rpc")).unwrap();
|
||||
static ref TOKIO_INJQUEUEDEPTH: GenericGauge<prometheus::core::AtomicI64> = register_int_gauge!(opts!("literpc_tokio_injection_queue_depth", "Tokio tasks in injection queue in lite rpc")).unwrap();
|
||||
static ref TOKIO_NB_BLOCKING_THREADS: GenericGauge<prometheus::core::AtomicI64> = register_int_gauge!(opts!("literpc_tokio_blocking_threads", "Tokio blocking threads in lite rpc")).unwrap();
|
||||
static ref TOKIO_NB_IDLE_THREADS: GenericGauge<prometheus::core::AtomicI64> = register_int_gauge!(opts!("literpc_tokio_idle_threads", "Tokio idle threads in lite rpc")).unwrap();
|
||||
|
||||
static ref STD_THREADS: GenericGauge<prometheus::core::AtomicI64> = register_int_gauge!(opts!("literpc_threads", "Nb of threads used by literpc")).unwrap();
|
||||
}
|
||||
|
||||
/// Background worker which captures metrics
|
||||
|
@ -81,6 +88,13 @@ impl MetricsCapture {
|
|||
metrics.txs_confirmed = txs_confirmed;
|
||||
metrics.txs_finalized = txs_finalized;
|
||||
TXS_IN_STORE.set(txs_sent as i64);
|
||||
|
||||
let metrics = tokio::runtime::Handle::current().metrics();
|
||||
TOKIO_TASKS.set(metrics.num_workers() as i64);
|
||||
TOKIO_QUEUEDEPTH.set(metrics.blocking_queue_depth() as i64);
|
||||
TOKIO_NB_BLOCKING_THREADS.set(metrics.num_blocking_threads() as i64);
|
||||
TOKIO_NB_IDLE_THREADS.set(metrics.num_idle_blocking_threads() as i64);
|
||||
TOKIO_INJQUEUEDEPTH.set( metrics.injection_queue_depth() as i64 );
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue