From 05ebfc899870706cc54c3dd0648f6278c0c267ea Mon Sep 17 00:00:00 2001 From: Olivier 'reivilibre Date: Mon, 21 Mar 2022 20:19:59 +0000 Subject: [PATCH] Add process metrics --- Cargo.lock | 24 ++++++++++++++++++++++++ quickpeep_raker/Cargo.toml | 1 + quickpeep_raker/src/bin/qp-raker.rs | 7 +++++++ 3 files changed, 32 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 9eff500..0e7e67f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2347,6 +2347,14 @@ dependencies = [ "syn", ] +[[package]] +name = "metrics-process-promstyle" +version = "0.18.0" +dependencies = [ + "metrics 0.18.1", + "procfs", +] + [[package]] name = "metrics-util" version = "0.12.0" @@ -2913,6 +2921,21 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "procfs" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0941606b9934e2d98a3677759a971756eb821f75764d0e0d26946d08e74d9104" +dependencies = [ + "bitflags", + "byteorder", + "chrono", + "flate2", + "hex", + "lazy_static", + "libc", +] + [[package]] name = "psl" version = "2.0.81" @@ -3042,6 +3065,7 @@ dependencies = [ "mdbx-sys", "metrics 0.18.1", "metrics-exporter-prometheus", + "metrics-process-promstyle", "ouroboros", "publicsuffix", "quickpeep_densedoc", diff --git a/quickpeep_raker/Cargo.toml b/quickpeep_raker/Cargo.toml index 383458e..9d4ae46 100644 --- a/quickpeep_raker/Cargo.toml +++ b/quickpeep_raker/Cargo.toml @@ -77,4 +77,5 @@ lingua = "1.3.3" ### Metrics metrics = "0.18.1" metrics-exporter-prometheus = { version = "0.9.0", default-features = false, features = ["http-listener"] } +metrics-process-promstyle = { path = "../../../libraries/metrics-process-promstyle" } bare-metrics-recorder = "0.1.0" diff --git a/quickpeep_raker/src/bin/qp-raker.rs b/quickpeep_raker/src/bin/qp-raker.rs index c032d54..6b5b18c 100644 --- a/quickpeep_raker/src/bin/qp-raker.rs +++ b/quickpeep_raker/src/bin/qp-raker.rs @@ -124,6 +124,12 @@ pub async fn main() -> anyhow::Result<()> { warn!("BARE Metrics not supported yet, sorry."); } + let metrics_enabled = config.metrics.prometheus.is_some() || config.metrics.bare_metrics; + + if metrics_enabled { + metrics_process_promstyle::describe(); + } + let num_tasks = opts.concurrent_jobs + opts.concurrent_sleepers; let semaphore = Arc::new(Semaphore::new(opts.concurrent_jobs as usize)); @@ -214,6 +220,7 @@ pub async fn main() -> anyhow::Result<()> { _ = interval.tick() => { let txn = store.ro_txn()?; txn.emit_datastore_metrics()?; + metrics_process_promstyle::emit_now()?; } _ = &mut dsmu_cancel_rx => { break;